
Import an external IRT fit (mirt, TAM, or eRm) to an mfrmr-compatible bundle
Source: R/api-import.R
import_irt_fit.RdExtracts item, step, and person parameters from a supported unidimensional
mirt::mirt(), TAM::tam.mml(), TAM::tam.mml.mfr(), eRm::RM(),
eRm::PCM(), or eRm::RSM() fit and returns an mfrm_imported_fit object
with the public slots summary, facets$person, facets$others, steps,
config, and source expected by measurement-side summary() and plot()
helpers.
Arguments
- fit
A fitted object from
mirt::mirt()(SingleGroupClass),TAM::tam.mml()/TAM::tam.mml.mfr(), oreRm::RM()/eRm::PCM()/eRm::RSM().- model
Declared response model: one of
"RSM","PCM", or"GPCM". The importer does not reconstruct all source constraints; pass the model that was estimated. Non-unitmirtorTAMslopes require"GPCM". A polytomous"RSM"import frommirtrequires source item type"rsm". ForeRm, pass"PCM"or"RSM"matchingfit$model(either is accepted for binaryRM;"GPCM"and linear extensions are unsupported).- item_facet
Name to assign to the item facet in the imported bundle (default
"Item"). Ignored when importing a multi-facettam.mml.mfrfit, whose combined response conditions are labelled"DesignCell".- compute_fit
Logical. When
TRUEformirtorTAMimports, compute source Infit / Outfit statistics (mirt::itemfit()+mirt::personfit(), orTAM::msq.itemfit()+TAM::tam.personfit()) and attach a measurement-sidemfrm_diagnosticsbundle. DefaultFALSE. Not supported foreRmimports.- source
Source package adapter:
"auto"(default, detected from the class offit),"mirt","tam", or"erm".- object, x
An imported measurement bundle.
- digits
Number of digits for displayed estimates.
- ...
Additional arguments (unused by imported summaries).
Value
An mfrm_imported_fit object. Slots:
summaryModel / method / source / N / LogLik / AIC / BIC (with explicit
Native*provenance andICEligible = FALSEonTAMimports).facets$personPerson ID, Estimate, SE, Extreme, plus available fit columns when
compute_fit = TRUE.facets$othersItem or design-cell estimates (and slopes for
mirt/TAM, transformed SEs where available), plus fit statistics whencompute_fit = TRUE.stepsAbsolute adjacent-category thresholds on the source ability scale, labelled in
Parameterization; these are not centered step deviations.configList with declared
model,method,facet_names, andsourcemetadata.diagnosticsmfrm_diagnostics-shape bundle whencompute_fit = TRUE;NULLotherwise.sourceSource package version, scale convention, person scoring basis, and native parameter tables where applicable.
Source scale
Item difficulty is the mean of its absolute adjacent-category thresholds, and source scale identification and slopes are retained without rescaling:
mirt: UnidimensionalRasch,2PL,gpcm,gpcmIRT, andrsmitems with positive slopes and ordinary0..(K-1)category scores are supported; graded-response, guessing, custom-scoring, and multidimensional models are refused. ForgpcmIRTandrsm, the category offset is included asb - c / a. Person estimates are EAP with conditional posterior SDs inSE.TAM: Unidimensional MML fits (tam.mml,tam.mml.mfr) with positive constant adjacent-category slopes are supported;tam.jmland multidimensional (ndim > 1) fits are refused. Multi-facettam.mml.mfrfits combine facet effects per design cell and retain the original coefficient table insource$native_parameters. Transformed item SEs are retained only when the location is a scalar multiple of a single fixed-slope source coefficient; otherwiseSEisNA. Person estimates retain source EAP and conditional posterior SD, whileTAM::tam.personfit()uses WLE scores (recorded inFitBasis). TAM-native AIC, BIC, andaBICare kept underNative*fields withICStatus = "imported_native_descriptive"andICEligible = FALSE.eRm: Conditional ML cumulative easiness coefficients fromRM,PCM, orRSMare negated and differenced into absolute adjacent-category difficulties, with scalar-transformed item-location SEs and ML person parameters (retainingsource_extrapolatedflags for extremes).
Imported uncertainty
Imported SEs retain the source package's interpretation. The measurement-side
diagnostics do not reconstruct the joint parameter covariance, so joint facet
chi-square statistics, degrees of freedom and p-values are unavailable.
Posterior SDs do not supply sampling SEs for separation reliability.
Other separation summaries require valid SEs for every finite estimate and
remain descriptive. Imported Wright maps show points only: source uncertainty
conventions do not establish one common confidence-interval calculation.
Re-import older saved bundles from the existing source-package fit to update
difficulties, thresholds and uncertainty labels. The mirt and TAM paths
accept compute_fit = TRUE when source fit statistics are needed; no model
re-estimation is required.
Scope
Use summary() for source-scale tables and plot() for a point-only Wright
map. Available source fit statistics remain in the facet and diagnostic
tables. Native model curves, comprehensive mfrm_results() reports,
response-level diagnostics, run_qc_pipeline(), bias/DIF analysis, anchoring
and portable calibration are unavailable for imported bundles. This is a
one-way fitted-object import of the documented fields.
Examples
# Optional integration example (loads additional modelling packages).
# example("import_irt_fit", run.dontrun = TRUE)
if (FALSE) { # \dontrun{
if (requireNamespace("TAM", quietly = TRUE)) {
response_matrix <- matrix(sample(0:2, 60, replace = TRUE), nrow = 20)
colnames(response_matrix) <- paste0("Item", seq_len(ncol(response_matrix)))
fit_tam <- TAM::tam.mml(resp = response_matrix, irtmodel = "PCM", verbose = FALSE)
imported <- import_irt_fit(fit_tam, model = "PCM")
summary(imported)
}
} # }