# NOT RUN {
## example 1.
## using the function "shape_df" to create a data frame of test metadata
# create a list containing the dichotomous item parameters
par.dc <- list(a=c(1.1, 1.2, 0.9, 1.8, 1.4),
b=c(0.1, -1.6, -0.2, 1.0, 1.2),
g=rep(0.2, 5))
# create a list containing the polytomous item parameters
par.py <- list(a=c(1.4, 0.6),
d=list(c(0.0, -1.9, 1.2), c(0.4, -1.1, 1.5, 0.2)))
# create a numeric vector of score categories for the items
cats <- c(2, 4, 2, 2, 5, 2, 2)
# create a character vector of IRT models for the items
model <- c("DRM", "GRM", "DRM", "DRM", "GPCM", "DRM", "DRM")
# create an item metadata set
test <- shape_df(par.dc=par.dc, par.py=par.py, cats=cats, model=model) # create a data frame
# set theta values
theta <- seq(-2, 2, 0.1)
# compute item and test information values given the theta values
test.info(x=test, theta=theta, D=1)
## example 2.
## using a "-prm.txt" file obtained from a flexMIRT
# import the "-prm.txt" output file from flexMIRT
flex_prm <- system.file("extdata", "flexmirt_sample-prm.txt", package = "irtplay")
# read item parameters and transform them to item metadata
test_flex <- bring.flexmirt(file=flex_prm, "par")$Group1$full_df
# set theta values
theta <- seq(-2, 2, 0.1)
# compute item and test information values given the theta values
test.info(x=test_flex, theta=theta, D=1)
# }
Run the code above in your browser using DataLab