Skip to content

Parellel implementation of bootstrap confidence intervals and permutation tests.

Notifications You must be signed in to change notification settings

vitillo/montecarlino

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 

Repository files navigation

Montecarlino

Parellel implementation of bootstrap confidence intervals and permutation tests.

Installation

pip install montecarlino

Examples

Let's compute the 95% confidence interval for the median of a set of values:

from montecarlino import bootstrap_interval

x1 = np.array([0.80, 0.83, 1.89, 1.04, 1.45, 1.38, 1.91, 1.64, 0.73, 1.46])
bootstrap_interval(np.median, x1)

Now let's compare the medians of two samples, i.e. what's the p-value of the difference of the medians assuming there is no difference?

from montecarlino import grouped_permutation_test

def _median_difference(x, y):
    return np.median(x) - np.median(y)

x1 = np.array([0.80, 0.83, 1.89, 1.04, 1.45, 1.38, 1.91, 1.64, 0.73, 1.46])
x2 = np.array([1.15, 0.88, 0.90, 0.74, 1.21])
grouped_permutation_test(median_difference, [x1, x2])

About

Parellel implementation of bootstrap confidence intervals and permutation tests.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages