Best Linear Unbiased Prediction (BLUP)

June 5, 2026 · View on GitHub

Under the infinitesimal model, with per-s.d. effect sizes β ~ N(0, D), BLUP effect sizes are:

E(β)=nD(nD+R1)1R1zE(\beta) = \sqrt{n} D (nD + R^{-1})^{-1} R^{-1}z

where GraphLD approximates R1R^{-1} with the LDGM precision matrix.

import polars as pl
import graphld as gld

sumstats_with_weights: pl.DataFrame = gld.run_blup(
    ldgm_metadata_path="data/metadata.csv",
    sumstats=sumstats_dataframe_with_z_scores,
    heritability=0.1,
    sample_size=100000,
)

heritability is the heritability for the analyzed variant scope. This workflow assumes heritability is equally distributed among the matched LDGM effect indices, corresponding to D=m1h2ID = m^{-1} h^2 I with trace(D)=h2\mathrm{trace}(D) = h^2. If you filter by chromosome or population, pass the heritability for that restricted scope.

See also: