fitMP | R Documentation |
Wrapper for fitting monotonic polynomial (MP) models with OpenMx.
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,
...
)
dat |
The data, typically in a format prepared by |
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 |
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 |
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 |
qwidth |
Defines limits of quadrature grid. I think "5" here means -5 to 5. See |
se |
Logical value. If TRUE, try to compute standard errors for item parameters. |
infotype |
String passed as |
semMethod |
If "mr1991" is chosen for |
... |
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 |
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.
Returns an object of class MxModel-class
. Convenience functions for extracting more from this object are available.
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
Anything else?
# 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")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.