Add intraclass correlation coefficient (ICC) to generalizability metrics#35
Merged
nicchiou merged 1 commit intoMay 29, 2026
Merged
Conversation
This was referenced May 28, 2026
3 tasks
88ce9a9 to
4a0740b
Compare
nicchiou
approved these changes
May 29, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds
intraclass_correlation()tosrc/torch_measure/metrics/generalizability.py. ICC is a ratio of the variance components already estimated byvariance_components(subjects = targets, items = raters), so it slots in next tog_coefficientand reuses the same dict.Supported forms (McGraw & Wong 1996 / Shrout & Fleiss 1979 two-way):
ICC2— two-way random, single rater, absolute agreementICC3— two-way mixed, single rater, consistencyICC2k— average of k raters, absolute agreementICC3k— average of k raters, consistencyThe averaged forms are mathematically identical to the existing G-coefficient at
n_reps=1(ICC2k == g_coefficient(type="absolute"),ICC3k == g_coefficient(type="relative")) which is used as the primary correctness test. One-way forms (ICC1/ICC1k) require a different (one-way) decomposition and raise a clearValueErrorrather than returning a wrong number.Test plan
pytest tests/test_metrics/test_generalizability.py— 33 tests pass (10 new inTestIntraclassCorrelation: unit-interval, G-coefficient equivalence, consistency ≥ absolute, average ≥ single, n_items defaulting, ICC1/unknown-form/missing-keys errors, zero-components, real-components)pytest tests/test_metrics/— 74 pass, no regressionsruff check/ruff format --check— cleanNote for reviewers
This stacks on #27 (G-theory base). Once #27 lands I'll rebase onto
mainand the diff will collapse to just the ICC commit, then flip this out of draft.First of several planned G-theory follow-ups (bootstrap CIs, REML backend, assumption checks, a walk-through tutorial).