# 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 being placed in the lower category is a score
# below 10, middle category 15, and the upper category 15 or above. Using the
# cba() function to estimate the reliability of this test, to use the
# HB.CA.MC() function or estimating diagnostic performance and consistency
# indices of classifications when using several cut-points:
(output <- HB.CA.MC(rowSums(rawdata), cba(rawdata), c(10, 15), 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