Build a category structure report (preferred alias)
Source:R/api-reports.R
category_structure_report.RdBuild a category structure report (preferred alias)
Usage
category_structure_report(
fit,
diagnostics = NULL,
theta_range = c(-6, 6),
theta_points = 241,
drop_unused = FALSE,
include_fixed = FALSE,
fixed_max_rows = 200
)Arguments
- fit
Output from
fit_mfrm().- diagnostics
Optional output from
diagnose_mfrm().- theta_range
Theta/logit range used to derive transition points.
- theta_points
Number of grid points used for transition-point search.
- drop_unused
If
TRUE, remove zero-count categories from outputs.- include_fixed
If
TRUE, include a legacy-compatible fixed-width text block.- fixed_max_rows
Maximum rows per fixed-width section.
Details
Preferred high-level API for category-structure diagnostics. This wraps the legacy-compatible bar/transition export and returns a stable bundle interface for reporting and plotting.
Interpreting output
Key components include:
category usage/fit table (count, expected, infit/outfit, ZSTD)
threshold ordering and adjacent threshold gaps
category transition-point table on the requested theta grid
Practical read order:
summary(out)for compact warnings and threshold ordering.out$category_tablefor sparse/misfitting categories.out$median_thresholdsfor adjacent-threshold caveats when zero-count categories are retained.plot(out)for quick visual check.
Typical workflow
fit_mfrm()-> model.diagnose_mfrm()-> residual/fit diagnostics (optional argument here).category_structure_report()-> category health snapshot.summary()andplot()for draft-oriented review of category structure.
Examples
if (FALSE) { # interactive()
toy <- load_mfrmr_data("example_core")
fit <- fit_mfrm(toy, "Person", c("Rater", "Criterion"), "Score", method = "JML", maxit = 30)
out <- category_structure_report(fit)
summary(out)
head(out$category_table[, c("Category", "Count", "Infit", "Outfit")])
p_cs <- plot(out, draw = FALSE)
p_cs$data$plot
}