One question, carried all the way · step 3 of 8
The belief we start from
What does the observational fit say, and how much should we trust it?
An unidentified number is still a belief, and pretending to have none is not neutrality. The observational fit is run — and then inflated, because a confounded estimate that reports its nominal precision is the most dangerous object in the analysis.
This is the number the experiment will be measured against. Write it down now, with its inflation stated, so that later there is something for the measurement to disagree with.
step 3
import numpy as np
from axiom.data import Panel
from axiom.estimands import realize
from axiom.surface import fit
# The panel the operator actually has: depots that were already in good
# shape got more hours, and "good shape" was never written down.
rng = np.random.default_rng(123)
frame = world.panel.frame
dose = frame["a"].to_numpy(dtype=np.float64)
standardized = (dose - dose.mean()) / dose.std()
condition = 0.6 * standardized + 0.8 * rng.standard_normal(dose.size)
observed_panel = Panel(frame.assign(y=frame["y"] + 0.8 * condition), world.panel.roles)
print(f"corr(hours, fleet condition) = "
f"{float(np.corrcoef(dose, condition)[0, 1]):.2f} <- the confounding")
biased = fit(spec, observed_panel, backend="laplace", draws=1000, seed=1)
before = realize(decision_estimand, biased, assume_identified=True, mass=0.9, seed=SEED)
# The estimand is region-level: it sums across the 40 depots. The
# break-even is per depot-week, so the comparison has to be made on
# one scale or the other -- and getting that wrong is how a decision
# gets made against a number forty times too big.
before_per_depot = before.summary.mean / REGION_DEPOTS
print()
print("the observational reading of the decision's estimand")
print(f" region : {before.summary.mean:+.1f} index points per week")
print(f" depot : {before_per_depot:+.2f} index points per depot-week")
print(f" break-even is {BREAK_EVEN:.2f}")
print(f" -> on this reading, fund it.")
what it printed
corr(hours, fleet condition) = 0.59 <- the confounding the observational reading of the decision's estimand region : +286.6 index points per week depot : +7.16 index points per depot-week break-even is 6.75 -> on this reading, fund it.
Every line above was captured by running this code at build time. The steps share one namespace, so the code on this page is the code you would type after the steps before it.