Resampling-based inference in Python
Project description
Resampling-based inference in Python based on data resampling and permutation.
This package was created by Daniel Saxton and is now maintained by Hans Dembinski.
Features
Bootstrap resampling: ordinary or balanced with optional stratification
Extended bootstrap resampling: also varies sample size
Parametric resampling: Gaussian, Poisson, gamma, etc.)
Jackknife estimates of bias and variance of any estimator
Compute bootstrap confidence intervals (percentile or BCa) for any estimator
Permutation-based variants of traditional statistical tests (USP test of independence and others)
Tools for working with empirical distributions (CDF, quantile, etc.)
Example
We bootstrap the uncertainty of the arithmetic mean, an estimator for the expectation. In this case, we know the formula to compute this uncertainty and can compare it to the bootstrap result.
from resample.bootstrap import variance
import numpy as np
d = [1, 2, 6, 3, 5]
stdev_of_mean = variance(np.mean, d) ** 0.5
print(f"bootstrap {stdev_of_mean:.2f} exact {np.std(d) / len(d) ** 0.5:.2f}")
# bootstrap 0.82 exact 0.83
The amazing thing is that the bootstrap works as well for arbitrarily complex estimators.
Installation
You can install with pip.
pip install resample
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file resample-1.6.0.tar.gz
.
File metadata
- Download URL: resample-1.6.0.tar.gz
- Upload date:
- Size: 388.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.11.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ff66c9142cae46317fb8b58e7acf59c963721e4f2a1505830cce99b57e78f091 |
|
MD5 | 76973a2cebce68d1f25943991dfb0631 |
|
BLAKE2b-256 | 1ad67ebbfec2f5f923affe72690bc204078e6dfe47bd258beb5cc1c59d5e2c0f |
File details
Details for the file resample-1.6.0-py3-none-any.whl
.
File metadata
- Download URL: resample-1.6.0-py3-none-any.whl
- Upload date:
- Size: 19.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.11.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3354a29fced083ed03fad6b077790bc2da1978de8666b56663aa0811584c0a2f |
|
MD5 | dbcfe24e313b4170da03f1f62cbaf012 |
|
BLAKE2b-256 | 337a690f85fb705855b2acc10ce266a62d7e77e7f872f895a5985caac58ad1a6 |