@@ -1339,14 +1339,15 @@ def plot_poisson_consistency_test(eval_results, normalize=False, one_sided_lower
13391339 capsize = plot_args .get ('capsize' , 4 )
13401340 hbars = plot_args .get ('hbars' , True )
13411341 tight_layout = plot_args .get ('tight_layout' , True )
1342+ percentile = plot_args .get ('percentile' , 95 )
13421343
13431344 fig , ax = pyplot .subplots (figsize = figsize )
13441345 xlims = []
13451346 for index , res in enumerate (results ):
13461347 # handle analytical distributions first, they are all in the form ['name', parameters].
13471348 if res .test_distribution [0 ] == 'poisson' :
1348- plow = scipy .stats .poisson .ppf (0.025 , res .test_distribution [1 ])
1349- phigh = scipy .stats .poisson .ppf (0.975 , res .test_distribution [1 ])
1349+ plow = scipy .stats .poisson .ppf (( 1 - percentile / 100. ) / 2. , res .test_distribution [1 ])
1350+ phigh = scipy .stats .poisson .ppf (1 - ( 1 - percentile / 100. ) / 2. , res .test_distribution [1 ])
13501351 observed_statistic = res .observed_statistic
13511352 # empirical distributions
13521353 else :
@@ -1358,11 +1359,11 @@ def plot_poisson_consistency_test(eval_results, normalize=False, one_sided_lower
13581359 observed_statistic = res .observed_statistic
13591360 # compute distribution depending on type of test
13601361 if one_sided_lower :
1361- plow = numpy .percentile (test_distribution , 5 )
1362+ plow = numpy .percentile (test_distribution , 100 - percentile )
13621363 phigh = numpy .percentile (test_distribution , 100 )
13631364 else :
1364- plow = numpy .percentile (test_distribution , 2.5 )
1365- phigh = numpy .percentile (test_distribution , 97.5 )
1365+ plow = numpy .percentile (test_distribution , ( 100 - percentile ) / 2. )
1366+ phigh = numpy .percentile (test_distribution , 100 - ( 100 - percentile ) / 2. )
13661367
13671368 if not numpy .isinf (observed_statistic ): # Check if test result does not diverges
13681369 low = observed_statistic - plow
0 commit comments