Writes tidy CSV files suitable for import into spreadsheet software or further analysis in other tools.
Usage
export_mfrm(
fit,
diagnostics = NULL,
output_dir = ".",
prefix = "mfrm",
tables = c("person", "facets", "summary", "steps", "measures"),
overwrite = FALSE
)Arguments
- fit
Output from
fit_mfrm.- diagnostics
Optional output from
diagnose_mfrm. When provided, enriches facet estimates with SE, fit statistics, and writes the full measures table.- output_dir
Directory for CSV files. Created if it does not exist.
- prefix
Filename prefix (default
"mfrm").- tables
Character vector of tables to export. Any subset of
"person","facets","summary","steps","measures". Default exports all available tables.- overwrite
If
FALSE(default), refuse to overwrite existing files.
Exported files
{prefix}_person_estimates.csvPerson ID, Estimate, SD.
{prefix}_facet_estimates.csvFacet, Level, Estimate, and optionally SE, Infit, Outfit, PTMEA when diagnostics supplied.
{prefix}_fit_summary.csvOne-row model summary.
{prefix}_step_parameters.csvStep/threshold parameters.
{prefix}_measures.csvFull measures table (requires diagnostics).
Interpreting output
The returned data.frame tells you exactly which files were written and where. This is convenient for scripted pipelines where the output directory is created on the fly.
Typical workflow
Fit a model with
fit_mfrm().Optionally compute diagnostics with
diagnose_mfrm()when you want enriched facet or measures exports.Call
export_mfrm(...)and inspect the returnedPathcolumn.
Examples
toy <- load_mfrmr_data("example_core")
fit <- fit_mfrm(toy, "Person", c("Rater", "Criterion"), "Score",
method = "JML", model = "RSM", maxit = 25)
diag <- diagnose_mfrm(fit, residual_pca = "none")
out <- export_mfrm(
fit,
diagnostics = diag,
output_dir = tempdir(),
prefix = "mfrmr_example",
overwrite = TRUE
)
out$Table
#> [1] "person" "facets" "summary" "steps" "measures"