Skip to content

Cover the counts-based multi-population LD moment API - #278

Merged
andrewkern merged 1 commit into
mainfrom
nsp-ldstats-multipop-counts-coverage
Sep 7, 2026
Merged

andrewkern merged 1 commit into
mainfrom
nsp-ldstats-multipop-counts-coverage

Conversation

@nspope

@nspope nspope commented Sep 6, 2026 •

Copy link
Copy Markdown
Collaborator

Closes #275 which needed test coverage rather than dead-code cleanup. This found an inconsistency in the pi2 statistic through this route, and xfails a test to pin the behaviour, which is filed as #279

…consistency

ld_statistics.dz / pi2 accept a per-population counts array and a population-
index tuple and dispatch to per-pattern formulas whose three- and four-distinct-
population branches (Dz all-different; pi2 iikl / ijkk / shared / all-different)
have no in-package caller -- the pipeline uses the fused CUDA kernels -- and
were untested, though the module is public.

Cross-check each pattern against the fused kernels (compute_all_dz_hap /
compute_all_pi2_hap) on the same counts. The fused kernels return the raw
single-index term for every pattern and are validated against moments.LD, so
agreement pins the counts-API formula.

dz agrees for every pattern. pi2 does not: the _pi2_multi iikk branch
self-symmetrizes (returns 0.5*(numer1+numer2)) while every other pi2 branch
returns a single term, so ld_statistics.pi2 returns a different kind of
quantity depending on the index pattern. That case is marked xfail(strict) so
the mismatch is pinned and unifying the convention trips the marker.
@andrewkern

Copy link
Copy Markdown
Member

awesome. this one looks good and i'm going to merge.

@andrewkern
andrewkern merged commit bb0f532 into main Sep 7, 2026
1 check passed
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.

Cleanup: the >=3-distinct-population branches of the counts-based LD moment API

2 participants