if (FALSE) {
#############################################################################
# EXAMPLE 1: Fitted unidimensional model with gdm
#############################################################################
data(data.Students)
dat <- data.Students
# select part of the dataset
resp <- dat[, paste0("sc",1:4) ]
resp[ paste(resp[,1])==3,1] <- 2
psych::describe(resp)
# Model 1: Partial credit model in gdm
theta.k <- seq( -5, 5, len=21 ) # discretized ability
mod1 <- CDM::gdm( dat=resp, irtmodel="1PL", theta.k=theta.k, skillspace="normal",
centered.latent=TRUE)
# compute thresholds
thresh1 <- TAM::IRT.threshold(mod1)
print(thresh1)
IRT.WrightMap(thresh1)
#############################################################################
# EXAMPLE 2: Fitted mutidimensional model with gdm
#############################################################################
data( data.fraction2 )
dat <- data.fraction2$data
Qmatrix <- data.fraction2$q.matrix3
# Model 1: 3-dimensional Rasch Model (normal distribution)
theta.k <- seq( -4, 4, len=11 ) # discretized ability
mod1 <- CDM::gdm( dat, irtmodel="1PL", theta.k=theta.k, Qmatrix=Qmatrix,
centered.latent=TRUE, maxiter=10 )
summary(mod1)
# compute thresholds
thresh1 <- TAM::IRT.threshold(mod1)
print(thresh1)
#############################################################################
# EXAMPLE 3: Item-wise thresholds
#############################################################################
data(data.timssAusTwn.scored)
dat <- data.timssAusTwn.scored
dat <- dat[, grep("M03", colnames(dat) ) ]
summary(dat)
# fit partial credit model
mod <- TAM::tam.mml( dat )
# compute thresholds with tam.threshold function
t1mod <- TAM::tam.threshold( mod )
t1mod
# compute thresholds with IRT.threshold function
t2mod <- TAM::IRT.threshold( mod )
t2mod
# compute item-wise thresholds
t3mod <- TAM::IRT.threshold( mod, type="item")
t3mod
}
Run the code above in your browser using DataLab