Skip to content

staar: GRM parity tests against R ground truth#132

Merged
vineetver merged 1 commit intomasterfrom
staar/grm-validation
Apr 18, 2026
Merged

staar: GRM parity tests against R ground truth#132
vineetver merged 1 commit intomasterfrom
staar/grm-validation

Conversation

@vineetver
Copy link
Copy Markdown
Owner

@vineetver vineetver commented Apr 18, 2026

R reimplements the upstream math on a 20-sample, 100-variant fixture. Rust tests compare allele freq, G*v, G'*v, PCA, kinship, and unrelated selection against the JSON.

Fixes three math bugs: pca.rs squared T=G'G*U singular values twice so eigenvalues came out as Σ^4 and related-sample projection divided by d^2 instead of d. Power iteration dropped the Krylov subspace so score correlations on small cohorts sat at 0.94; replaced with block Krylov accumulation matching drpca.R. unrelated.rs divergence tie-break was reversed.

cargo test: 326/326.

R reimplements the upstream math on a 20-sample, 100-variant
fixture and Rust tests check allele freq, G*v, G'*v, PCA,
kinship, and unrelated selection against the JSON.

Fixes three math bugs the port shipped with: pca.rs squared the
T=G'G*U singular values a second time (they're already Σ²) so
eigenvalues came out as Σ^4 and related-sample projection divided
by d^2 instead of d. Power iteration never kept the Krylov
subspace, so score correlations on small cohorts sat around 0.94;
replaced with block Krylov accumulation matching drpca.R.
unrelated.rs tie-broke divergence backwards: max_by picked the
highest, selectUnrel removes the lowest.

cargo test: 326/326.
@vineetver vineetver force-pushed the staar/grm-validation branch from 5ab5af1 to 0bd7827 Compare April 18, 2026 20:17
@vineetver vineetver merged commit ea01c61 into master Apr 18, 2026
3 checks passed
@vineetver vineetver deleted the staar/grm-validation branch April 18, 2026 23:25
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