← back to projects

popgen-calibrated-sbi

Your DNA is basically a history book written by your ancestors. I wanted to see if I could read it, and how often I'd get it wrong.

I built a simulation-based inference system that estimates population history and natural selection from a single genomic window. It combines posterior calibration, detection of model mismatch, and a controlled comparison of the accuracy and robustness of two representations.

role
Joint inference of demography and a selective sweep from one genomic window, with a refusal head.
language
Python, PyTorch, msprime. My own BGZF/tabix reader pulls real 1000 Genomes data over HTTP.
scale
Four encoder–head arms, 2k–40k simulation budgets, a 19-variant misspecification suite, 14 real human genome windows.
status
Research complete.
source
Private repository.
paper
Read it below · Web version

Joint inference from one genomic window

The simulator couples a two-epoch population history with a selective sweep. I compare four combinations of encoder and posterior estimator across simulation budgets from 2,000 to 40,000, using diagnostics first validated against an analytic posterior.

Across the reported runs, nominal 90% coverage is 0.86–0.90, while SBC detects residual rank deviations. The moments baseline covers the three demographic parameters at 0.18–0.53 under the tested single-window protocol.

Detecting model mismatch

A conformal refusal layer combines complementary signals: posterior-predictive discrepancy detects genotyping error, while embedding distance detects SNP ascertainment. Its false-alarm guarantee applies to exchangeable in-model inputs.

On 14 real 1000 Genomes windows, the combined rule refuses 10. At LCT it rejects the European window and accepts the African window. These are checks of compatibility with the simulator; identifying the biological cause requires a richer population model.

An accuracy–robustness tradeoff

The raw-genotype CNN has about 20% higher error than the summary encoder across budgets, yet achieves higher coverage on all 19 misspecified variants. Its mean coverage shortfall is 0.027, compared with 0.110 for the summary encoder. Three-seed experiments in epidemic and ecological simulators reproduce the direction of the tradeoff.

Representation choice changes how an inference system behaves when its simulator is wrong.

The genetics robustness comparison currently uses one seed per arm and unequal evaluation sizes. Matched, repeated experiments and interval-width comparisons are the next tests of the effect.

the paper

Page 1 of 5 of the paper Page 2 of 5 of the paper Page 3 of 5 of the paper Page 4 of 5 of the paper Page 5 of 5 of the paper