StochStack

prototype · diffusion mock

Ophthalmology Digital Twin · Diffusion Synthetic Control (Mock)

Mock diffusion pipeline for synthetic control arm generation: latent noise -> denoising steps -> calibrated patient-level output.

Setup

Endpoint: BCVA change at Week 24 (ETDRS letters) · Historical pool: AMD-118, AMD-122, AMD-OBS-19 (680)

Diffusion Run

seed: 9612

Denoising convergence curve

Observed control N: 120
Borrowed ESS: 65
Estimated control reduction: 29.8%

Observed vs Synthetic

BCVA change: observed 2.10 ± 7.40 | Synthetic arm 2.52 ± 4.39 ·Δ +0.42
CST change: observed -32.0 ± 58.0 | Synthetic arm -30.7 ± 35.4 ·Δ +1.3
Treated arm vs Synthetic arm Distribution alignment: BCVA 58.9 / 100 · CST 64.7 / 100

Mock method note

This is a product mock: generated patients are simulated with a deterministic pseudo-random denoising loop, then calibrated to scenario-level control moments.

Treated arm vs Synthetic arm · Distribution alignment

Histogram overlay

Treated armSynthetic arm

Q-Q plot

x-axis: Treated arm quantiles · y-axis: Synthetic arm quantiles

External Control Methodology Pipeline

Step 1: Data cleaning

Raw N: T 120 / C 120

After cleaning: T 115 / C 115

Step 2: Cohort definition

Cohort eligible: T 115 / C 115

Step 3: Propensity score / weighting / matching

Balance before (mean |SMD|): 0.299

Balance after (mean |SMD|): 0.313

Step 4: Primary endpoint estimation

Primary effect (treated - external control): 5.45

95% CI: [3.98, 6.92]

Step 5: Sensitivity analysis

n(T/C): 69 / 61

ScenarioEffectDelta vs primaryInterpretation
Strict cohort window5.44-0.02Stable
More aggressive PS trim0.09-5.36Moderate shift
Hidden bias stress (Gamma-like)4.65-0.8Robust

Conditional Twin Generator (X→Y(t))

Baseline condition X

age 70.9 · Sex F · baseline BCVA 60.5 · baseline CST 379 · Lesion type occult · Prior injections 4

Counterfactual control trajectory

Mean with 95% prediction interval · K=50

Synthetic Patient Samples

IDAgeBase BCVABase CSTDuration (y)BCVA ΔCST ΔWeight
SYN-00173.160.73813-7.3270.86
SYN-00267.956.838932.9-430.84
SYN-00371.7494972.8-4.2-200.81
SYN-00481.347.33683.23.2-450.79
SYN-00576.355.13653.45.5-400.82
SYN-00675.261.24042.43.4600.84
SYN-00776.350.95011.54.9-600.83
SYN-00872.862.63734.20.5-560.83
SYN-00983.362.24233.66.5-910.85
SYN-01077.161.13833.62.3-340.82
SYN-01168.554.83834.93.5-410.81
SYN-01270.357.74463.3-2.2150.85

update log

Prototype Change Log

  1. 2026-03-06 · v0.4.0

    Conditional Twin Generation (X→Y(t))

    • - Added patient-level baseline conditioning fields: age, sex, baseline BCVA/CST, lesion type, prior injections.
    • - Added patient picker and K-counterfactual generation flow (default 50 twins) for selected treated patient.
    • - Added trajectory output with mean and 95% prediction interval confidence band.
  2. 2026-03-05 · v0.3.0

    External Control Methodology Pipeline

    • - Added end-to-end methodology pipeline: data cleaning -> cohort definition -> PS weighting/matching -> primary endpoint estimation -> sensitivity analysis.
    • - Added configurable analysis controls for IPTW vs PS matching, caliper, and propensity trimming.
    • - Added balance diagnostics (mean |SMD| before/after), treatment effect with 95% CI, and sensitivity scenario table.
  3. 2026-03-05 · v0.2.0

    Distribution Alignment + CSV Export

    • - Added treated-arm vs synthetic-arm distribution alignment panel.
    • - Added histogram overlay and Q-Q plot for BCVA/CST metric toggles.
    • - Added CSV export buttons for alignment dataset and synthetic patient-level table.
  4. 2026-03-05 · v0.1.0

    Ophthalmology Diffusion Twin (Mock) Launch

    • - Added a one-page mock prototype for synthetic control arm generation with diffusion-style denoising loop.
    • - Included ophthalmology scenarios (nAMD, DME, GA) with configurable cohort size, denoising steps, and calibration strength.
    • - Added side-by-side observed-vs-synthetic metrics and patient-level synthetic sample table for review.