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:
outcomeAny

Outcome column declaration.

treatmentAny

Treatment column declaration.

adjustmenttuple of str

Adjustment columns or baseline history.

targetstr

Registered engine target.

axisstr

Parameter axis, such as "arm", "regimen", or "policy".

referenceAny or None

Reference level or label.

interventionsAny

Interventions, shifts, or regimens evaluated by the target.

horizonstuple of int or None

Requested longitudinal follow-up times.

msmMSM or None

Marginal structural model for a projection target.

intermediatefloat or None

Fixed intermediate level for a controlled direct effect.

longitudinalbool

Whether the functional uses sequential identification.

missingnessstr or None

Outcome-observation indicator used by the observed-data regression.

treatment_missingnessstr or None

Treatment-observation indicator used by the observed-data regression.

intermediate_namestr or None

Intermediate column fixed by a controlled direct effect.

treatment_levelstuple

Declared treatment levels, in the data container’s stable order.

treatment_valueAny or None

One retained treatment level for a targeted counterfactual mean.

historytuple of tuple

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.

Methods#

Attributes#

BackdoorMeanContrast.axis: str = 'arm'#
BackdoorMeanContrast.expression#

Return a readable expression for the identified functional.

Raises:
CapabilityError

When an arm-indexed target has no entry below. The alternative is to print some other estimand’s functional into the record that summary() shows and save() persists, which is a wrong answer rather than a missing one.

BackdoorMeanContrast.history: tuple[tuple[str, tuple[str, ...]], ...] = ()#
BackdoorMeanContrast.horizons: tuple[int, ...] | None = None#
BackdoorMeanContrast.intermediate: float | None = None#
BackdoorMeanContrast.intermediate_name: str | None = None#
BackdoorMeanContrast.interventions: Any = ()#
BackdoorMeanContrast.longitudinal: bool = False#
BackdoorMeanContrast.missingness: str | None = None#
BackdoorMeanContrast.msm: MSM | None = None#
BackdoorMeanContrast.reference: Any = None#
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 no treatment_levels, as on a continuous treatment, which leaves nothing to name.

BackdoorMeanContrast.selected_arm#

Return the one arm an evaluated-mean functional reports, or None for all.

ey1 and ey0 name an arm through the target rather than through treatment_value, which is why the rule is written here rather than at each of the three places that used to repeat it.

BackdoorMeanContrast.treatment_levels: tuple[Any, ...] = ()#
BackdoorMeanContrast.treatment_missingness: str | None = None#
BackdoorMeanContrast.treatment_value: Any = None#
BackdoorMeanContrast.outcome: Any#
BackdoorMeanContrast.treatment: Any#
BackdoorMeanContrast.adjustment: tuple[str, ...]#
BackdoorMeanContrast.target: str#