Repository navigation
Add generalizability theory G/D studies (crossed p x i, p x i x o) - #229
Conversation
There was a problem hiding this comment.
Pull request overview
This PR adds Generalizability Theory (G/D-study) support for fully crossed, balanced designs to fast-mlsirm, implementing the random-effects ANOVA variance components and D-study coefficients in Rust with PyO3 + Python wrappers and paper/fixture-backed tests.
Changes:
- Implement
mlsirm_core::gtheoryfor crossedp x iandp x i x odesigns, including clamped-ANOVA D-study outputs and NaN coefficient rules. - Expose
gtheory_pi/gtheory_piothrough the PyO3 core module and add thin Python API wrappers + exports. - Add Rust unit tests reproducing Huebner & Lucht (2019) tables and Python paper-feature tests validating the public API.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
crates/mlsirm-core/src/lib.rs |
Exposes the new gtheory module from the Rust core crate. |
crates/mlsirm-core/src/gtheory.rs |
Implements G-study ANOVA + D-study computations for p x i and p x i x o crossed designs. |
crates/fast-mlsirm-py/src/lib.rs |
Adds PyO3 bindings for gtheory_pi / gtheory_pio and marshals results into Python dicts/lists. |
python/fast_mlsirm/gtheory.py |
Adds Python-facing validation/marshaling wrappers returning dataclass-based results. |
python/fast_mlsirm/__init__.py |
Re-exports the new GTheory functions/types from the package top-level. |
tests/unit/gtheory_tests.rs |
Adds Rust fixtures reproducing paper tables + independent fixtures + regression for large-offset cancellation. |
tests/test_paper_features.py |
Adds Python-level paper-table checks and input-rejection coverage for the new API. |
CHANGELOG.md |
Documents the new generalizability-theory feature and its policies (clamp + NaN rules). |
Comments suppressed due to low confidence (1)
crates/mlsirm-core/src/gtheory.rs:271
n_p * n_i * n_oand the derived intermediate products used for validation/allocations can overflowusizeif a caller passes very large facet sizes (even before any meaningful computation). Usechecked_mul_usize(already in this crate) to compute the expected buffer length and the interaction-buffer sizes so overflow is reported as a clean error instead of producing incorrect length checks or panics.
validate(x, n_p * n_i * n_o, "gtheory_pio")?;
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
@copilot Fix the code for all comments in this review thread. When a review comment includes a suggested change, apply the suggestion exactly. Do not make changes beyond what is described in the linked review thread. |
Fixed in commits
All 7 |
9ff6ca2 to
c0ec7b2
Compare
d206a8f to
6f9d42f
Compare
c0ec7b2 to
51fb72f
Compare
6f9d42f to
f6160e9
Compare
51fb72f to
940a26c
Compare
f6160e9 to
d0152fc
Compare
940a26c to
0abfd60
Compare
Rebased onto main after #228 squash merge. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
d0152fc to
7185242
Compare
Summary
Iteration 12 of the paper-implementation loop: Generalizability Theory G/D studies for the one-facet crossed
p x iand two-facet crossedp x i x odesigns (Huebner & Lucht, 2019, PARE 24(5), doi:10.7275/5065-gc10 — read in full).mlsirm_core::gtheory: random-effects ANOVA variance components (EMS inversion), D-study relative/absolute error variances, generalizability coefficient E-rho^2, dependability Phi over proposed facet sizes.gtheory_pi/gtheory_pio; thin Python wrappers infast_mlsirm.gtheorywith dataclass results.Source discipline
Evidence
gt_pi_paper_fixture,gt_pio_paper_fixture)gt_pi_mc_recovery_500,#[ignore])ss_pio = ss_total - ...catastrophic cancellation (negative SS on 1e12-offset data) — fixed with direct three-way residual sum + regression testStacked on #228 (
seonghobae-livingston-lewis).