CausalEffectEstimation.identifyAdjustmentSet
- CausalEffectEstimation.identifyAdjustmentSet(intervention, outcome, verbose=True)
Identify the sufficent adjustment set of covariates.
- Parameters:
intervention (
str) – Intervention (treatment) variable.outcome (
str) – Outcome variable.verbose (
bool) – If True, prints the estimators that can be used using the found adjustment. Default is True.
- Raises:
ValueError – The tratment isn’t binary or no adjustment set was found.
- Returns:
The identified adjustment set type among RCT, Backdoor, Frontdoor, IV, or Unknown.
- Return type:
str
Example
import numpy as np
import pandas as pd
import pyagrum as gum
import pyagrum.causalEffectEstimation as pycee
rng = np.random.default_rng(42)
X = rng.normal(size=500)
T = (rng.random(500) < 1 / (1 + np.exp(-X))).astype(int)
Y = 2 * T + X + rng.normal(size=500) # the causal effect of T on Y is 2
df = pd.DataFrame({"X": X, "T": T, "Y": Y})
cee = pycee.CausalEffectEstimation(df, gum.CausalModel(gum.fastBN("X->T->Y;X->Y")))
cee.identifyAdjustmentSet("T", "Y", verbose=False) # X closes the backdoor path T<-X->Y
# 'Backdoor'
Class