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