Skip to content

Commit ffb5712

Browse files
Re-add loop to add effect_modifiers to adjustment_set
1 parent 70526c6 commit ffb5712

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

causal_testing/testing/estimators.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -307,6 +307,9 @@ def __init__(
307307
terms = [treatment] + sorted(list(adjustment_set)) + sorted(list(effect_modifiers))
308308
self.formula = f"{outcome} ~ {'+'.join(terms)}"
309309

310+
for term in self.effect_modifiers:
311+
self.adjustment_set.add(term)
312+
310313
def add_modelling_assumptions(self):
311314
"""
312315
Add modelling assumptions to the estimator. This is a list of strings which list the modelling assumptions that
@@ -332,7 +335,7 @@ def estimate_coefficient(self) -> float:
332335
treatment = design_info.column_names[design_info.term_name_slices[self.treatment]]
333336
assert set(treatment).issubset(
334337
model.params.index.tolist()
335-
), f"{treatment} not in\n{' '+str(model.params.index).replace(newline, newline+' ')}"
338+
), f"{treatment} not in\n{' ' + str(model.params.index).replace(newline, newline + ' ')}"
336339
unit_effect = model.params[treatment] # Unit effect is the coefficient of the treatment
337340
[ci_low, ci_high] = self._get_confidence_intervals(model, treatment)
338341
if str(self.df.dtypes[self.treatment]) != "object":

0 commit comments

Comments
 (0)