Figure 5: Inherited predisposition and the health record¶

Runs locally against the authors' results (CODE). With RUN = False the cells show the current local figures; set RUN = True to regenerate each panel from the script named. No participant data are stored in this notebook; keep outputs cleared before committing (python ../tools/check_no_ids.py).

Panel a Carrier x PRS joint penetrance vs multiplicative expectation (model-free)¶

Script: src/reparam_fig3/interaction_carrier_x_prs.py

Upstream: model-free; unchanged by the backbone

Script header (inputs, recipe, outputs)
CARRIER x PRS INTERACTION (model-free 2x2), + does the two-channel model reproduce it?

Question: for a person who is BOTH a monogenic carrier AND high-PRS, is the joint risk multiplicative,
sub-multiplicative, or additive? The dissociation (carrier -> expression sigma(phi+eta); PRS -> loading theta)
predicts the two effects MULTIPLY (different factors of pi=theta*sigma), bent by SATURATION (cumulative
penetrance ceiling): high-penetrance carriers are already near 1, so PRS adds less on the RELATIVE scale ->
sub-multiplicative. Low-penetrance carriers stay multiplicative.

DESIGN (model-free): per gene->primary disease, eligible (sex-restricted) population, split PRS into TERTILES of
the eligible pop; 2x2 = carrier{no,yes} x PRS{low=bottom third, high=top third}. Lifetime primary-disease
penetrance (ever-diagnosed) per cell. Baseline = non-carrier, low-PRS.
  RR_prs=p01/p00, RR_carr=p10/p00, RR_both=p11/p00
  MULT interaction ratio  = RR_both / (RR_prs*RR_carr)      (=1 mult, <1 sub-mult, >1 super)
  ADD  interaction (RERI)  = (p11-p00) - (p01-p00) - (p10-p00)   (=0 additive)
Also computes the MODEL-PREDICTED 2x2 from deployed pi (survival penetrance 1-prod(1-pi)) if aligned, so we can
ask: does the fitted two-channel model (loading x expression + survival ceiling) reproduce the empirical
interaction? (If yes, sub-multiplicativity is just saturation; if empirical is MORE attenuated, genuine biology.)

INPUT  data_for_running/{Y_tensor,G_matrix,model_essentials,baselinagefamh_withpcs}; clinvar/carriers_*_wes.txt;
       prs_names.csv; (optional) results_slope_loo_like_delta0/pi_slope_delta0_loo_like_400000.pt
OUTPUT fig_interaction_carrier_x_prs.png + interaction_carrier_x_prs.npz (+prov). new_env_pyro2. Aggregates only.
RUN    /opt/miniconda3/envs/new_env_pyro2/bin/python claudefile/reparam_fig3/interaction_carrier_x_prs.py
No description has been provided for this image

Panel b Carrier x PRS interaction per SD (model-free)¶

Script: src/reparam_fig3/make_fig_prs_carrier_interaction_multi.py

Upstream: model-free; unchanged by the backbone

Script header (inputs, recipe, outputs)
PRS x monogenic-carrier interaction across THREE independent gene-disease axes:
   BRCA2 x breast-PRS -> breast (women), MLH1 x CRC-PRS -> colon, TTN x AF-PRS -> atrial fibrillation.
Tests whether polygenic background modifies monogenic penetrance (multiplicative interaction, logistic).
A consistent NULL interaction across axes = empirical orthogonality of the monogenic offset and polygenic loading.
Model per pair:  ever ~ carrier + z + carrier:z + age (+ sex if both) + 10 genetic PCs.
No description has been provided for this image

Panel c LDLR carriers: tertiles of predicted risk within age bands¶

Script: src/clinical_app/vignette_ldlr_ageadj_triplet.py

Upstream: held-out predictions: src/triplet_loo_calibration.py

Script header (inputs, recipe, outputs)
Fig 5c (TRIPLET), AGE-ADJUSTED: LDLR carriers of the SAME AGE, split by the EHR-driven model.

SUPERSEDES clinical_app/vignette_two_ldlr_carriers_triplet.py -> fig_vignette_ldlr_triplet.png (retired, renamed
*_AGECONFOUNDED). That panel cut tertiles on 10-yr risk from each carrier's OWN enrollment age, but drew the curves
against ABSOLUTE age from 30. On the triplet the low and mid curves coincide by age while their 10-yr risks
differ 3% vs 11%, i.e. the low/mid split was carried by enrollment age, not by the record. Its title also said
"same middle PRS tertile", but no PRS restriction was ever applied (the band was the tertile's MEAN percentile).

WHAT CHANGED
  1. Tertiles are cut WITHIN 5-yr enrollment-age bands (rank of model 10-yr risk among carriers of the same
     band), so the three groups are age-balanced BY CONSTRUCTION; mean age per tertile is printed and drawn.
  2. Panel drawn in the PUBLISHED style (mean model cumulative ASCVD risk by absolute age, 40-78); because the
     tertiles are age-balanced, separation by age is no longer an enrollment-age artifact. Observed 10-yr
     ASCVD in the legend/cards is Kaplan-Meier (censored at last follow-up, E_matrix_corrected).
  3. No hard-coded numbers in the text (the old "~12% group risk" is computed); PRS is reported, not asserted.
     MEASURED on the triplet: mean CAD-PRS pct rises across tertiles (33 / 49 / 59), so the split is record + PRS,
     not "the EHR" alone -- the text says so.

FORMULATION
  genetic   LDLR ClinVar P/LP carrier (WES) x CAD-PRS (G col 11) x EHR, read through the LOO model risk
  form      model: triplet SLOPE, mixture pi = sum_k theta_k sigmoid(phi_kd), frailty pi~=1-(1-pi)^exp(f);
            ASCVD per-year hazard = 1 - prod_d(1 - pi_d), d in ASCVD
  schedule  predictions = LOO 39-batch pooled slope-triplet backbone FROZEN; delta + log-frailty refit 200 steps
            (Adam 0.1) on E_enrollment_full under N(0,0.5^2) frailty prior; NO gamma penalty (weight_decay 0.0)
  objective none (read-out of held-out pi)
  estimand  observed 10-yr ASCVD (KM) and mean predicted 10-yr ASCVD by age-band-adjusted model-risk tertile,
            among LDLR carriers ASCVD-free at enrollment. Aggregates only.

No description has been provided for this image

Panel d FH carriers: carrier-blind vs carrier-aware risk¶

Script: src/clinical_app/fig_carrier_reclassification_triplet.py

Upstream: held-out predictions; static carrier effect

Script header (inputs, recipe, outputs)
TRIPLET PORT (generated by _make_fig5cd_triplet.py; only PI + output names differ).
CLINICAL FIGURE: carrier status helps by CALIBRATION / RECLASSIFICATION, not discrimination.

STORY (small-N-robust, absolute-risk not AUC): a carrier-blind model (PRS + EHR) UNDER-predicts FH carriers'
ASCVD risk, because FH carriers are NOT the polygenic tail. Adding carrier status (apply the empirical carrier
hazard ratio) recalibrates them to their true, observed risk and RECLASSIFIES many across the statin (7.5%) and
PCSK9i (20%) thresholds -- and the reclassified carriers have high observed event rates, validating the move.
This is exactly how FH is handled clinically (carrier => high-risk regardless of the calculated score).

FORMULATION: three MODEL/DATA bars, NO external projection.
  bar1 model(no carrier) = LOO base risk (pi_slope_delta0_loo_like: population params held out, delta re-estimated per patient).
  bar2 model+carrier     = base x empirical UKB age/sex-matched carrier RR (the data-derived carrier effect) -> a CALIBRATION
                           that lands ~on observed by construction (equivalently what the fitted carrier eta gives).
  bar3 observed          = the carriers' observed 10-yr ASCVD rate (data).
  The informative content is the GAP bar1->bar2/3: the carrier-blind under-call that carrier status closes. Aggregates only.
INPUTS  results_slope_loo_like_delta0/pi_slope_delta0_loo_like_400000.pt ; Y_tensor ; G_matrix ;
        clinvar/carriers_{LDLR,APOB,PCSK9}_clinvarPLP_wes.txt ; baselinagefamh_withpcs.csv
OUTPUT  claudefile/clinical_app/{fig_carrier_reclassification.png, carrier_reclassification.csv} (+prov). new_env_pyro2.
No description has been provided for this image