Skip to content

Commit 7856456

Browse files
authored
Merge pull request #214 from CITCOM-project/somers/cleanup
Removing unnecessary code
2 parents c583759 + cee6b14 commit 7856456

File tree

1 file changed

+0
-20
lines changed

1 file changed

+0
-20
lines changed

causal_testing/testing/estimators.py

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -129,26 +129,6 @@ def _run_logistic_regression(self, data) -> RegressionResultsWrapper:
129129
130130
:return: The model after fitting to data.
131131
"""
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-
)
152132
model = smf.logit(formula=self.formula, data=data).fit(disp=0)
153133
return model
154134

0 commit comments

Comments
 (0)