A Python library for calculating p-values using Monte Carlo sampling
mcpt: Monte Carlo permutation tests for Python
mcpt is a Python 3 library for calculating p-values through Monte Carlo permutation tests, providing an intuitive, simple, and highly customisable interface to determining statistical significance.
To get started, we recommend you read through Installation, Quickstart, and Functions sections of our read the docs documentation. Also check out the FAQ, which we update regularly. If you have concerns about the software, or feel that there is something that should be more explicit, then we’d love to hear from you – please open an issue on Github and we’ll get back in touch ASAP.
If you use
mcpt in your research, please support us by citing the initial release:
David J. Skelton. (2019, September 5). mcpt: Monte Carlo permutation tests for Python (Version 0). Zenodo. http://doi.org/10.5281/zenodo.3387528
The simplest way to install this package is directly from PyPI using pip
pip install mcpt
mcpt contains two main functions:
Below is an example of the
mcpt.permutation_test - for more info, please see the documentation here
>> import mcpt >> x = [10, 9, 11] >> y = [12, 11, 13] >> f = "mean" >> n = 100_000 >> side = "lower" >> result = mcpt.permutation_test(x, y, f, side, n=n) >> print(result) Result(lower=0.09815650454064283, upper=0.10305649415095638, confidence=0.99)
Below is an example of
mcpt.correlation_permutation_test - for more information, please see the documentation here
>> import mcpt >> x = [-2.31, 1.06, 0.76, 1.38, -0.26, 1.29, -1.31, 0.41, -0.67, -0.58] >> y = [-1.08, 1.03, 0.90, 0.24, -0.24, 0.76, -0.57, -0.05, -1.28, 1.04] >> side = "both" >> f = "pearsonr" >> result = mcpt.correlation_permutation_test(x, y, f=f, side=side) >> print(result) Result(lower=0.021282451892029475, upper=0.029347445354757373, confidence=0.99)
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
|Filename, size||File type||Python version||Upload date||Hashes|
|Filename, size mcpt-0.1.8-py3-none-any.whl (6.9 kB)||File type Wheel||Python version py3||Upload date||Hashes View hashes|
|Filename, size mcpt-0.1.8.tar.gz (4.8 kB)||File type Source||Python version None||Upload date||Hashes View hashes|