File tree Expand file tree Collapse file tree 1 file changed +0
-20
lines changed Expand file tree Collapse file tree 1 file changed +0
-20
lines changed Original file line number Diff line number Diff line change @@ -129,26 +129,6 @@ def _run_logistic_regression(self, data) -> RegressionResultsWrapper:
129
129
130
130
:return: The model after fitting to data.
131
131
"""
132
- # 1. Reduce dataframe to contain only the necessary columns
133
- reduced_df = data .copy ()
134
- necessary_cols = [self .treatment ] + list (self .adjustment_set ) + [self .outcome ]
135
- missing_rows = reduced_df [necessary_cols ].isnull ().any (axis = 1 )
136
- reduced_df = reduced_df [~ missing_rows ]
137
- reduced_df = reduced_df .sort_values ([self .treatment ])
138
- logger .debug (reduced_df [necessary_cols ])
139
-
140
- # 2. Add intercept
141
- reduced_df ["Intercept" ] = 1 # self.intercept
142
-
143
- # 3. Estimate the unit difference in outcome caused by unit difference in treatment
144
- cols = [self .treatment ]
145
- cols += [x for x in self .adjustment_set if x not in cols ]
146
- treatment_and_adjustments_cols = reduced_df [cols + ["Intercept" ]]
147
- for col in treatment_and_adjustments_cols :
148
- if str (treatment_and_adjustments_cols .dtypes [col ]) == "object" :
149
- treatment_and_adjustments_cols = pd .get_dummies (
150
- treatment_and_adjustments_cols , columns = [col ], drop_first = True
151
- )
152
132
model = smf .logit (formula = self .formula , data = data ).fit (disp = 0 )
153
133
return model
154
134
You can’t perform that action at this time.
0 commit comments