cleverly.BackdoorMeanContrast#
- class cleverly.BackdoorMeanContrast(outcome: Any, treatment: Any, adjustment: tuple[str, ...], target: str, axis: str = 'arm', reference: Any = None, interventions: Any = (), horizons: tuple[int, ...] | None = None, msm: MSM | None = None, intermediate: float | None = None, longitudinal: bool = False, missingness: str | None = None, intermediate_name: str | None = None, treatment_levels: tuple[Any, ...] = (), treatment_missingness: str | None = None, treatment_value: Any = None, history: tuple[tuple[str, tuple[str, ...]], ...] = ())[source]#
Store a normalized observed-data functional for an estimator adapter.
Users normally receive this object through
CausalStudy.identify().- Parameters:
- outcome
Any Outcome column declaration.
- treatment
Any Treatment column declaration.
- adjustment
tupleofstr Adjustment columns or baseline history.
- target
str Registered engine target.
- axis
str Parameter axis, such as
"arm","regimen", or"policy".- reference
AnyorNone Reference level or label.
- interventions
Any Interventions, shifts, or regimens evaluated by the target.
- horizons
tupleofintorNone Requested longitudinal follow-up times.
- msm
MSMorNone Marginal structural model for a projection target.
- intermediate
floatorNone Fixed intermediate level for a controlled direct effect.
- longitudinalbool
Whether the functional uses sequential identification.
- missingness
strorNone Outcome-observation indicator used by the observed-data regression.
- treatment_missingness
strorNone Treatment-observation indicator used by the observed-data regression.
- intermediate_name
strorNone Intermediate column fixed by a controlled direct effect.
- treatment_levels
tuple Declared treatment levels, in the data container’s stable order.
- treatment_value
AnyorNone One retained treatment level for a targeted counterfactual mean.
- history
tupleoftuple For a longitudinal functional, each treatment node with the set that its treatment mechanism conditions on: the covariates measured before the node, then the earlier treatment nodes. Empty for a point treatment.
- outcome
Methods#
Attributes#
- BackdoorMeanContrast.expression#
Return a readable expression for the identified functional.
- Raises:
CapabilityErrorWhen an arm-indexed target has no entry below. The alternative is to print some other estimand’s functional into the record that
summary()shows andsave()persists, which is a wrong answer rather than a missing one.
- BackdoorMeanContrast.reference_arm#
Return the arm this functional’s contrasts are taken against.
One implementation, because the printed expression and the printed positivity statement both resolve it and a reader who saw them disagree could not tell which arm the fit used.
"reference"stands in when the record declares no reference and notreatment_levels, as on a continuous treatment, which leaves nothing to name.
- BackdoorMeanContrast.selected_arm#
Return the one arm an evaluated-mean functional reports, or
Nonefor all.ey1andey0name an arm through the target rather than throughtreatment_value, which is why the rule is written here rather than at each of the three places that used to repeat it.