Skip to main content

A Python library for calculating p-values using Monte Carlo sampling

Project description


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

TLDR;

Installation

The simplest way to install this package is directly from PyPI using pip

pip install mcpt

Usage

mcpt contains two main functions: mcpt.permutation_test and mcpt.correlation_permutation_test.

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)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mcpt-0.1.8.tar.gz (4.8 kB view details)

Uploaded Source

Built Distribution

mcpt-0.1.8-py3-none-any.whl (6.9 kB view details)

Uploaded Python 3

File details

Details for the file mcpt-0.1.8.tar.gz.

File metadata

  • Download URL: mcpt-0.1.8.tar.gz
  • Upload date:
  • Size: 4.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/3.7.1

File hashes

Hashes for mcpt-0.1.8.tar.gz
Algorithm Hash digest
SHA256 f1d63c6149d9cc7854b3a1b9bfcac4e9febe88c7ba2e176ad3751f298511b3c8
MD5 965903e89ee008af03600dd9eef3299a
BLAKE2b-256 09689be6a5616a67ddd6639e10d6b9680aa68a17f5f7bb7c73e522f1c9b8484a

See more details on using hashes here.

File details

Details for the file mcpt-0.1.8-py3-none-any.whl.

File metadata

  • Download URL: mcpt-0.1.8-py3-none-any.whl
  • Upload date:
  • Size: 6.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/3.7.1

File hashes

Hashes for mcpt-0.1.8-py3-none-any.whl
Algorithm Hash digest
SHA256 c1605bf73a2587cda1de6a9cdc6b17333bc7119f0181d860c1507414b8dfe265
MD5 9bea3dbc512edf57ebcb48ccff6eb531
BLAKE2b-256 173cf90d0af987d5298f7075a6b15548f59afb31cbf32338cd73d4200d5563c5

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page