
Summarize model agreement across analysis levels
Source:R/model_agreement.R
model_agreement_sensitivity.RdBuilds a slide-ready sensitivity table by running model_agreement() across
several substantively useful unit definitions (for example book-level,
chapter-level, and party-specific agreement). Lower-level rows are
aggregated with an NA-safe mean before each agreement calculation, so skipped
chapters do not turn an entire book mean into NA.
Arguments
- data
A data frame with one row per model-by-unit combination.
- outcome
Character string naming the score column (default
"mean_outcome").- model_col
Character string naming the model column (default
"model").- analyses
Optional named list defining analyses to run. Each element should be a list with
unit_byand, optionally,group_by. IfNULL, a default set is inferred from available book, chapter, and party/group columns.- metrics
Character vector of metrics to compute. One or both of
"icc"and"kendall_w"(default both).- format
Character.
"wide"returns one row per analysis/subgroup with ICC and Kendall's W side by side;"long"returns the stackedmodel_agreement()results with analysis labels.- digits
Integer. Number of decimal places used in the formatted wide table.
- drop_missing
Logical. Whether to drop rows with missing model, unit, or grouping identifiers before computing each analysis (default
TRUE).