o <- options(digits = 4)
## load verbal aggression data
data("VerbalAggression", package = "psychotools")
## fit Rasch model to verbal aggression data
rmod <- raschmodel(VerbalAggression$resp2)
## extract the discrimination parameters
dp1 <- discrpar(rmod)
## extract the standard errors
sqrt(diag(vcov(dp1)))
if(requireNamespace("mirt")) {
## fit 2PL to verbal aggression data
twoplmod <- nplmodel(VerbalAggression$resp2)
## extract the discrimination parameters
dp2 <- discrpar(twoplmod)
## this time with the first discrimination parameter being the reference
discrpar(twoplmod, ref = 1)
## extract the standard errors
sqrt(diag(vcov(dp2)))
}
options(digits = o$digits)
Run the code above in your browser using DataLab