#' Beta
#'
#' Get the difficulty of each item from a BPRM object.
#'
#'
#' @param obj An object from BPRM or BPRM.DIF.
#' @param g If the object is from BPRM.DIF, g is the group of subject
#' @export beta
beta = function(obj, g = 1) {
if(obj$DIF == TRUE){
codaSamples = obj$mcmc[[g]]
}else{
codaSamples = obj$mcmc
}
item = obj$item
if(class(obj) == "BPCM"){
out = t(HDInterval::hdi(betaMCMC(obj, g)))
out = cbind(out, apply(betaMCMC(obj, g), 2, mean))
round(out, 2)
}else if (class(obj) == "BRSM"){
matrix = t(HDInterval::hdi(codaSamples[,paste0("beta[", 1:length(item), "]")]))
out = c()
for(i in 1:length(item)){out = c(out, mean(codaSamples[,paste0("beta[", i, "]")]))}
round(cbind(matrix, mean = out), 2)
}
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.