R/test.information.curve.R

#' Test Information Curve
#'
#' Experimental: This item information curve is not computed using formula
#' but simulation. This function simulate data given beta
#' then the data is converted into logit score using R2L function.
#' Then, we will produce a plot of uncertainty against the known logit score
#'
#' @param beta beta of each item
#' @param thres andrich threshold
#' @param n.chains number of chains in MCMC
#' @export test.information.curve


test.information.curve = function (beta, thres, n.chains){

  t = rep(seq(-2, 2, 0.5), 20)
  thres = c(0, thres)
  data = psych::sim.poly(nvar = length(beta),n = length(t),d = beta, theta = t, cat = length(thres))$items + 1
  item = colnames(data)
  obj = raw2logit(data, item, beta, thres, n.chains)
  q = cbind(theta(obj), t)
  q = cbind(q, q[,2] - q[,1])
  plot(q[,4], q[,5], xlab = "Ability", ylab = "Uncertainty")
}
changxiulee/BayesianRasch documentation built on Nov. 18, 2019, 6:54 a.m.