Making a model travel · step 5 of 6
Correct it, and watch the interval widen
What do the assumptions actually do to the number?
An assumption that licenses a transfer is not free. Each one comes with an operator that says what the correction is: a factor on the estimate, an offset, or a factor on the standard error. resolve composes them into one correction with one ledger.
The point estimate moved by a quarter, and the standard error nearly doubled. The widening is the honest part: reading a household-level measurement at the person level does not make the effect less certain by accident, it makes it less certain because five people in a household are not five independent observations.
from axiom.calibrate import (
aggregation_level, carryover_window_factor, resolve)
from axiom.surface import GeometricCarryover
# window: the trial's 12 weeks caught only part of the carryover.
carryover = GeometricCarryover(max_lag=26)
to_steady_state = carryover_window_factor(
carryover, {"lam_filters": 0.88}, 12, treatment="filters")
# level: households of ~5, correlated within.
to_person = aggregation_level(
measured.level, needed.level, cluster_size=5, icc=0.15)
resolved = resolve(
plan, transport=verdict.verdict,
corrections=[to_steady_state, to_person])
print("status :", resolved.status)
print(f"factor : {resolved.factor:.4f}")
print(f"offset : {resolved.offset:.4f}")
print(f"se_scale : {resolved.se_scale:.4f}")
print()
trial_estimate, trial_se = -1.84, 0.41
moved, widened = resolved.apply(trial_estimate, trial_se)
print(f"district A, per household, 12 weeks : "
f"{trial_estimate:+.2f} +/- {trial_se:.2f}")
print(f"district B, per person, 52 weeks : "
f"{moved:+.2f} +/- {widened:.2f}")
status : downgraded factor : 1.2291 offset : 0.0000 se_scale : 1.7678 district A, per household, 12 weeks : -1.84 +/- 0.41 district B, per person, 52 weeks : -2.26 +/- 0.89
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.