fitMP: Wrapper for fitting monotonic polynomial (MP) models with...

View source: R/MPfunctions.R

fitMPR Documentation

Wrapper for fitting monotonic polynomial (MP) models with OpenMx.

Description

Wrapper for fitting monotonic polynomial (MP) models with OpenMx.

Usage

fitMP(
  dat,
  k = rep(0, ncol(dat)),
  fit = TRUE,
  itemtype = NULL,
  ncat = NULL,
  priors = FALSE,
  randstart = FALSE,
  startimat = NULL,
  pvar = 500,
  pvartau = NULL,
  pvaralpha = NULL,
  taumean = -10,
  alphamean = 0,
  qpoints = 101,
  qwidth = 5,
  se = FALSE,
  infotype = "oakes1999",
  semMethod = NULL,
  ...
)

Arguments

dat

The data, typically in a format prepared by mxFactor.

k

A vector of integers (greater than or equal to 0) that controls the order of the polynomial for each item. Polynomial order is equal to 2*k+1.

fit

Logical value. If true, actually fit the model. Otherwise, just return everything prepared for OpenMx (useful for inspecting set-up prior to running).

itemtype

Character vector of same length as number of items that may allow different types of item on a single test. These currently support the following monotonic polynomial models from rpf. 1. Logistic function of monotonic polynomial ("lmp"). Dichotomous items, no asymptote. Uses rpf.lmp). 2. Monotonic Polynomial Graded Response Model ("grmp"). Based on graded response model. Uses rpf.grmp) 3. Monotonic Polynomial Generalized Partial Credit Model ("gpcmp"). Based on generalized partial credit model model. Uses rpf.gpcmp) If an option is not specified, it tries to auto-detect dichotomous vs. polytomous items.

ncat

Number of categories per item; if NULL, tries to auto-detect.

priors

Logical value. If true, use prior distributions for alpha and tau parameters.

randstart

Logical value. If true, tries to use random starting values (experimental).

startimat

Accepts an item parameter matrix for custom starting values. Custom starting values are possible, but currently I only support custom starting values based on an item parameter matrix in the format of OpenMx. This is useful if we have already fitted a model and wish to increase/decrease polynomial order for just an item or two. We can use estimates from the initially fitted model for all other items, and any corresponding item parameters. To see an example of what such a matrix looks like, fit a model with this function, then extract item paramter matrix to see its format.

pvar

Single numeric value indicating prior variance for alpha and tau parameters. Uses normal prior. Used only if pvartau or pvaralpha are NULL.

pvartau

Single numeric value indicating prior variance for tau parameters. Uses normal prior.

pvaralpha

Single numeric value indicating prior variance for tau parameters. Uses normal prior.

taumean

Single numeric value indicating prior mean for tau parameters. -10 apparently works well in practice and I believe this is what Falk & Cai (2016, Psychometrika) used.

alphamean

Single numeric value indicating prior mean for alpha parameters. Defaults to 0.

qpoints

Integer indicating number of quadrature points - passed to mxExpectationBA81.

qwidth

Defines limits of quadrature grid. I think "5" here means -5 to 5. See mxExpectationBA81 documentation.

se

Logical value. If TRUE, try to compute standard errors for item parameters.

infotype

String passed as information argument to mxComputeEM to determine how to compute information matrix (for standard errors).

semMethod

If "mr1991" is chosen for infotype, then supplemented EM is used. This argument then takes a string that determines which variant of S-EM is performed. e.g., "mr" = as applied by Cai (2008) to IFA models, "tian" = as specified by Tian, Cai, Thissen, & Xin (2013), "agile" = Joshua Pritikin's method for S-EM.

...

Not used yet, but some arguments may later be passed directly to some OpenMx functions. This is now kind of like a black hole that may help WellsBolt code to work.

Details

Setting up monotonic polynomial models in OpenMx can be a bit of a pain. This wrapper function attempts to make it easier. In a single line, it will set up and estimate a single group, unidimensional item response model with three choices for item models. Note that the models for each item are extensions of the two-parameter logistic, generalized partial credit, and graded response models. Setting k equal to 0 will essentially be equivalent to these simpler models, provided that all items are keyed the same direction (the GRMP can relax this assumption).

Inspiration for starting values is generally borrowed from the MonoPoly package and Elphinstone parameterization. The estimation procedure is generally that used by Falk & Cai (2016) and Falk (2020) in that normal priors for alpha and tau parameters typically help to stabilize estimation. Many estimation options are otherwise still hard-coded, but are those that we have found to be useful in past research. Note finally that estimating models with k greater than zero is not recommended until a simpler model is fit, as immediately fitting high order polynomial models without good starting values may lead to estimation difficulty.

Attempts at further generalization of this code are welcome.

Value

Returns an object of class MxModel-class. Convenience functions for extracting more from this object are available.

References

Falk, C. F., & Cai, L. (2016). Maximum marginal likelihood estimation of a monotonic polynomial generalized partial credit model with applications to multiple group analysis. Psychometrika, 81, 434-460. http://dx.doi.org/10.1007/s11336-014-9428-7

Falk, C. F. (2020). The monotonic polynomial graded response model: Implementation and a comparative study. Applied Psychological Measurement, 44, 465-481. https://doi.org/10.1177/0146621620909897

See Also

Anything else?

Examples



# For now, just load something from mirt
#library(mirt)
data(Science)

dat <- mxFactor(Science,levels=1:4)

grmfit <- fitMP(dat, k=rep(0,4), itemtype=rep("grmp",4))

k1fit <- fitMP(dat, k=rep(1,4), itemtype=rep("grmp",4),
               startimat = grmfit$itemModel@matrices$item)

getIC(grmfit, "aic")
getIC(k1fit, "aic")




falkcarl/mpirt documentation built on July 11, 2024, 12:09 a.m.