# Generate some fictional data. Say, 1000 individuals take a 20-item test.
set.seed(1234)
p.success <- rBeta.4P(1000, 0.15, 0.85, 6, 4)
for (i in 1:20) {
if (i == 1) {
rawdata <- matrix(nrow = 1000, ncol = 20)
}
rawdata[, i] <- rbinom(1000, 1, p.success)
}
# Suppose the cutoff value for attaining a pass is 10 items correct, and
# that the reliability of this test was estimated using the Cronbach's Alpha
# estimator. To estimate and retrieve the estimated parameters, confusion and
# consistency matrices, and accuracy and consistency indices using HB.CA():
(output <- HB.CA.MC(x = rowSums(rawdata), reliability = cba(rawdata),
cut = c(8, 12), testlength = 20))
# The output for this function can get quite verbose as more categories are
# included. The output from the function can be fed to the MC.out.tabular()
# function in order to organize the output in a tabular format.
MC.out.tabular(output)
Run the code above in your browser using DataLab