Adjustment#
- class pgmpy.identification.adjustment.Adjustment(variant='minimal')[source]#
Bases:
_BaseIdentificationGiven a causal graph, finds the adjustment set.
This class implements a few variants for computing adjustment sets for identifying the total causal effect of the variables in the exposures role on the variables in the outcomes role. Additionally, it provides methods to check if the current set of variables with role adjustment satisfy the backdoor criterion and to compute the backdoor adjustment formula.
- Parameters:
- variant: str
The variant of backdoor identification to use. Default is ‘minimal’.
‘all’: Returns all adjustment sets that satisfy the backdoor criterion.
‘minimal’: Returns the smallest adjustment set.
‘minimal_variance’: Returns the adjustment set for which estimators achieve minimal variance.
References
- [1] Perkovi, Emilija, et al. “Complete graphical characterization and
construction of adjustment sets in Markov equivalence classes of ancestral graphs.” Journal of Machine Learning Research.
- [2] Witte, Janine, et al. “On efficient adjustment in causal graphs.”
Journal of Machine Learning Research.
Examples
>>> from pgmpy.base import DAG >>> dag = DAG( ... ebunch=[ ... ("x1", "y1"), ... ("x1", "z1"), ... ("z1", "z2"), ... ("z2", "x2"), ... ("y2", "z2"), ... ], ... roles={"exposures": "x1", "outcomes": "y1"}, ... ) >>> dag_with_adj, success = Adjustment(variant="minimal").identify(dag) >>> roles = dag_with_adj.get_role_dict() >>> roles["exposures"] ['x1'] >>> roles["outcomes"] ['y1'] >>> Adjustment(variant="minimal").validate(dag_with_adj) True