Skip to main content

Randomisation-based inference in Python

Project description

https://img.shields.io/pypi/v/resample.svg https://github.com/resample-project/resample/actions/workflows/test.yml/badge.svg https://coveralls.io/repos/github/resample-project/resample/badge.svg https://readthedocs.org/projects/resample/badge/?version=stable https://img.shields.io/pypi/l/resample

Link to full documentation

Randomisation-based inference in Python based on data resampling and permutation.

Features

  • Bootstrap samples (ordinary or balanced with optional stratification)

  • Support for parametric (Gaussian, Poisson, gamma, etc.) and extended bootstrapping (also varies sample size)

  • Compute bootstrap confidence intervals (percentile or BCa) for any estimator

  • Jackknife estimates of bias and variance of any estimator

  • Permutation-based variants of traditional statistical tests (USP test of independence and others)

  • Tools for working with empirical distributions (CDF, quantile, etc.)

  • Depends only on numpy and scipy

  • Optional code acceleration with numba

Example

# bootstrap uncertainty of arithmetic mean
from resample.bootstrap import variance
import numpy as np

d = [1, 2, 6, 3, 5]

print(f"bootstrap {variance(np.mean, d) ** 0.5:.2f} exact {(np.var(d) / len(d)) ** 0.5:.2f}")
# bootstrap 0.82 exact 0.83

Installation

You can install with pip, but you need a C compiler on the target machine.

pip install resample

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

resample-1.5.3.tar.gz (268.4 kB view details)

Uploaded Source

File details

Details for the file resample-1.5.3.tar.gz.

File metadata

  • Download URL: resample-1.5.3.tar.gz
  • Upload date:
  • Size: 268.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.11.1

File hashes

Hashes for resample-1.5.3.tar.gz
Algorithm Hash digest
SHA256 9b71fd86114eb7c9f7f9d0a5937070d61e46426c376a3cd0ccbbc691a8cab658
MD5 fe4fb24db3283f2049f8d508d524b6cc
BLAKE2b-256 10db0f45d957dcfd838273baf9d898bd00578a72c9957b14581396363c78945c

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