Description Usage Arguments Details Value Author(s) References See Also Examples
View source: R/reliabilityAll.R
One often needs to estimate reliability for a large set of scales. This function does that in a convenient way, exploiting regularities in the naming of the items belonging to each scale.
1 2 |
data |
A dataframe. |
pattern |
A list of named items. Each element of the list identifies a set of items composing a scale, through a vector of strings. Each scale for which reliability is computed is identified by a vector of strings. All items whose names include all the strings specified in the vector are included in the scale. |
simplify |
Logical. If true, format the results in a table, otherwise return the raw results from functions |
recode |
Logical. Whether reverse-coded items should be recoded (i.e., multiplied by -1) before estimating reliability. See argument |
recString |
A string that identifies reverse-coded items, by default "_r". Be careful: if |
omega |
Logical. Whether coefficient omega should be estimated. |
Cronbach's alpha is estimated through alpha
using default settings. McDonald's Omega is estimated through ci.reliability
using argument type == NULL
, which results in estimating hierarchical omega for continuous items and categorical omega for categorical items.
if simplify = TRUE
, a data.frame including the following items for each scale
scale |
the name of the scale |
nitem |
the number of items in the scale |
raw_alpha |
the raw alpha value from |
std_alpha |
the std alpha value from |
omega |
the omega estimate from |
errorsAlpha |
error messages returned by function |
warningsAlpha |
warnings returned by function |
errorsOmega |
error messages returned by function |
warningsOmega |
warnings returned by function |
Otherwise, a list including the output of alpha
and ci.reliability
for each scale.
Giulio Costantini
Cronbach, L.J. (1951) Coefficient alpha and the internal strucuture of tests. Psychometrika, 16, 297-334.
Kelley, K. & Pornprasertmanit, P. (2016). Confidence intervals for population reliability coefficients: Evaluation of methods, recommendations, and software for homogeneous composite measures. Psychological Methods 21(1), 69-92. https://doi.org/10.1037/a0040086
McDonald, R. P. (1999). Test theory: A unified approach. Mahwah, New Jersey: Lawrence Erlbaum Associates, Publishers.
Revelle, W. (in preparation) An introduction to psychometric theory with applications in R. Springer. (Available online at https://personality-project.org/r/book).
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 | library(psychTools)
library(lavaan)
data(bfi)
# compute alpha and omega for dataset bfi in psychTools. Warnings and negative values
# of alpha reflect the fact that items were not reverse-scored
reliabilityAll(bfi,
pattern = list(
"Openness" = c("O"),
"Conscientiousness" = c("C"),
"Extraversion" = c("E"),
"Agreeableness" = c("A"),
"Neuroticism" = c("N")))
# bfi.keys include information on reverse-scoring. In particular, items with the string
# "-" are reverse-scored. We can exploit this information to reverse-score all items
bfi2 <- bfi
names(bfi2)[1:25] <- c("-A1", "A2", "A3", "A4", "A5",
"C1", "C2", "C3", "-C4", "-C5",
"-E1", "-E2", "E3", "E4", "E5" ,
"N1", "N2", "N3", "N4", "N5",
"O1", "-O2", "O3", "O4", "-O5")
reliabilityAll(bfi2, pattern = list(
"Openness" = c("O"),
"Conscientiousness" = c("C"),
"Extraversion" = c("E"),
"Agreeableness" = c("A"),
"Neuroticism" = c("N")),
recode = TRUE,
recString = "-")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.