View source: R/generate.mirt_object.R
generate.mirt_object | R Documentation |
This function generates a mirt
object from known population parameters, which is
then passed to mirtCAT
for running CAT applications.
generate.mirt_object(
parameters,
itemtype,
latent_means = NULL,
latent_covariance = NULL,
key = NULL,
min_category = rep(0L, length(itemtype))
)
parameters |
a matrix or data.frame of parameters corresponding to the model definitions
listed in |
itemtype |
a character vector indicating the type of item with which the parameters
refer. See the |
latent_means |
(optional) a numeric vector used to define the population latent mean structure. By default the mean structure is centered at a 0 vector |
latent_covariance |
(optional) a matrix used to define the population variance-covariance structure between the latent traits. By default the relationship is assumed to be orthogonal standard normal (i.e., an identity matrix) |
key |
scoring key required for nested-logit models. See |
min_category |
the value representing the lowest category index. By default this is 0,
therefore the response suitable for the first category is 0, second is 1, and so on up to
|
Phil Chalmers rphilip.chalmers@gmail.com
Chalmers, R., P. (2012). mirt: A Multidimensional Item Response Theory Package for the R Environment. Journal of Statistical Software, 48(6), 1-29. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.18637/jss.v048.i06")}
Chalmers, R. P. (2016). Generating Adaptive and Non-Adaptive Test Interfaces for Multidimensional Item Response Theory Applications. Journal of Statistical Software, 71(5), 1-39. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.18637/jss.v071.i05")}
mirt
, mirtCAT
, generate_pattern
## Not run:
### build a unidimensional test with all 3PL items
nitems <- 50
a1 <- rlnorm(nitems, .2,.2)
d <- rnorm(nitems)
g <- rbeta(nitems, 20, 80)
pars <- data.frame(a1=a1, d=d, g=g)
head(pars)
obj <- generate.mirt_object(pars, '3PL')
coef(obj, simplify = TRUE)
plot(obj, type = 'trace')
### build a two-dimensional test
## all graded items with 5 response categories
nitems <- 30
as <- matrix(rlnorm(nitems*2, .2, .2), nitems)
diffs <- t(apply(matrix(runif(nitems*4, .3, 1), nitems), 1, cumsum))
diffs <- -(diffs - rowMeans(diffs))
ds <- diffs + rnorm(nitems)
pars2 <- data.frame(as, ds)
colnames(pars2) <- c('a1', 'a2', paste0('d', 1:4))
head(pars2)
obj <- generate.mirt_object(pars2, 'graded')
coef(obj, simplify = TRUE)
### unidimensional mixed-item test
library(plyr)
pars3 <- rbind.fill(pars, pars2) #notice the NA's where parameters do not exist
obj <- generate.mirt_object(pars3, itemtype = c(rep('2PL', 50), rep('graded', 30)))
coef(obj)
itemplot(obj, 51)
itemplot(obj, 1, drop.zeros=TRUE)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.