if (FALSE) {
dat <- data.frame(item1 = c(3, NA, 3, 4, 1, 2, 4, 2), item2 = c(5, 3, 3, 2, 2, 1, 3, 1),
item3 = c(4, 2, 4, 2, 1, 3, 4, 1), item4 = c(4, 1, 2, 2, 1, 3, 4, 3))
# Example 1a: Coefficient alpha and item statistics, pairwise deletion
item.alpha(dat)
# Example 1b: Coefficient alpha and item statistics, listwise deletion
item.alpha(dat, missing = "listwise")
# Example 1c: Coefficient alpha and item statistics, FIML
item.alpha(dat, estimator = "ML", missing = "fiml")
# Example 2: Coefficient alpha and item statistics after excluding item3
item.alpha(dat, exclude = "item3")
# Example 3a: Coefficient alpha with a residual covariance
# and item statistics
item.alpha(dat, rescov = c("item1", "item2"))
# Example 3b: Coefficient alpha with residual covariances
# and item statistics
item.alpha(dat, rescov = list(c("item1", "item2"), c("item1", "item3")))
# Example 4: Ordinal coefficient alpha and item statistics
item.alpha(dat, type = "categ")
# Example 6: Summary of the CFA model used to compute coefficient alpha
lavaan::summary(item.alpha(dat, output = FALSE)$model.fit,
fit.measures = TRUE, standardized = TRUE)
# Example 7a: Write Results into a text file
item.alpha(dat, write = "Alpha.txt")
# Example 7b: Write Results into a Excel file
item.alpha(dat, write = "Alpha.xlsx")
}
Run the code above in your browser using DataLab