#' theta
#'
#' Extract ability estimated from model
#'
#' @param obj An BPCM or BRSM obj
#' @param g If it is a DIF object, specify group of interest.
#' @export theta
theta = function(obj, g = 1) {
if(obj$DIF == TRUE){
codaSamples = obj$mcmc[[g]]
}else{
codaSamples = obj$mcmc
}
N = obj$N[g]
theta = NULL
thetaMean = c()
for(i in 1:N){
theta = rbind(theta, HDInterval::hdi(codaSamples[,paste0("theta[", g,",", i,"]")]))
thetaMean = c(thetaMean, mean(codaSamples[,paste0("theta[", g,",", i,"]")]))
}
round(cbind(theta, thetaMean), 2)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.