Making a model travel · step 1 of 6
The number you have is not the number you need
You have a defensible result. Why can you not just use it?
A filter-distribution programme ran in district A: uptake recorded per household, illness days counted over twelve weeks, and identification settled — a defensible effect. The decision is in district B, where the ministry budgets per person and over a year. Nothing about the study was wrong. It simply measured a different quantity from the one the decision needs.
differing_facets is the whole problem stated in one line. Three of the eight facets differ, and until they are named, 'we have a good estimate' is a claim about district A that somebody is about to spend district B's money on.
from axiom.core import D, Intervention, Outcome, Population, TimeWindow, Treatment
from axiom.estimands import Estimand, Level, Quantity
filters = Treatment(
name="filters", dimension=D.entity, unit="households reached",
description="a ceramic filter delivered and demonstrated",
)
illness = Outcome(
name="illness_days", dimension=D.outcome, unit="days/period",
description="reported days of diarrheal illness", aggregation="mean",
)
shared = dict(
quantity=Quantity(kind="contrast"),
treatment=filters,
intervention=Intervention(doses={"filters": 1.0}),
reference=Intervention(doses={"filters": 0.0}),
outcome=illness,
dimension=D.outcome,
)
# What the trial measured.
measured = Estimand(
name="filter_effect_A_household_12wk",
population=Population(
name="district_A",
strata={"age": {"under_5": 0.34, "5_to_17": 0.29, "adult": 0.37}},
),
window=TimeWindow(start=0, stop=12, basis="cumulative"),
level=Level(unit="cluster"),
**shared,
)
# What the decision needs.
needed = Estimand(
name="filter_effect_B_person_52wk",
population=Population(
name="district_B",
strata={"age": {"under_5": 0.21, "5_to_17": 0.24, "adult": 0.55}},
),
window=TimeWindow(start=0, stop=52, basis="cumulative"),
level=Level(unit="individual"),
**shared,
)
print("measured :", measured.name)
print("needed :", needed.name)
print()
print("facets that differ:", measured.differing_facets(needed))
print()
print("these are different objects, and they say so:")
print(" measured", measured.content_hash()[:16])
print(" needed ", needed.content_hash()[:16])
measured : filter_effect_A_household_12wk
needed : filter_effect_B_person_52wk
facets that differ: ('population', 'window', 'level')
these are different objects, and they say so:
measured adaf9c9abfa4b2fd
needed 6a864f41935b7358
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.