adjustment.AdjustmentModel
Facade for a backdoor-adjusted single-equation outcome model.
Usage
adjustment.AdjustmentModel(
*,
treatment,
outcome,
adjustment_set,
formula,
graph_info,
outcome_model,
parent_spec,
parent_families
)Wraps a reduced PathModel built from Y ~ treatment + Z while retaining the original causal DAG for identification context. Construct via pathmc.modeling.PathModel.adjustment_model(), not by calling this class directly.
After fit(), query the designated treatment-outcome pair with ate(), att(), atu(), and cate(), or use the shared interpret methods predictions(), comparisons(), and slopes().
Parameters
treatment: str-
Treatment variable in the designated query.
outcome: str-
Outcome variable in the designated query.
adjustment_set: frozenset[str]-
Validated backdoor adjustment set used to build the formula.
formula: str-
Reduced regression formula string.
graph_info: GraphInfo-
Original causal DAG (not the reduced estimation graph).
outcome_model: PathModel-
Inner data-bound model for the reduced equation.
parent_spec: Spec-
Original structural specification for DAG visualization.
parent_families: dict[str, str]- Outcome family inherited from the structural parent.
Examples
Build from a fitted structural model::
adj = m.adjustment_model("X -> Y")
adj.adjustment_set
adj.formula
adj.fit(draws=1000, chains=4)
ate = adj.ate(values=(0, 1))
ate.mean()
See Also
- adjustment_model()
-
Constructor on the structural model.
- InterpretResult
-
Unit-level interpret draws.
Attributes
| Name | Description |
|---|---|
| adjustment_set | Validated backdoor adjustment set. |
| formula | Reduced regression formula string. |
| graph_info | Original causal DAG (not the reduced estimation graph). |
| idata | Posterior samples from the inner model, if fitted. |
| outcome | Outcome variable in the designated query. |
| outcome_model | Inner PathModel for the reduced equation. |
| pymc_model | Compiled PyMC model of the inner outcome regression. |
| treatment | Treatment variable in the designated query. |
adjustment_set
Validated backdoor adjustment set.
adjustment_set: frozenset[str]
formula
Reduced regression formula string.
formula: str
graph_info
Original causal DAG (not the reduced estimation graph).
graph_info: GraphInfo
idata
Posterior samples from the inner model, if fitted.
idata: xr.DataTree | None
outcome
Outcome variable in the designated query.
outcome: str
outcome_model
Inner PathModel for the reduced equation.
outcome_model: Any
pymc_model
Compiled PyMC model of the inner outcome regression.
pymc_model: pm.Model
treatment
Treatment variable in the designated query.
treatment: str
Methods
| Name | Description |
|---|---|
| ate() | Average treatment effect via the inner model’s do() path. |
| att() | Average treatment effect on the treated. |
| atu() | Average treatment effect on the untreated. |
| cate() | Conditional average treatment effect. |
| comparisons() | Interventional contrasts on the reduced outcome model. |
| datagrid() | Build a covariate grid from the inner outcome model’s data. |
| fit() | Fit the inner outcome model via MCMC. |
| from_path_model() | Build an adjustment model from a structural PathModel. |
| graph() | DAG of the original causal system (not the reduced equation). |
| predictions() | Response-mean predictions on the reduced outcome model. |
| slopes() | Finite-difference slopes on the reduced outcome model. |
ate()
Average treatment effect via the inner model’s do() path.
Usage
ate(outcome=None, treatment=None, values=(0.0, 1.0), **do_kwargs)att()
Average treatment effect on the treated.
Usage
att(
outcome=None,
treatment=None,
values=(0.0, 1.0),
treated_value=1.0,
kind="mean"
)atu()
Average treatment effect on the untreated.
Usage
atu(
outcome=None,
treatment=None,
values=(0.0, 1.0),
untreated_value=0.0,
kind="mean"
)cate()
Conditional average treatment effect.
Usage
cate(
outcome=None,
treatment=None,
values=(0.0, 1.0),
condition=None,
**do_kwargs
)comparisons()
Interventional contrasts on the reduced outcome model.
Usage
comparisons(
outcome=None,
variable=None,
*,
contrast=(0.0, 1.0),
comparison="diff",
conditional=None,
average_by="all"
)datagrid()
Build a covariate grid from the inner outcome model’s data.
Usage
datagrid(**cols)fit()
Fit the inner outcome model via MCMC.
Usage
fit(**kwargs)from_path_model()
Build an adjustment model from a structural PathModel.
Usage
from_path_model(
parent,
*,
query=None,
treatment=None,
outcome=None,
adjustment_set=None,
formula=None,
data=None,
families=None,
priors=None
)This is the implementation behind pathmc.modeling.PathModel.adjustment_model(). Prefer that method from user code.
graph()
DAG of the original causal system (not the reduced equation).
Usage
graph()predictions()
Response-mean predictions on the reduced outcome model.
Usage
predictions(outcome=None, *, set=None, newdata=None)slopes()
Finite-difference slopes on the reduced outcome model.
Usage
slopes(
outcome=None,
wrt=None,
*,
slope="dydx",
eps=0.0001,
conditional=None,
average_by="all"
)