View source: R/longitudinal_grmtree.R
| longitudinal_grmfit | R Documentation |
Fits a constrained two-factor longitudinal graded response model (GRM) to
wide-format item response data from two time points. This is an internal
function called by longitudinal_grmtree during model-based
recursive partitioning and is not intended to be used directly.
longitudinal_grmfit(
y,
x = NULL,
start = NULL,
weights = NULL,
offset = NULL,
...,
estfun = FALSE,
object = FALSE
)
y |
A numeric matrix of item responses in wide format. The first
|
x |
Optional predictor matrix. Handled internally by the MOB framework and not used directly in model fitting. |
start |
Optional starting values for model parameters. Passed to
|
weights |
Optional case weights. Not currently used. |
offset |
Optional offset. Not currently used. |
... |
Additional arguments passed to |
estfun |
Logical indicating whether to compute empirical estimating
(score) functions for the MOB parameter instability tests. When
|
object |
Logical indicating whether to return the full
|
This production version builds the equality constraints directly from the known parameter structure rather than fitting an unconstrained model first to discover that structure. Because the function is called hundreds of times during tree construction, avoiding the extra (unconstrained) model fit at every node yields a substantial speed-up with no change in results.
The function specifies a two-factor GRM where the latent factors
\theta_{T1} and \theta_{T2} represent the construct at Time 1
and Time 2, respectively. The model structure is:
\theta_{T1} \sim N(0, 1)
\theta_{T2} \sim N(\mu_{T2},
\sigma^2_{T2})
Cov(\theta_{T1}, \theta_{T2}) = \sigma_{12}
Items 1 through M load on \theta_{T1} and items M+1
through 2M load on \theta_{T2}, where M is the number of
items per time point.
Under the null hypothesis of no response shift, item parameters are
constrained equal across time points. For each item m:
Discrimination: a_{1,m} = a_{2,m+M} (the T1 item's loading
on \theta_{T1} equals the T2 item's loading on \theta_{T2})
Thresholds: b_{k,m} = b_{k,m+M} for all category thresholds
k = 1, \ldots, K_m
The number of threshold constraints per item pair is determined by the minimum number of observed response categories across T1 and T2 for that item (minus 1). This handles cases where sparse response categories at one time point produce fewer estimated thresholds (e.g., category 5 may be empty at T1 but observed at T2).
Constraints are specified using mirt's CONSTRAIN syntax:
Discrimination: (i, a1, j, a2) constrains item i's
a1 parameter to equal item j's a2 parameter
Thresholds: (i, j, dk) constrains the dk threshold
to be equal between items i and j
where i is the T1 item index and j = i + n_items is the
corresponding T2 item index. The baseline factor is fixed at N(0,1) as the
reference while the follow-up mean and variance are freely estimated
(identified by the cross-time item-equality constraints).
The EM algorithm is run with a maximum of 1000 cycles (technical =
list(NCYCLES = 1000)) to accommodate the complexity of the constrained
two-factor model. Verbose output from mirt is suppressed. If the
model fails to converge or encounters an error, the function stops with an
informative error message.
A list containing:
coefficients |
Item parameter estimates from
|
objfun |
Negative log-likelihood of the fitted model. Used by MOB to evaluate splits via partitioned log-likelihood maximization. |
estfun |
Empirical estimating (score) functions if |
object |
The full |
grmtree fits a Graded Response Model Tree,
longitudinal_grmtree for the main tree-fitting function that
calls this internally, mirt for the underlying IRT
estimation engine, rs_characterize for post-hoc response
shift testing within terminal nodes
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.