@@ -382,8 +382,9 @@ def estimate_ate(self) -> tuple[float, list[float, float], float]:
382
382
383
383
# Perform a t-test to compare the predicted outcome of the control and treated individual (ATE)
384
384
t_test_results = model .t_test (individuals .loc ["treated" ] - individuals .loc ["control" ])
385
- ate = t_test_results .effect [0 ]
385
+ ate = pd . Series ( t_test_results .effect [0 ])
386
386
confidence_intervals = list (t_test_results .conf_int (alpha = self .alpha ).flatten ())
387
+ confidence_intervals = (pd .Series (interval ) for interval in confidence_intervals )
387
388
return ate , confidence_intervals
388
389
389
390
def estimate_control_treatment (self , adjustment_config : dict = None ) -> tuple [pd .Series , pd .Series ]:
@@ -421,8 +422,9 @@ def estimate_risk_ratio(self, adjustment_config: dict = None) -> tuple[float, li
421
422
if adjustment_config is None :
422
423
adjustment_config = {}
423
424
control_outcome , treatment_outcome = self .estimate_control_treatment (adjustment_config = adjustment_config )
424
- ci_low = treatment_outcome ["mean_ci_lower" ] / control_outcome ["mean_ci_upper" ]
425
- ci_high = treatment_outcome ["mean_ci_upper" ] / control_outcome ["mean_ci_lower" ]
425
+ ci_low = pd .Series (treatment_outcome ["mean_ci_lower" ] / control_outcome ["mean_ci_upper" ])
426
+ ci_high = pd .Series (treatment_outcome ["mean_ci_upper" ] / control_outcome ["mean_ci_lower" ])
427
+ return pd .Series (treatment_outcome ["mean" ] / control_outcome ["mean" ]), [ci_low , ci_high ]
426
428
427
429
return (treatment_outcome ["mean" ] / control_outcome ["mean" ]), [ci_low , ci_high ]
428
430
@@ -437,10 +439,9 @@ def estimate_ate_calculated(self, adjustment_config: dict = None) -> tuple[float
437
439
if adjustment_config is None :
438
440
adjustment_config = {}
439
441
control_outcome , treatment_outcome = self .estimate_control_treatment (adjustment_config = adjustment_config )
440
- ci_low = treatment_outcome ["mean_ci_lower" ] - control_outcome ["mean_ci_upper" ]
441
- ci_high = treatment_outcome ["mean_ci_upper" ] - control_outcome ["mean_ci_lower" ]
442
-
443
- return (treatment_outcome ["mean" ] - control_outcome ["mean" ]), [ci_low , ci_high ]
442
+ ci_low = pd .Series (treatment_outcome ["mean_ci_lower" ] - control_outcome ["mean_ci_upper" ])
443
+ ci_high = pd .Series (treatment_outcome ["mean_ci_upper" ] - control_outcome ["mean_ci_lower" ])
444
+ return pd .Series (treatment_outcome ["mean" ] - control_outcome ["mean" ]), [ci_low , ci_high ]
444
445
445
446
def _run_linear_regression (self ) -> RegressionResultsWrapper :
446
447
"""Run linear regression of the treatment and adjustment set against the outcome and return the model.
0 commit comments