Add bootstrap CIs for variance components#36
Merged
Conversation
This was referenced May 28, 2026
d530ff7 to
ebd2061
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.
Follow-up to #26. Builds on #27 (G-theory module) and #35 (ICC).
Summary
Adds
bootstrap_variance_components()tosrc/torch_measure/metrics/generalizability.py: a nonparametric bootstrap that resamples subjects with replacement, re-fits the moments estimator on each draw, and returns percentile CIs for each variance component plus the full bootstrap distribution.Subjects are the exchangeable unit; duplicates from sampling-with-replacement are relabelled so each draw is treated as a distinct unit. Degenerate draws (singular cell structure) are skipped via try/except.
The returned
samplesdict lets callers compose CIs for any function of the components without re-running the bootstrap — includingg_coefficientandintraclass_correlation.Test plan
TestBootstrapVarianceComponents: output structure, point-estimate pass-through, reproducibility under seed, different seeds differ, CI brackets the point estimate on a well-separated design, wider CI at higher confidence level, input validation, and end-to-end G-coefficient CI via samplesStacking
This branch stacks on top of #35 (which stacks on #27). After #27 and #35 merge, I'll rebase onto main and mark this ready.