@@ -79,15 +79,23 @@ def _return_causal_test_results(self, estimator) -> CausalTestResult:
79
79
if not hasattr (estimator , f"estimate_{ self .estimate_type } " ):
80
80
raise AttributeError (f"{ estimator .__class__ } has no { self .estimate_type } method." )
81
81
estimate_effect = getattr (estimator , f"estimate_{ self .estimate_type } " )
82
- effect , confidence_intervals = estimate_effect (** self .estimate_params )
83
- causal_test_result = CausalTestResult (
84
- estimator = estimator ,
85
- test_value = TestValue (self .estimate_type , effect ),
86
- effect_modifier_configuration = self .effect_modifier_configuration ,
87
- confidence_intervals = confidence_intervals ,
88
- )
89
-
90
- return causal_test_result
82
+ try :
83
+ effect , confidence_intervals = estimate_effect (** self .estimate_params )
84
+ causal_test_result = CausalTestResult (
85
+ estimator = estimator ,
86
+ test_value = TestValue (self .estimate_type , effect ),
87
+ effect_modifier_configuration = self .effect_modifier_configuration ,
88
+ confidence_intervals = confidence_intervals ,
89
+ )
90
+ except np .linalg .LinAlgError :
91
+ causal_test_result = CausalTestResult (
92
+ estimator = estimator ,
93
+ test_value = TestValue (self .estimate_type , "LinAlgError" ),
94
+ effect_modifier_configuration = self .effect_modifier_configuration ,
95
+ confidence_intervals = None ,
96
+ )
97
+ finally :
98
+ return causal_test_result
91
99
92
100
def __str__ (self ):
93
101
treatment_config = {self .treatment_variable .name : self .treatment_value }
0 commit comments