Analyze the hierarchical structure of a rating design
Source:R/api-hierarchical-audit.R
analyze_hierarchical_structure.RdOne-stop review that combines the nesting, cross-tabulation, ICC, and
design-effect reports into a single object. Designed to be reused by
the publication-workflow surface: its summary feeds into
reporting_checklist(), and its tables are picked up by
build_mfrm_manifest() for reproducibility bundles.
Usage
analyze_hierarchical_structure(
data,
facets = NULL,
person = "Person",
score = "Score",
compute_icc = TRUE,
ci_method = c("none", "profile", "boot"),
ci_level = 0.95,
ci_boot_reps = 1000L,
ci_boot_seed = NULL,
igraph_layout = TRUE,
icc_ci_method = NULL,
icc_ci_level = NULL,
icc_ci_boot_reps = NULL,
icc_ci_boot_seed = NULL
)Arguments
- data
Data frame in long format, or an
mfrm_fit(itsprep$datais used).- facets
Character vector of facet column names. When
datais anmfrm_fit, defaults tofit$prep$facet_names.- person
Person column name. Defaults to
"Person".- score
Score column name. Defaults to
"Score".- compute_icc
Logical; if
TRUEandlme4is available, adds ICC and design-effect tables.- ci_method
ICC confidence-interval method passed through to
compute_facet_icc(). One of"none"(default, point estimate only),"profile", or"boot". Deprecated alias:icc_ci_method(kept for backward compatibility, emits a lifecycle warning).- ci_level
Confidence level when
ci_method != "none"; default0.95. Deprecated alias:icc_ci_level.- ci_boot_reps
Number of bootstrap replicates when
ci_method = "boot". Default1000. Deprecated alias:icc_ci_boot_reps.- ci_boot_seed
Optional RNG seed for reproducible bootstrap CIs. Deprecated alias:
icc_ci_boot_seed.- igraph_layout
Logical; if
TRUEandigraphis available, adds a connectivity component summary using a bipartite graph over person x facet levels.- icc_ci_method, icc_ci_level, icc_ci_boot_reps, icc_ci_boot_seed
Deprecated spellings of the
ci_*arguments above, retained for one release. Supplying a non-NULLvalue routes throughlifecycle::deprecate_warn()and overrides the canonicalci_*argument.
Value
A list of class mfrm_hierarchical_structure with:
nesting: output ofdetect_facet_nesting().crosstabs: list of pairwise observation-count data.frames (long format, suitable for heatmap plotting).icc: output ofcompute_facet_icc()when requested.design_effect: output ofcompute_facet_design_effect()when requested.connectivity: named list with bipartite-graph component summary whenigraphis available.summary: one-row summary used by downstream reporting helpers.facets: character vector of facet names that were reviewed (echoed for downstream reporting helpers that need to label rows by review scope).
Interpreting output
nesting: adetect_facet_nesting()object with every facet pair classified as Crossed / Partially / Near-perfectly / Fully nested.crosstabs: list of(LevelA, LevelB, N)long-format tables, one per facet pair. Plot viaplot(x, type = "crosstab", pair = "FacetA__FacetB").icc: per-facet variance shares. Seecompute_facet_icc()for the two-scale interpretation.design_effect: Kish (1965)DeffandEffectiveN.connectivity: number of bipartite components linking Person x facet levels. A single component is required for a common measurement scale; multiple components indicate a disconnected design.
Typical workflow
Optional: fit the MFRM with
fit_mfrm().Call
analyze_hierarchical_structure(fit)(or on the raw data).Read
summary(x)for the condensed view.Feed the object to
reporting_checklist()andbuild_mfrm_manifest()to record the review in publication bundles.build_apa_outputs()uses the fit-levelFacetSampleSizeFlagto add a Methods sentence automatically.
References
McEwen, M. R. (2018). The effects of incomplete rating designs on results from many-facets-Rasch model analyses (Doctoral thesis, Brigham Young University). https://scholarsarchive.byu.edu/etd/6689/
Linacre, J. M. (2026). A User's Guide to FACETS, Version 4.5.0. Winsteps.com. https://www.winsteps.com/facets.htm
Kish, L. (1965). Survey Sampling. New York: Wiley.
Koo, T. K., & Li, M. Y. (2016). A guideline of selecting and reporting intraclass correlation coefficients for reliability research. Journal of Chiropractic Medicine, 15(2), 155-163.
Examples
toy <- load_mfrmr_data("example_core")
hs <- analyze_hierarchical_structure(toy,
facets = c("Rater", "Criterion"),
compute_icc = FALSE,
igraph_layout = FALSE)
summary(hs)
#> mfrm_hierarchical_structure
#>
#> Summary:
#> NFacets NestedPairs CrossedPairs ICCAvailable ConnectivityComponents
#> 2 0 3 FALSE NA
#>
#> Nesting review:
#> FacetA FacetB NestingIndex_AinB NestingIndex_BinA Direction
#> Person Rater 0 0 crossed
#> Person Criterion 0 0 crossed
#> Rater Criterion 0 0 crossed
if (FALSE) { # \dontrun{
# Full review when lme4 and igraph are available.
if (requireNamespace("lme4", quietly = TRUE) &&
requireNamespace("igraph", quietly = TRUE)) {
hs_full <- analyze_hierarchical_structure(toy,
facets = c("Rater", "Criterion"))
summary(hs_full)
plot(hs_full, type = "icc")
}
} # }