@@ -98,14 +98,6 @@ def execute_test(self, estimator: type(Estimator), data_collector: Observational
98
98
99
99
logger .info ("treatments: %s" , treatments )
100
100
logger .info ("outcomes: %s" , outcome_variable )
101
- minimal_adjustment_set = causal_specification .causal_dag .identification (BaseTestCase (treatment_variable , outcome_variable ))
102
- minimal_adjustment_set = minimal_adjustment_set - set (treatment_variable .name )
103
- minimal_adjustment_set = minimal_adjustment_set - set (outcome_variable .name )
104
-
105
- variables_for_positivity = list (minimal_adjustment_set ) + [treatment_variable .name ] + [outcome_variable .name ]
106
-
107
- if self ._check_positivity_violation (variables_for_positivity , causal_specification .scenario , data_collector .data ):
108
- raise ValueError ("POSITIVITY VIOLATION -- Cannot proceed." )
109
101
110
102
causal_test_result = self ._return_causal_test_results (estimator )
111
103
return causal_test_result
@@ -130,32 +122,6 @@ def _return_causal_test_results(self, estimator):
130
122
131
123
return causal_test_result
132
124
133
- def _check_positivity_violation (self , variables_list , scenario : Scenario , df ):
134
- """Check whether the dataframe has a positivity violation relative to the specified variables list.
135
-
136
- A positivity violation occurs when there is a stratum of the dataframe which does not have any data. Put simply,
137
- if we split the dataframe into covariate sub-groups, each sub-group must contain both a treated and untreated
138
- individual. If a positivity violation occurs, causal inference is still possible using a properly specified
139
- parametric estimator. Therefore, we should not throw an exception upon violation but raise a warning instead.
140
-
141
- :param variables_list: The list of variables for which positivity must be satisfied.
142
- :return: True if positivity is violated, False otherwise.
143
- """
144
- if not (set (variables_list ) - {x .name for x in scenario .hidden_variables ()}).issubset (
145
- df .columns
146
- ):
147
- missing_variables = set (variables_list ) - set (df .columns )
148
- logger .warning (
149
- "Positivity violation: missing data for variables %s.\n "
150
- "Causal inference is only valid if a well-specified parametric model is used.\n "
151
- "Alternatively, consider restricting analysis to executions without the variables:"
152
- "." ,
153
- missing_variables ,
154
- )
155
- return True
156
-
157
- return False
158
-
159
125
def __str__ (self ):
160
126
treatment_config = {self .treatment_variable .name : self .treatment_value }
161
127
control_config = {self .treatment_variable .name : self .control_value }
@@ -164,3 +130,4 @@ def __str__(self):
164
130
f"Running { treatment_config } instead of { control_config } should cause the following "
165
131
f"changes to { outcome_variable } : { self .expected_causal_effect } ."
166
132
)
133
+
0 commit comments