
Person x facet-level standardized-residual matrix
Source:R/api-plotting-secondary.R
plot_residual_matrix.RdVisualizes the person x element matrix of standardized residuals
from diagnose_mfrm() as a heatmap. Complements
plot_guttman_scalogram() (which shows raw responses) by exposing
the residual structure directly: large positive cells show
under-prediction, negative cells over-prediction.
Usage
plot_residual_matrix(
fit,
diagnostics = NULL,
facet = "Rater",
top_n_persons = 40L,
preset = c("standard", "publication", "compact", "monochrome"),
draw = TRUE
)Arguments
- fit
An
mfrm_fitfromfit_mfrm().- diagnostics
Optional
diagnose_mfrm()output. Computed on demand when omitted.- facet
Facet whose levels become the column axis (default
"Rater").- top_n_persons
Cap on the number of rows. Defaults to 40 to keep the figure legible; persons are kept by largest absolute residual mean.
- preset
Visual preset.
- draw
If
TRUE, draw with base graphics.
Value
An mfrm_plot_data whose data slot bundles the residual
matrix (rows = Person, columns = facet level) and the long-form
obs table.
Examples
# \donttest{
toy <- load_mfrmr_data("example_core")
fit <- fit_mfrm(toy, "Person", c("Rater", "Criterion"), "Score",
method = "JML", maxit = 30)
#> Warning: Optimization convergence review did not produce an inference-ready numerical solution (code = 1, status = iteration_limit). Optimizer reached the iteration limit before the terminal gradient became small enough for review-only acceptance. Inspect the model specification, data support, and starting values. Do not interpret estimates until the review is resolved.
p <- plot_residual_matrix(fit, top_n_persons = 12, draw = FALSE)
dim(p$data$matrix)
#> [1] 12 4
# Look for: |residual| > 2 or > 3 crosses conventional two- or
# three-standard-deviation review bands; these are heuristic screens,
# not calibrated 5% or 1% tests (Wright & Linacre 1994). Repeated
# high-magnitude cells at one facet level warrant pattern review but
# do not by themselves establish scoring drift.
# }