dat <- data.frame(item1 = c(4, 2, 3, 4, 1, 2, 4, 2),
item2 = c(4, 3, 3, 3, 2, 2, 4, 1),
item3 = c(3, 2, 4, 2, 1, 3, 4, 1),
item4 = c(4, 1, 2, 3, 2, 3, 4, 2))
# Example 1a: Compute unstandardized coefficient alpha and item statistics
item.alpha(dat)
# Example 1b: Alternative specification using the 'data' argument
item.alpha(., data = dat)
# Example 2: Compute standardized coefficient alpha and item statistics
item.alpha(dat, std = TRUE)
# Example 3: Compute unstandardized coefficient alpha
item.alpha(dat, print = "alpha")
# Example 4: Compute item statistics
item.alpha(dat, print = "item")
# Example 5: Compute unstandardized coefficient alpha and item statistics while excluding item3
item.alpha(dat, exclude = "item3")
# Example 6: Compute variance-covariance matrix
dat.cov <- cov(dat)
# Compute unstandardized coefficient alpha based on the variance-covariance matrix
item.alpha(dat.cov)
# Compute correlation matrix
dat.cor <- cor(dat)
# Example 7: Compute standardized coefficient alpha based on the correlation matrix
item.alpha(dat.cor)
# Example 8: Compute ordinal coefficient alpha
item.alpha(dat, ordered = TRUE)
if (FALSE) {
# Example 9a: Write results into a text file
result <- item.alpha(dat, write = "Alpha.txt")
# Example 9b: Write results into a Excel file
result <- item.alpha(dat, write = "Alpha.xlsx")
result <- item.alpha(dat, output = FALSE)
write.result(result, "Alpha.xlsx")
}
Run the code above in your browser using DataLab