Skip to content

all the ICCs - #59

Draft
palday wants to merge 5 commits into
mainfrom
pa/all-the-iccs
Draft

all the ICCs#59
palday wants to merge 5 commits into
mainfrom
pa/all-the-iccs

Conversation

@palday

@palday palday commented Aug 29, 2026

Copy link
Copy Markdown
Member

No description provided.

palday and others added 3 commits August 29, 2026 17:37
"ICC" names a family of coefficients that share a form -- a ratio of a
variance component to a total variance -- but answer different questions
and carry different names in different literatures. Implement the widest
set computable from a mixed model or a table of ratings, all behind the
existing `icc` entry point, and document the taxonomy.

Variance partitioning (extends the existing behaviour):

- `conditional=true` includes var(Xβ) in the denominator, giving the
  conditional (unadjusted) ICC alongside the adjusted one.
- `slopes=:mean` averages the random-effects variance over observations
  following Johnson (2014), so the ICC is defined for random-slope
  models rather than silently summing the diagonal of Σ.
- `method=` selects the GLMM observation-level variance: the Nakagawa
  et al. (2017) `:delta`, `:lognormal` and `:trigamma` approximations
  for Poisson, and `:theoretical` vs `:observation_level` for binomial.
- `method=:simulation` partitions variance on the response scale by
  simulating from the fitted model, following Goldstein et al. (2002).
- `groupmean=true` gives the group-mean reliability that the
  organizational literature calls ICC(2) after Bliese (2000).

Inter-rater reliability (new): passing a long-format table of ratings
computes the six Shrout & Fleiss (1979) / McGraw & Wong (1996)
coefficients with their exact F-based intervals, reproducing the
published Shrout & Fleiss Table 2 values and psych::ICC's intervals.
Following Liljequist et al. (2019), the default reports all six together
with the variance components and a rater-bias F test, rather than
requiring a model to be chosen in advance.

BREAKING: two changes to existing results, both deliberate.

- Random-slope ICCs change, because the Johnson (2014) average replaces
  the sum of the random-effect variances (sleepstudy `(1+days|subj)`:
  0.477 -> 0.709). Pass `slopes=:diagonal` to recover the old values.
- Poisson ICCs change, because the observation-level variance was
  hardcoded to 1.0, which is not one of the standard estimators. The
  default is now Nakagawa's `:lognormal`.

Also fixes an ordering bug in the bootstrap group-mean path, where the
guard for a missing `model` ran after the `_group_size` call it was
meant to protect.

Co-Authored-By: Claude Fable 5 <[email protected]>
@codecov

codecov Bot commented Aug 29, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 96.99454% with 11 lines in your changes missing coverage. Please review.
✅ Project coverage is 95.79%. Comparing base (73f17fd) to head (e4708de).

Files with missing lines Patch % Lines
src/interrater.jl 95.51% 7 Missing ⚠️
src/icc.jl 98.09% 4 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main      #59      +/-   ##
==========================================
+ Coverage   94.21%   95.79%   +1.58%     
==========================================
  Files           7        8       +1     
  Lines         190      523     +333     
==========================================
+ Hits          179      501     +322     
- Misses         11       22      +11     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant