Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

createGroup

Create a user defined group-level object with correct generic functions


Description

Initializes the proper S4 class and methods necessary for mirt functions to use in estimation for defining customized group-level functions. To use the defined objects pass to the mirt(..., customGroup = OBJECT) command, and ensure that the class parameters are properly labeled.

Usage

createGroup(
  par,
  est,
  den,
  nfact,
  standardize = FALSE,
  gr = NULL,
  hss = NULL,
  gen = NULL,
  lbound = NULL,
  ubound = NULL,
  derivType = "Richardson"
)

Arguments

par

a named vector of the starting values for the parameters

est

a logical vector indicating which parameters should be freely estimated by default

den

the probability density function given the Theta/ability values. First input contains a vector of all the defined parameters and the second input must be a matrix called Theta. Function also must return a numeric vector object corresponding to the associated densities for each row in the Theta input

nfact

number of factors required for the model. E.g., for unidimensional models with only one dimension of integration nfact = 1

standardize

logical; use standardization of the quadrature table method proposed by Woods and Thissen (2006)? If TRUE, the logical elements named 'MEAN_1' and 'COV_11' can be included in the parameter vector, and when these values are set to FALSE in the est input the E-table will be standardized to these fixed values (e.g., par <- c(a1=1, d=0, MEAN_1=0, COV_11=1) with est <- c(TRUE, TRUE, FALSE, FALSE) will standardize the E-table to have a 0 mean and unit variance)

gr

gradient function (vector of first derivatives) of the log-likelihood used in estimation. The function must be of the form gr(x, Theta), where x is the object defined by createGroup() and Theta is a matrix of latent trait parameters

hss

Hessian function (matrix of second derivatives) of the log-likelihood used in estimation. If not specified a numeric approximation will be used. The input is identical to the gr argument

gen

a function used when GenRandomPars = TRUE is passed to the estimation function to generate random starting values. Function must be of the form function(object) ... and must return a vector with properties equivalent to the par object. If NULL, parameters will remain at the defined starting values by default

lbound

optional vector indicating the lower bounds of the parameters. If not specified then the bounds will be set to -Inf

ubound

optional vector indicating the lower bounds of the parameters. If not specified then the bounds will be set to Inf

derivType

if the gr or hss terms are not specified this type will be used to obtain them numerically. Default is 'Richardson'

Author(s)

References

Chalmers, R., P. (2012). mirt: A Multidimensional Item Response Theory Package for the R Environment. Journal of Statistical Software, 48(6), 1-29. doi: 10.18637/jss.v048.i06

Examples

# normal density example, N(mu, sigma^2)
den <- function(obj, Theta) dnorm(Theta, obj@par[1], sqrt(obj@par[2]))
par <- c(mu = 0, sigma2 = .5)
est <- c(FALSE, TRUE)
lbound <- c(-Inf, 0)
grp <- createGroup(par, est, den, nfact = 1, lbound=lbound)

dat <- expand.table(LSAT6)
mod <- mirt(dat, 1, 'Rasch')
modcustom <- mirt(dat, 1, 'Rasch', customGroup=grp)

coef(mod)
coef(modcustom)

mirt

Multidimensional Item Response Theory

v1.33.2
GPL (>= 3)
Authors
Phil Chalmers [aut, cre] (<https://orcid.org/0000-0001-5332-2810>), Joshua Pritikin [ctb], Alexander Robitzsch [ctb], Mateusz Zoltak [ctb], KwonHyun Kim [ctb], Carl F. Falk [ctb], Adam Meade [ctb], Lennart Schneider [ctb], David King [ctb], Chen-Wei Liu [ctb], Ogreden Oguzhan [ctb]
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.