From fbe99f87d2346f38d66ca8ba736f138cee47a2e1 Mon Sep 17 00:00:00 2001 From: Amit Sharma Date: Thu, 21 Dec 2023 21:27:40 +0530 Subject: [PATCH] fixed double counting in bootstrap conf interval Signed-off-by: Amit Sharma --- dowhy/causal_estimator.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dowhy/causal_estimator.py b/dowhy/causal_estimator.py index e5f818f7a7..18b7830d76 100755 --- a/dowhy/causal_estimator.py +++ b/dowhy/causal_estimator.py @@ -350,7 +350,7 @@ def _estimate_confidence_intervals_with_bootstrap( bootstrap_variations = [bootstrap_estimate - estimate_value for bootstrap_estimate in bootstrap_estimates] sorted_bootstrap_variations = np.sort(bootstrap_variations) - # Now we take the (1- p)th and the (p)th variations, where p is the chosen confidence level + # Now we take the (1-p)/2 th and the 1-(1-p)/2 th variations, where p is the chosen confidence level left_fraction = (1 - confidence_level)/2 right_fraction = 1 - left_fraction upper_bound_index = int(left_fraction * len(sorted_bootstrap_variations))