File tree 1 file changed +5
-3
lines changed
1 file changed +5
-3
lines changed Original file line number Diff line number Diff line change @@ -350,9 +350,11 @@ def _estimate_confidence_intervals_with_bootstrap(
350
350
bootstrap_variations = [bootstrap_estimate - estimate_value for bootstrap_estimate in bootstrap_estimates ]
351
351
sorted_bootstrap_variations = np .sort (bootstrap_variations )
352
352
353
- # Now we take the (1- p)th and the (p)th variations, where p is the chosen confidence level
354
- upper_bound_index = int ((1 - confidence_level ) * len (sorted_bootstrap_variations ))
355
- lower_bound_index = int (confidence_level * len (sorted_bootstrap_variations ))
353
+ # Now we take the (1-p)/2 th and the 1-(1-p)/2 th variations, where p is the chosen confidence level
354
+ left_fraction = (1 - confidence_level ) / 2
355
+ right_fraction = 1 - left_fraction
356
+ upper_bound_index = int (left_fraction * len (sorted_bootstrap_variations ))
357
+ lower_bound_index = int (right_fraction * len (sorted_bootstrap_variations ))
356
358
357
359
# Get the lower and upper bounds by subtracting the variations from the estimate
358
360
lower_bound = estimate_value - sorted_bootstrap_variations [lower_bound_index ]
You can’t perform that action at this time.
0 commit comments