Applied Health Economics, RWE & HTA
Overview / Module 4 / Day 35
Module 4 · Policy evaluation · Day 35 of 100

Regression Discontinuity: Age-Based Drug Coverage

Ontario's public plan covers prescription drugs for people under 25 who have no private plan, and stops on their 25th birthday. Nothing else about a person changes between 24 years and 364 days and 25 years: same diabetes, same doctor, same income. So the difference in outcomes just either side of 25 measures the effect of losing coverage. That is a regression discontinuity (RD), one of the most credible observational designs. Today you estimate it for young adults with type 1 diabetes, for whom insulin is not optional.

▶
Video for Day 35 coming soon

By the end of today you can

  • estimate RD with local linear regression, a triangular kernel and person-clustered SEs
  • separate the first stage, the reduced form and the fuzzy (IV) estimate, and label each correctly
  • report results across bandwidths, with a pre-specified main bandwidth
  • check density, placebo cutoffs, an unaffected population and covariates
  • prefer local fits to global high-order polynomials

Today's 5.5-hour plan

LessonProjectBreakCommitFrançais
0:00–0:30
35.1 The 25th birthday
0:30–1:20
35.2 Local linear regression at the cutoff
1:20–1:35
Break
1:35–2:05
35.3 Fuzzy RD: who loses coverage
2:05–2:40
35.4 Bandwidths
2:40–2:55
Break
2:55–3:35
35.5 Validity checks
3:35–4:00
35.6 Truth check
4:00–4:20
35.7 The jump is not the effect
4:20–4:50
35.8 Mini-project: the RD figure
4:50–5:00
35.9 Save your work
5:00–5:30
Bloc français

In this lesson

35.1 The 25th birthday (30 min)

"""Day 35.1: OHIP+ covers people under 25 without a private plan. What happens at the 25th birthday?"""

import os
import sys

sys.path.insert(0, os.path.join(os.path.dirname(os.path.abspath(__file__)), ".."))
import matplotlib  # noqa: E402

matplotlib.use("Agg")
import matplotlib.pyplot as plt  # noqa: E402
import numpy as np  # noqa: E402

from corridor.db import ROOT  # noqa: E402
from corridor.quasi import load_young_adults  # noqa: E402

d = load_young_adults()
print(f"{d.person_id.nunique():,} young adults with type 1 diabetes ({(d.province == 'ON').mean():.0%} of rows in Ontario), "
      f"{len(d):,} person-months in 2024, ages {d.age.min():.1f}-{d.age.max():.1f}")
on = d[d.province == "ON"]
b = on.assign(bin=np.floor(on.x * 4) / 4).groupby("bin")[["public_coverage", "insulin_fill", "dka_ed_visit"]].mean()
print("\nOntario, by quarter-year of age relative to 25:")
print(b.loc[-1.5:1.25].round(3).to_string())
fig, axes = plt.subplots(1, 2, figsize=(10, 3.6))
for ax, (col, lab) in zip(axes, (("public_coverage", "public drug coverage"), ("insulin_fill", "filled insulin that month"))):
    for prov, c in (("ON", "#4f9cf9"), ("QC", "#e93d82")):
        s = d[d.province == prov]
        g = s.assign(bin=np.floor(s.x * 4) / 4 + 0.125).groupby("bin")[col].mean()
        ax.plot(g.index, g.values, "o", ms=3.5, color=c, label="Ontario" if prov == "ON" else "Quebec")
    ax.axvline(0, color="black", lw=0.8, ls="--")
    ax.set_xlabel("age - 25 (years)")
    ax.set_title(lab, fontsize=10)
    ax.spines[["top", "right"]].set_visible(False)
axes[0].legend(frameon=False, fontsize=8)
fig.tight_layout()
fig.savefig(os.path.join(ROOT, "figures", "day35_cutoff.png"), dpi=150)
print("wrote figures/day35_cutoff.png")
28,000 young adults with type 1 diabetes (71% of rows in Ontario), 336,000 person-months in 2024, ages 21.0-29.9

Ontario, by quarter-year of age relative to 25:
       public_coverage  insulin_fill  dka_ed_visit
bin                                               
-1.50            0.678         0.828         0.005
-1.25            0.664         0.819         0.007
-1.00            0.649         0.829         0.006
-0.75            0.634         0.826         0.006
-0.50            0.617         0.820         0.007
-0.25            0.612         0.823         0.007
 0.00            0.051         0.692         0.008
 0.25            0.052         0.697         0.008
 0.50            0.057         0.697         0.010
 0.75            0.054         0.682         0.009
 1.00            0.050         0.695         0.009
 1.25            0.048         0.693         0.011
wrote figures/day35_cutoff.png

Coverage and insulin fills by age

In Ontario, public coverage falls from about 61% to 5% at 25: people without a private plan lose OHIP+, and only a few stay covered through the income-based Trillium program. The monthly probability of filling insulin drops from about 82% to 69% at the same age. Quebec has no age rule: neither series moves.


35.2 Local linear regression at the cutoff (50 min)

The RD estimate is the difference between two regression lines evaluated at 25, one fitted on each side. Fit only near the cutoff, within a bandwidth h, and weight observations by how close they are (a triangular kernel). People appear in up to 12 months, so standard errors are clustered by person.

def load_young_adults():
    import duckdb
    d = duckdb.sql(f"SELECT * FROM read_csv('{DATA}/young_adults_t1d_2024.csv')").df()
    d["x"] = d.age - 25                                           # running variable, centred at the cutoff
    d["above"] = (d.x >= 0).astype(int)
    return d

def rd_local_linear(d, y, h, cutoff_var="x", treat=None, cluster="person_id"):
    """Local linear RD with a triangular kernel and bandwidth h (years). Sharp: the jump in y at the cutoff.
    Fuzzy (treat given): the jump in y divided by the jump in treat, estimated by weighted 2SLS.
    SEs clustered by person. Returns dict(estimate, se, n, first_stage, first_stage_se)."""
    import statsmodels.api as sm
    s = d[d[cutoff_var].abs() < h].copy()
    w = 1 - s[cutoff_var].abs() / h
    x, a = s[cutoff_var].to_numpy(), s.above.to_numpy()
    X = np.column_stack([np.ones(len(s)), a, x, a * x])
    groups = pd.factorize(s[cluster])[0]
    fit = lambda yy, XX: sm.WLS(yy, XX, weights=w).fit(cov_type="cluster", cov_kwds={"groups": groups})  # noqa: E731
    rf = fit(s[y].to_numpy(float), X)
    if treat is None:
        return {"estimate": float(rf.params[1]), "se": float(rf.bse[1]), "n": len(s)}
    fs = fit(s[treat].to_numpy(float), X)
    # 2SLS: instrument 'above' for treat, with the same controls (x, above*x) on both sides
    from statsmodels.sandbox.regression.gmm import IV2SLS
    Z = X
    Xiv = np.column_stack([np.ones(len(s)), s[treat].to_numpy(float), x, a * x])
    sw = np.sqrt(w.to_numpy())
    iv = IV2SLS(s[y].to_numpy(float) * sw, Xiv * sw[:, None], Z * sw[:, None]).fit()
    resid = (s[y].to_numpy(float) - Xiv @ iv.params) * sw
    # cluster-robust sandwich for 2SLS
    Xh = (Z * sw[:, None]) @ np.linalg.lstsq(Z * sw[:, None], Xiv * sw[:, None], rcond=None)[0]
    bread = np.linalg.inv(Xh.T @ Xh)
    sg = pd.DataFrame(Xh * resid[:, None]).groupby(groups).sum().to_numpy()   # per-person score sums
    meat = sg.T @ sg
    G = len(sg)
    v = bread @ meat @ bread * G / (G - 1)
    return {"estimate": float(iv.params[1]), "se": float(np.sqrt(v[1, 1])), "n": len(s),
            "first_stage": float(fs.params[1]), "first_stage_se": float(fs.bse[1]),
            "reduced_form": float(rf.params[1]), "reduced_form_se": float(rf.bse[1])}
"""Day 35.2-35.3: local linear regression at the cutoff - first stage, reduced form, and the fuzzy RD estimate."""

import os
import sys

sys.path.insert(0, os.path.join(os.path.dirname(os.path.abspath(__file__)), ".."))
from corridor.quasi import load_young_adults, rd_local_linear  # noqa: E402

d = load_young_adults()
on = d[d.province == "ON"]
r = rd_local_linear(on, "insulin_fill", h=2.0, treat="public_coverage")
print(f"bandwidth 2 years, triangular kernel, {r['n']:,} person-months, SEs clustered by person")
print(f"  first stage  (jump in public coverage at 25):  {r['first_stage']:+.3f} (SE {r['first_stage_se']:.3f})")
print(f"  reduced form (jump in monthly insulin fills): {r['reduced_form']:+.3f} (SE {r['reduced_form_se']:.3f})")
print(f"  fuzzy RD = reduced form / first stage:          {r['estimate']:+.3f} (SE {r['se']:.3f})")
print(f"    95% CI {r['estimate'] - 1.96 * r['se']:+.3f} to {r['estimate'] + 1.96 * r['se']:+.3f}: "
      "the effect of public coverage on filling insulin, for people who lose it at 25")
k = rd_local_linear(on, "dka_ed_visit", h=2.0, treat="public_coverage")
print(f"\nDKA emergency visits per month: fuzzy RD {k['estimate']:+.4f} (95% CI {k['estimate'] - 1.96 * k['se']:+.4f} "
      f"to {k['estimate'] + 1.96 * k['se']:+.4f})")
bandwidth 2 years, triangular kernel, 119,856 person-months, SEs clustered by person
  first stage  (jump in public coverage at 25):  -0.548 (SE 0.011)
  reduced form (jump in monthly insulin fills): -0.128 (SE 0.006)
  fuzzy RD = reduced form / first stage:          +0.234 (SE 0.011)
    95% CI +0.213 to +0.255: the effect of public coverage on filling insulin, for people who lose it at 25

DKA emergency visits per month: fuzzy RD -0.0017 (95% CI -0.0056 to +0.0023)

35.3 Fuzzy RD: who loses coverage (30 min)

Not everyone is treated by the cutoff: people with a private plan keep their coverage, and Trillium covers a few. Turning 25 changes the probability of public coverage by −0.55. The RD is fuzzy:

  • the first stage is the jump in coverage: −0.55;
  • the reduced form is the jump in insulin fills: −0.13;
  • their ratio, +0.23, is the effect of public coverage on filling insulin each month, for the people who lose coverage at 25 (the compliers).

Fuzzy RD is IV with the cutoff as the instrument (Day 36), estimated locally.

Losing drug coverage lowers the monthly probability of filling insulin by 23 percentage points, about 29% of the usual 82%. For DKA emergency visits, the estimate (−0.0017 per month, 95% CI −0.0056 to +0.0023) is too imprecise to conclude anything: DKA visits are rare, and a year of data around one birthday is not enough.


35.4 Bandwidths (35 min)

"""Day 35.4: the bandwidth trade-off - narrower is less biased, wider is more precise. Report a range."""

import os
import sys

sys.path.insert(0, os.path.join(os.path.dirname(os.path.abspath(__file__)), ".."))
from corridor.quasi import load_young_adults, rd_local_linear  # noqa: E402

on = load_young_adults().query("province == 'ON'")
print(f"{'bandwidth (years)':>18}{'person-months':>15}{'fuzzy RD':>10}{'SE':>8}   first stage")
for h in (0.5, 1.0, 1.5, 2.0, 3.0, 4.0):
    r = rd_local_linear(on, "insulin_fill", h=h, treat="public_coverage")
    print(f"{h:>18}{r['n']:>15,}{r['estimate']:>+10.3f}{r['se']:>8.3f}   {r['first_stage']:+.3f}")
 bandwidth (years)  person-months  fuzzy RD      SE   first stage
               0.5         30,173    +0.251   0.019   -0.555
               1.0         60,059    +0.228   0.014   -0.554
               1.5         89,809    +0.231   0.012   -0.551
               2.0        119,856    +0.234   0.011   -0.548
               3.0        179,969    +0.234   0.010   -0.547
               4.0        226,071    +0.238   0.009   -0.549

Narrow bandwidths use only people very close to 25 (less bias if the relationship with age curves); wide ones use more data (smaller standard errors). Here the estimate is stable between 0.23 and 0.25 across bandwidths from 6 months to 4 years. Report a table like this, with a pre-specified main bandwidth. rdrobust (R, Stata, Python) chooses an MSE-optimal bandwidth and gives bias-corrected robust confidence intervals (Calonico, Cattaneo and Titiunik). It is the standard for published RD work.

Check it in R (by hand, with fixest for the weighted 2SLS):

# Day 35: the fuzzy RD by hand in R - weighted local linear first stage and reduced form, and 2SLS with fixest.
suppressPackageStartupMessages({ library(fixest) })
d <- read.csv("data/young_adults_t1d_2024.csv")
on <- subset(d, province == "ON")
on$x <- on$age - 25
on$above <- as.integer(on$x >= 0)
h <- 2
s <- subset(on, abs(x) < h)
s$w <- 1 - abs(s$x) / h
fs <- feols(public_coverage ~ above + x + above:x, data = s, weights = ~w, cluster = ~person_id)
rf <- feols(insulin_fill ~ above + x + above:x, data = s, weights = ~w, cluster = ~person_id)
iv <- feols(insulin_fill ~ x + above:x | public_coverage ~ above, data = s, weights = ~w, cluster = ~person_id)
cat(sprintf("first stage %+.3f, reduced form %+.3f, fuzzy RD %+.3f (SE %.3f)\n", coef(fs)["above"], coef(rf)["above"],
            coef(iv)["fit_public_coverage"], se(iv)["fit_public_coverage"]))
first stage -0.548, reduced form -0.128, fuzzy RD +0.234 (SE 0.011)

35.5 Validity checks (40 min)

An RD rests on one assumption: nothing other than coverage changes discontinuously at 25. Four checks:

"""Day 35.5: validity checks - no bunching at the cutoff, covariates smooth, placebo cutoffs, and Quebec."""

import os
import sys

sys.path.insert(0, os.path.join(os.path.dirname(os.path.abspath(__file__)), ".."))
import numpy as np  # noqa: E402

from corridor.quasi import load_young_adults, rd_local_linear  # noqa: E402

d = load_young_adults()
on = d[d.province == "ON"]
first = on[on.month == on.month.min()]
near = first[first.x.abs() < 0.5]
print(f"density: people within 6 months below 25: {(near.x < 0).sum():,}, above: {(near.x >= 0).sum():,} "
      f"(age cannot be manipulated; the counts should be equal)")
print("\nplacebo cutoffs (Ontario, reduced form on insulin fills, bandwidth 1 year, data on one side of 25 only):")
for c in (23.0, 24.0, 26.0, 27.0):
    side = on[(on.age < 25) if c < 25 else (on.age >= 25)].assign(x=lambda s: s.age - c)
    side = side.assign(above=(side.x >= 0).astype(int))
    r = rd_local_linear(side, "insulin_fill", h=1.0)
    print(f"  age {c:.0f}: {r['estimate']:+.3f} (SE {r['se']:.3f})")
qc = d[d.province == "QC"]
for y in ("public_coverage", "insulin_fill"):
    r = rd_local_linear(qc, y, h=2.0)
    print(f"Quebec (no age rule), jump in {y} at 25: {r['estimate']:+.3f} (SE {r['se']:.3f})")
density: people within 6 months below 25: 1,290, above: 1,310 (age cannot be manipulated; the counts should be equal)

placebo cutoffs (Ontario, reduced form on insulin fills, bandwidth 1 year, data on one side of 25 only):
  age 23: +0.007 (SE 0.007)
  age 24: +0.012 (SE 0.007)
  age 26: +0.010 (SE 0.008)
  age 27: -0.011 (SE 0.008)
Quebec (no age rule), jump in public_coverage at 25: -0.012 (SE 0.016)
Quebec (no age rule), jump in insulin_fill at 25: +0.000 (SE 0.008)
  1. Density. As many people are just above 25 as just below. Age cannot be manipulated; an income threshold could be.
  2. Placebo cutoffs. At ages 23, 24, 26 and 27 there are no jumps of any size (all within about 2 SE of zero, and a tenth of the real jump).
  3. A population without the rule. Quebec shows no jump in coverage or in fills at 25.
  4. Covariates. Pre-determined characteristics should not jump either. Sex, region and diabetes duration would be checked here if the file had them; in real data, always check them.

Why it matters at work: age cutoffs are everywhere in Canadian drug policy: OHIP+ at 25, the Ontario Drug Benefit at 65, provincial programs for children and seniors. RD studies of these cutoffs inform debates about national pharmacare, and payers ask exactly this question: what happens to adherence when coverage ends?

Where you'll meet this: studies of medication use at age 65 and at 25; eligibility thresholds based on income or a clinical score (an eGFR or HbA1c cutoff in a reimbursement criterion is a potential RD)


35.6 Truth check (25 min)

"""Day 35 truth check: the generator's effect of coverage on insulin fills and DKA for people who lose it at 25."""

import os
import sys

sys.path.insert(0, os.path.join(os.path.dirname(os.path.abspath(__file__)), ".."))
import duckdb  # noqa: E402

from corridor.quasi import load_young_adults, rd_local_linear  # noqa: E402
from corridor.truth import TRUTH  # noqa: E402

d = load_young_adults()
on = d[d.province == "ON"]
t = duckdb.sql(f"SELECT * FROM read_csv('{TRUTH}/young_adults_truth.csv')").df()
t["month"] = t.month.astype(str).str[:10]
x = on.assign(month=on.month.astype(str).str[:10]).merge(t, on=["person_id", "month"])
c = x[(x.private_plan == 0) & (x.x.abs() < 0.5)]               # people without a private plan, near 25
print(f"{'outcome':<14}{'fuzzy RD (95% CI)':>28}{'truth':>9}")
for y, a, b in (("insulin_fill", "p_fill_insured", "p_fill_uninsured"), ("dka_ed_visit", "p_dka_insured", "p_dka_uninsured")):
    r = rd_local_linear(on, y, h=2.0, treat="public_coverage")
    print(f"{y:<14}{r['estimate']:>+10.4f} ({r['estimate'] - 1.96 * r['se']:+.4f} to {r['estimate'] + 1.96 * r['se']:+.4f})"
          f"{(c[a] - c[b]).mean():>+9.4f}")
print("(truth: insured minus uninsured, for people without a private plan within 6 months of 25 -"
      " most of them lose coverage at 25)")
outcome                  fuzzy RD (95% CI)    truth
insulin_fill     +0.2341 (+0.2130 to +0.2552)  +0.2200
dka_ed_visit     -0.0017 (-0.0056 to +0.0023)  -0.0050
(truth: insured minus uninsured, for people without a private plan within 6 months of 25 - most of them lose coverage at 25)

The generator lowers the monthly probability of filling insulin by exactly 0.22 when a person is uninsured. The fuzzy RD estimates 0.234 (95% CI 0.213 to 0.255) and covers it. For DKA visits, the true effect (−0.005 per month) is inside the wide interval: a correct design can still be underpowered.

Try it (15 min). Older RD studies fitted a high-order polynomial to all the data. Compare global polynomials of degree 1 to 6 with the local linear estimate.

Solution
"""Day 35 try it: a global quartic polynomial on all ages vs local linear - and why the RD literature prefers the latter."""

import os
import sys

sys.path.insert(0, os.path.join(os.path.dirname(os.path.abspath(__file__)), ".."))
import statsmodels.formula.api as smf  # noqa: E402

from corridor.quasi import load_young_adults, rd_local_linear  # noqa: E402

on = load_young_adults().query("province == 'ON'")
for deg in (1, 2, 4, 6):
    poly = " + ".join(f"I(x**{k}) + I(above * x**{k})" for k in range(1, deg + 1))
    rf = smf.ols(f"insulin_fill ~ above + {poly}", on).fit(cov_type="cluster", cov_kwds={"groups": on.person_id.factorize()[0]})
    fs = smf.ols(f"public_coverage ~ above + {poly}", on).fit()
    print(f"global polynomial, degree {deg}: reduced form {rf.params.above:+.3f} (SE {rf.bse.above:.3f}), "
          f"fuzzy {rf.params.above / fs.params.above:+.3f}")
r = rd_local_linear(on, "insulin_fill", h=2.0, treat="public_coverage")
print(f"local linear, bandwidth 2:      reduced form {r['reduced_form']:+.3f} (SE {r['reduced_form_se']:.3f}), fuzzy {r['estimate']:+.3f}")
global polynomial, degree 1: reduced form -0.133 (SE 0.004), fuzzy +0.241
global polynomial, degree 2: reduced form -0.129 (SE 0.006), fuzzy +0.239
global polynomial, degree 4: reduced form -0.127 (SE 0.009), fuzzy +0.231
global polynomial, degree 6: reduced form -0.126 (SE 0.012), fuzzy +0.224
local linear, bandwidth 2:      reduced form -0.128 (SE 0.006), fuzzy +0.234

Here they all agree (0.22–0.24), because the true relationship with age is linear on both sides. Higher degrees only widen the standard error. With curved relationships, global high-order polynomials can produce large spurious jumps and give heavy weight to observations far from the cutoff. Gelman and Imbens (2019) recommend local linear or quadratic fits instead.


35.7 The jump is not the effect (20 min)

Bug of the day. The first draft of a brief reported the jump in fills at 25 as "the effect of losing coverage":

"""Day 35 bug of the day: reporting the jump in outcomes as 'the effect of coverage'."""

import os
import sys

sys.path.insert(0, os.path.join(os.path.dirname(os.path.abspath(__file__)), ".."))
from corridor.quasi import load_young_adults, rd_local_linear  # noqa: E402

on = load_young_adults().query("province == 'ON'")
sharp = rd_local_linear(on, "insulin_fill", h=2.0)
fuzzy = rd_local_linear(on, "insulin_fill", h=2.0, treat="public_coverage")
print(f"jump in monthly insulin fills at 25 (reported as the effect of coverage): {sharp['estimate']:+.3f}")
print(f"jump in coverage at 25: {fuzzy['first_stage']:+.3f} - only {-fuzzy['first_stage']:.0%} of people lose coverage")
print(f"effect of coverage for those who lose it: {sharp['estimate']:+.3f} / {fuzzy['first_stage']:+.3f} = {fuzzy['estimate']:+.3f}")
jump in monthly insulin fills at 25 (reported as the effect of coverage): -0.128
jump in coverage at 25: -0.548 - only 55% of people lose coverage
effect of coverage for those who lose it: -0.128 / -0.548 = +0.234

The −0.13 is the effect of turning 25, averaged over everyone, including the 45% whose coverage does not change. The effect of losing coverage is 1.8 times larger (−0.23). Both are useful numbers: the first for "what happens to the cohort at 25", the second for "what does coverage do for someone who loses it". Mislabelling one as the other understates the effect of coverage by 45%.


35.8 Mini-project: the RD figure (30 min)

The standard RD figure shows binned means with the local fits on each side, for the first stage and for the outcome:

"""Day 35 mini-project: the RD figure for the brief - binned means with local linear fits on each side."""

import os
import sys

sys.path.insert(0, os.path.join(os.path.dirname(os.path.abspath(__file__)), ".."))
import matplotlib  # noqa: E402

matplotlib.use("Agg")
import matplotlib.pyplot as plt  # noqa: E402
import numpy as np  # noqa: E402

from corridor.db import ROOT  # noqa: E402
from corridor.quasi import load_young_adults, rd_local_linear  # noqa: E402

on = load_young_adults().query("province == 'ON'")
h = 2.0
s = on[on.x.abs() < h]
fig, axes = plt.subplots(1, 2, figsize=(10, 3.6))
for ax, (y, lab) in zip(axes, (("public_coverage", "public drug coverage"), ("insulin_fill", "filled insulin that month"))):
    b = s.assign(bin=np.floor(s.x * 12) / 12 + 1 / 24).groupby("bin")[y].mean()
    ax.plot(b.index, b.values, "o", ms=3, color="#8b8d98")
    for side in (s.x < 0, s.x >= 0):
        xs = s.x[side]
        w = 1 - xs.abs() / h
        coef = np.polyfit(xs, s[y][side], 1, w=np.sqrt(w))
        grid = np.linspace(xs.min(), xs.max(), 20)
        ax.plot(grid, np.polyval(coef, grid), color="#22b8cf", lw=2)
    ax.axvline(0, color="black", lw=0.8, ls="--")
    ax.set_title(lab, fontsize=10)
    ax.set_xlabel("age - 25 (years)")
    ax.spines[["top", "right"]].set_visible(False)
fig.tight_layout()
fig.savefig(os.path.join(ROOT, "figures", "day35_rd.png"), dpi=150)
r = rd_local_linear(on, "insulin_fill", h=h, treat="public_coverage")
n_lose = (on[(on.month == on.month.max()) & (on.x.between(0, 1))].public_coverage == 0).sum()
print(f"wrote figures/day35_rd.png; losing coverage lowers the monthly chance of filling insulin by {r['estimate']:.2f} "
      f"(about {100 * r['estimate'] / 0.82:.0f}% of the usual 82%)")
wrote figures/day35_rd.png; losing coverage lowers the monthly chance of filling insulin by 0.23 (about 29% of the usual 82%)

RD at age 25: coverage and insulin fills

Caption it for a pharmacare brief: "When young adults with type 1 diabetes lose public drug coverage at 25, their monthly chance of filling insulin falls by about 23 percentage points."

35.9 Save your work

python -m pytest -q
git add .
git commit -m "Day 35: fuzzy regression discontinuity at OHIP+ age 25"

Day 35 checklist

  • I estimate RD with local linear regression, a triangular kernel and person-clustered SEs
  • I separate the first stage, the reduced form and the fuzzy (IV) estimate, and label each correctly
  • I report results across bandwidths, with a pre-specified main bandwidth
  • I check density, placebo cutoffs, an unaffected population and covariates
  • I prefer local fits to global high-order polynomials