1
1
# -*- coding: utf-8 -*-
2
2
import os
3
3
import logging
4
- import warnings
5
4
import pandas as pd
6
5
from causal_testing .specification .causal_dag import CausalDAG
7
6
from causal_testing .specification .scenario import Scenario
13
12
from causal_testing .testing .estimators import LinearRegressionEstimator
14
13
from causal_testing .testing .base_test_case import BaseTestCase
15
14
16
- warnings .filterwarnings ("ignore" , message = ".*The 'nopython' keyword.*" ) # Supress the numba warning in covasim
17
15
18
16
logger = logging .getLogger (__name__ )
19
17
logging .basicConfig (level = logging .DEBUG , format = "%(message)s" )
@@ -28,7 +26,7 @@ def setup_test_case(verbose: bool = False):
28
26
:return results_dict: A dictionary containing ATE, 95% CIs, and Test Pass/Fail
29
27
"""
30
28
31
- # 1. Create causal dag
29
+ # 1. Read in the Causal DAG
32
30
causal_dag = CausalDAG (f"{ ROOT } /dag.dot" )
33
31
34
32
# 2. Create variables
@@ -81,6 +79,7 @@ def setup_test_case(verbose: bool = False):
81
79
# 7. Obtain the minimal adjustment set for the causal test case from the causal DAG
82
80
minimal_adjustment_set = causal_dag .identification (base_test_case )
83
81
82
+ # 8. Build statistical model using the Linear Regression estimator
84
83
linear_regression_estimator = LinearRegressionEstimator (
85
84
treatment = vaccine .name ,
86
85
treatment_value = 1 ,
@@ -90,6 +89,7 @@ def setup_test_case(verbose: bool = False):
90
89
df = obs_df ,
91
90
)
92
91
92
+ # 9. Execute test and save results in dict
93
93
causal_test_result = causal_test_case .execute_test (linear_regression_estimator , data_collector )
94
94
95
95
if verbose :
@@ -107,6 +107,7 @@ def setup_test_case(verbose: bool = False):
107
107
108
108
109
109
if __name__ == "__main__" :
110
+
110
111
test_results = setup_test_case (verbose = True )
111
112
112
113
logging .info ("%s" , test_results )
0 commit comments