Implementations of the percentile based bootstrap
Project description
bootstrapped is a Python library that allows you to build confidence intervals from data. This is useful in a variety of contexts - including during ad-hoc a/b test analysis.
Motivating Example - A/B Test
Imagine we own a website and think changing the color of a ‘subscribe’ button will improve signups. One method to measure the improvement is to conduct an A/B test where we show 50% of people the old version and 50% of the people the new version. We can use the bootstrap to understand how much the button color improves responses and give us the error bars associated with the test - this will give us lower and upper bounds on how good we should expect the change to be!
The Gist - Mean of a Sample
Given a sample of data - we can generate a bunch of new samples by ‘re-sampling’ from what we have gathered. We calculate the mean for each generated sample. We can use the means from the generated samples to understand the variation in the larger population and can construct error bars for the true mean.
bootstrapped - Benefits
Efficient computation of confidence intervals
Functions to handle single populations and a/b tests
Functions to understand statistical power
Multithreaded support to speed-up bootstrap computations
Dense and sparse array support
Example Usage
import numpy as np
import bootstrapped.bootstrap as bs
import bootstrapped.stats_functions as bs_stats
mean = 100
stdev = 10
population = np.random.normal(loc=mean, scale=stdev, size=50000)
# take 1k 'samples' from the larger population
samples = population[:1000]
print(bs.bootstrap(samples, stat_func=bs_stats.mean))
>> 100.08 (99.46, 100.69)
print(bs.bootstrap(samples, stat_func=bs_stats.std))
>> 9.49 (9.92, 10.36)
Extended Examples
More notebooks can be found in the examples/ directory
Requirements
bootstrapped requires numpy. The power analysis functions require matplotlib and pandas.
Installation
pip install bootstrapped
How bootstrapped works
bootstrapped provides pivotal (aka empirical) based confidence intervals based on bootstrap re-sampling with replacement. The percentile method is also available.
For more information please see:
Bootstrap confidence intervals (good intro)
See the CONTRIBUTING file for how to help out.
Contributors
Spencer Beecher, Don van der Drift, David Martin, Lindsay Vass, Sergey Goder, Benedict Lim, and Matt Langner.
Special thanks to Eytan Bakshy.
License
bootstrapped is BSD-licensed. We also provide an additional patent grant.
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
File details
Details for the file bootstrapped-0.0.2.tar.gz
.
File metadata
- Download URL: bootstrapped-0.0.2.tar.gz
- Upload date:
- Size: 11.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: Python-urllib/3.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7d2cc81642c86dd3426518e1aa3e828f227ffb423fabaeaf4acc7e268d02f9e9 |
|
MD5 | 9351d190a2a5b23cf893d2dc679df624 |
|
BLAKE2b-256 | b2f7beb22809fdc4781ae73d12c78e2cf14ae533ad9eec2fb84ec22e5b0b660c |