Skip to content

Commit

Permalink
fix covariates
Browse files Browse the repository at this point in the history
  • Loading branch information
sdaza committed Jan 1, 2025
1 parent e67d4e8 commit 3c4efdd
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions experiment_utils/experiment_analyzer.py
Original file line number Diff line number Diff line change
Expand Up @@ -397,6 +397,7 @@ def get_effects(self, min_binary_count: int = 100, adjustment: Optional[str] = N

# create adjustment label
relevant_covariates = set(self.final_covariates) & set(self.regression_covariates)
standardized_covariates = [f"z_{cov}" for cov in relevant_covariates]

adjustment_labels = {
'IPW': 'IPW',
Expand All @@ -414,9 +415,10 @@ def get_effects(self, min_binary_count: int = 100, adjustment: Optional[str] = N

for outcome in self.outcomes:
if adjustment == 'IPW':
output = models[adjustment](data=temp_pd, outcome_variable=outcome, weight_column='weights')
output = models[adjustment](data=temp_pd, outcome_variable=outcome, covariates=standardized_covariates,
weight_column='weights')
else:
output = models[adjustment](data=temp_pd, outcome_variable=outcome)
output = models[adjustment](data=temp_pd, outcome_variable=outcome, covariates=standardized_covariates)
output['adjustment'] = adjustment_label
if adjustment == 'IPW':
output['balance'] = np.round(adjusted_balance['balance_flag'].mean(), 2)
Expand Down

0 comments on commit 3c4efdd

Please sign in to comment.