File tree Expand file tree Collapse file tree 1 file changed +9
-0
lines changed Expand file tree Collapse file tree 1 file changed +9
-0
lines changed Original file line number Diff line number Diff line change 17
17
from statsmodels .tools .sm_exceptions import PerfectSeparationError
18
18
19
19
from causal_testing .specification .variable import Variable
20
+ from causal_testing .specification .causal_dag import CausalDAG
20
21
21
22
logger = logging .getLogger (__name__ )
22
23
@@ -122,6 +123,14 @@ def get_terms_from_formula(self):
122
123
covariates = rhs_terms .remove (self .treatment )
123
124
return outcome , self .treatment , covariates
124
125
126
+ def validate_formula (self , causal_dag : CausalDAG ):
127
+ outcome , treatment , covariates = causal_dag .get_terms_from_formula ()
128
+ proper_backdoor_graph = causal_dag .get_proper_backdoor_graph (treatments = [treatment ], outcomes = [outcome ])
129
+ return CausalDAG .constructive_backdoor_criterion (proper_backdoor_graph = proper_backdoor_graph ,
130
+ treatments = [treatment ], outcomes = [outcome ],
131
+ covariates = list (covariates ))
132
+
133
+
125
134
class LogisticRegressionEstimator (Estimator ):
126
135
"""A Logistic Regression Estimator is a parametric estimator which restricts the variables in the data to a linear
127
136
combination of parameters and functions of the variables (note these functions need not be linear). It is designed
You can’t perform that action at this time.
0 commit comments