#' categoryMeasure
#'
#' For response category analysis, for each category, get the theta estimated for subject that
#' choose the category and average them
#'
#' Reference
#' Linacre, J. M. (2002). Optimizing rating scale category effectiveness. Journal of applied measurement, 3(1), 85-106.
#' Linacre, J. M., & Wright, B. D. (2000). Winsteps. URL: http://www. winsteps. com/index. html
#'
#' @param obj Any model in the package
#' @export categoryMeasure
categoryMeasure = function (obj) {
if(obj$DIF == TRUE){
show("This is not available for DIF object")
}else{
item = obj$item
data = obj$data[,item]
if(min(apply(data, 2, min,na.rm = TRUE)) == 0){data = data + 1}
theta.v = theta(obj)[,3]
beta.v = beta(obj)[,3]
K = apply(data, 2, max,na.rm = TRUE)
out = matrix(NA,length(item), max(K))
rownames(out) = item
colnames(out) = 1:max(K)
for(i in 1:length(item)){
m = cbind(data[,i], theta.v - beta.v)
m = m[order(m[,1]),]
for(j in 1:K[i]){out[i,j]= mean(m[m[,1] == j, ], na.rm = TRUE)}
}
out
}
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.