Bootstrapped Percentile Bootstrap
The `bootstrapped` library provides implementations of percentile-based bootstrap methods for statistical analysis, primarily focusing on confidence intervals. It is currently at version 0.0.2, with its last release in September 2017, indicating a stalled or abandoned release cadence.
Common errors
-
ModuleNotFoundError: No module named 'bootstrapped'
cause The 'bootstrapped' package is not installed in the current Python environment.fixpip install bootstrapped -
TypeError: 'numpy.float64' object cannot be interpreted as an integer
cause This error or similar type-related issues can occur due to strict type checking or implicit conversion changes in newer Python or NumPy versions, conflicting with the old code base of 'bootstrapped'.fixThis often indicates a fundamental incompatibility with modern Python environments. It's recommended to try to replicate the original environment (e.g., Python 3.6, NumPy 1.12.x) or, preferably, migrate to `scipy.stats.bootstrap` or another actively maintained library. -
AttributeError: module 'bootstrapped' has no attribute 'bootstrap'
cause The `bootstrap` function is located within the `bootstrapped.bootstrap` submodule, not directly in the top-level `bootstrapped` package.fixUse `import bootstrapped.bootstrap as bs` and then call `bs.bootstrap(...)`.
Warnings
- breaking This library has not been updated since September 2017. It is highly likely to have compatibility issues with newer versions of Python (e.g., Python 3.8+), NumPy, or SciPy, and may contain unpatched security vulnerabilities.
- gotcha The `bootstrapped` package's `num_iterations` parameter refers to the number of bootstrap resamples, not actual iterations of an algorithm. A higher number typically yields more stable results for confidence intervals.
- gotcha The library is maintained under `facebookincubator`, which implies it was an experimental project and not necessarily a fully supported product. This further emphasizes its abandoned status and lack of official support.
Install
-
pip install bootstrapped
Imports
- bootstrap
import bootstrapped as bs; bs.bootstrap(...)
import bootstrapped.bootstrap as bs
- stats_functions
from bootstrapped import stats_functions
import bootstrapped.stats_functions as sf
Quickstart
import numpy as np
import bootstrapped.bootstrap as bs
import bootstrapped.stats_functions as sf
# Generate some data
data = np.random.normal(loc=100, scale=10, size=100)
# Calculate 95% confidence interval for the mean
lower_bound, upper_bound = bs.bootstrap(data, stat_func=sf.mean, alpha=0.05, num_iterations=1000)
print(f"Mean 95% CI: [{lower_bound:.2f}, {upper_bound:.2f}]")