Skip to contents

Build a legacy-compatible output-file bundle (GRAPH= / SCORE=)

Usage

facets_output_file_bundle(
  fit,
  diagnostics = NULL,
  include = c("graph", "score"),
  theta_range = c(-6, 6),
  theta_points = 241,
  digits = 4,
  include_fixed = FALSE,
  fixed_max_rows = 400,
  write_files = FALSE,
  output_dir = NULL,
  file_prefix = "mfrmr_output",
  overwrite = FALSE
)

Arguments

fit

Output from fit_mfrm().

diagnostics

Optional output from diagnose_mfrm() (used for score file).

include

Output components to include: "graph" and/or "score".

theta_range

Theta/logit range for graph coordinates.

theta_points

Number of points on the theta grid for graph coordinates.

digits

Rounding digits for numeric fields.

include_fixed

If TRUE, include fixed-width text mirrors of output tables.

fixed_max_rows

Maximum rows shown in fixed-width text blocks.

write_files

If TRUE, write selected outputs to files in output_dir.

output_dir

Output directory used when write_files = TRUE.

file_prefix

Prefix used for output file names.

overwrite

If FALSE, existing output files are not overwritten.

Value

A named list including:

  • graphfile / graphfile_syntactic when "graph" is requested

  • scorefile when "score" is requested

  • graphfile_fixed / scorefile_fixed when include_fixed = TRUE

  • written_files when write_files = TRUE

  • settings: applied options

Details

Legacy-compatible output files often include:

  • graph coordinates for Table 8 curves (GRAPH= / Graphfile=), and

  • observation-level modeled score lines (SCORE=-style inspection).

This helper returns both as data frames and can optionally write CSV/fixed-width text files to disk.

summary(out) is supported through summary(). plot(out) is dispatched through plot() for class mfrm_output_bundle (type = "graph_expected", "score_residuals", "obs_probability").

Interpreting output

  • graphfile: legacy-compatible wide curve coordinates (human-readable labels).

  • graphfile_syntactic: same curves with syntactic column names for programmatic use.

  • scorefile: observation-level observed/expected/residual diagnostics.

  • written_files: audit trail of files produced when write_files = TRUE.

For reproducible pipelines, prefer graphfile_syntactic and keep written_files in run logs.

Preferred route for new analyses

For new scripts, prefer category_curves_report() or category_structure_report() for scale outputs, then use export_mfrm_bundle() for file handoff. Use facets_output_file_bundle() only when a legacy-compatible graphfile or scorefile contract is required.

Typical workflow

  1. Fit and diagnose model.

  2. Generate bundle with include = c("graph", "score").

  3. Validate with summary(out) / plot(out).

  4. Export with write_files = TRUE for reporting handoff.

Examples

toy <- load_mfrmr_data("example_core")
fit <- fit_mfrm(toy, "Person", c("Rater", "Criterion"), "Score", method = "JML", maxit = 25)
out <- facets_output_file_bundle(fit, diagnostics = diagnose_mfrm(fit, residual_pca = "none"))
summary(out)
#> mfrmr Output File Bundle Summary 
#>   Class: mfrm_output_bundle
#>   Components (4): graphfile, graphfile_syntactic, scorefile, settings
#> 
#> Output overview
#>  GraphRows ScoreRows WrittenFiles IncludeFixed WriteFiles
#>        241       768            0        FALSE      FALSE
#> 
#> Output preview rows: scorefile
#>  Person Rater Criterion Observed Expected Residual StdResidual   Var Weight
#>    P001   R01   Content        3    3.282   -0.282      -0.403 0.490      1
#>    P002   R01   Content        3    3.663   -0.663      -1.250 0.281      1
#>    P003   R01   Content        4    3.528    0.472       0.779 0.367      1
#>    P004   R01   Content        3    3.384   -0.384      -0.576 0.444      1
#>    P005   R01   Content        2    3.384   -1.384      -2.077 0.444      1
#>    P006   R01   Content        3    1.929    1.071       1.399 0.586      1
#>    P007   R01   Content        3    3.384   -0.384      -0.576 0.444      1
#>    P008   R01   Content        3    1.846    1.154       1.544 0.559      1
#>    P009   R01   Content        3    2.310    0.690       0.852 0.655      1
#>    P010   R01   Content        2    3.282   -1.282      -1.832 0.490      1
#>  score_k PersonMeasure ObsProb
#>        2         0.685   0.456
#>        2         1.676   0.281
#>        3         1.259   0.585
#>        2         0.902   0.425
#>        1         0.902   0.088
#>        2        -1.523   0.200
#>        2         0.902   0.425
#>        2        -1.669   0.170
#>        2        -0.916   0.342
#>        1         0.685   0.118
#> 
#> Settings
#>         Setting        Value
#>         include graph, score
#>     theta_range        -6, 6
#>    theta_points          241
#>          digits            4
#>   include_fixed        FALSE
#>  fixed_max_rows          400
#>     write_files        FALSE
#>      output_dir         NULL
#>     file_prefix mfrmr_output
#>       overwrite        FALSE
#> 
#> Notes
#>  - Graphfile/SCORE-style export bundle (table output and optional file-write metadata).
p_out <- plot(out, draw = FALSE)
class(p_out)
#> [1] "mfrm_plot_data" "list"