Skip to content

Commit cdbaf1c

Browse files
authored
Update example_vaccine.py
modified causal test case and linear regression estimator to fit class attributes
1 parent eb96ea7 commit cdbaf1c

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

examples/covasim_/vaccinating_elderly/example_vaccine.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
# -*- coding: utf-8 -*-
21
import os
32
import logging
43
import pandas as pd
@@ -70,23 +69,22 @@ def setup_test_case(verbose: bool = False):
7069
for outcome_variable, expected_effect in expected_outcome_effects.items():
7170
base_test_case = BaseTestCase(treatment_variable=vaccine, outcome_variable=outcome_variable)
7271
causal_test_case = CausalTestCase(
73-
base_test_case=base_test_case, expected_causal_effect=expected_effect, control_value=0, treatment_value=1
72+
base_test_case=base_test_case, expected_causal_effect=expected_effect,
7473
)
7574
# 7. Obtain the minimal adjustment set for the causal test case from the causal DAG
7675
minimal_adjustment_set = causal_dag.identification(base_test_case)
7776

7877
# 8. Build statistical model using the Linear Regression estimator
7978
linear_regression_estimator = LinearRegressionEstimator(
80-
treatment=vaccine.name,
79+
base_test_case=base_test_case,
8180
treatment_value=1,
8281
control_value=0,
8382
adjustment_set=minimal_adjustment_set,
84-
outcome=outcome_variable.name,
8583
df=obs_df,
8684
)
8785

8886
# 9. Execute test and save results in dict
89-
causal_test_result = causal_test_case.execute_test(linear_regression_estimator, obs_df)
87+
causal_test_result = causal_test_case.execute_test(linear_regression_estimator)
9088

9189
if verbose:
9290
logging.info("Causation:\n%s", causal_test_result)

0 commit comments

Comments
 (0)