Extracts item, step, and person parameters from a mirt::mirt()
fit and returns an mfrm_imported_fit object. The returned
object has the public slots summary, facets$person,
facets$others, steps, config, and source that the mfrmr
plot and table helpers expect. With compute_fit = TRUE the
importer also runs mirt::itemfit() and mirt::personfit() so
Infit / Outfit columns are populated, and synthesises a
mfrm_diagnostics-shape diagnostics slot consumable by
downstream plot helpers (Wright map, QC dashboard, etc.).
Usage
import_mirt_fit(
fit,
model = c("RSM", "PCM", "GPCM"),
item_facet = "Item",
compute_fit = FALSE
)Arguments
- fit
An object returned by
mirt::mirt()(aSingleGroupClass).- model
One of
"RSM","PCM","GPCM". The importer does not infer the model from the mirt object; pass the model that was estimated.- item_facet
Name to assign to the item facet in the imported bundle (default
"Item").- compute_fit
Logical. When
TRUE, runmirt::itemfit()andmirt::personfit()to populate Infit / Outfit / OutfitZSTD columns on the returned facet tables, plus build a measurement-sidemfrm_diagnosticsbundle consumable bysummary(),plot.mfrm_fit(),plot_qc_dashboard(), etc. DefaultFALSEkeeps the importer fast (skeleton only).
Value
An mfrm_imported_fit object. Slots:
summaryModel / method / N / LogLik / AIC / BIC.
facets$personPerson ID, Estimate, SE, Extreme, plus Infit / Outfit / OutfitZSTD / Zh when
compute_fit = TRUE.facets$othersItem-level estimates and slopes; with
compute_fit = TRUE, also Infit / Outfit / S_X2 / RMSEA / df frommirt::itemfit().stepsPer-item threshold parameters extracted from the IRT parameterisation (
b1, ...,b(K-1)).configList with the resolved
modelanditem_facetused for the import; downstream plot and table helpers consult this to dispatch correctly on the imported bundle.diagnosticsmfrm_diagnostics-shape bundle whencompute_fit = TRUE;NULLotherwise.sourceImported-from metadata.
Scope
Bundles bias / DIF / anchor / replay slots are explicitly not populated; full bidirectional import / export is planned for a future release.
Examples
if (FALSE) { # \dontrun{
if (requireNamespace("mirt", quietly = TRUE)) {
response_matrix <- matrix(sample(0:3, 60, replace = TRUE), nrow = 20)
colnames(response_matrix) <- paste0("Item", seq_len(ncol(response_matrix)))
fit <- mirt::mirt(response_matrix, 1, itemtype = "gpcm", verbose = FALSE)
imported <- import_mirt_fit(fit, model = "GPCM")
imported$summary
}
} # }