Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/esheldon/bootstrap
python code to do bootstraps, wrapping fast C code
https://github.com/esheldon/bootstrap
Last synced: 2 days ago
JSON representation
python code to do bootstraps, wrapping fast C code
- Host: GitHub
- URL: https://github.com/esheldon/bootstrap
- Owner: esheldon
- Created: 2015-09-26T13:21:36.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2015-09-26T20:38:00.000Z (about 9 years ago)
- Last Synced: 2024-10-19T19:43:35.279Z (19 days ago)
- Language: C
- Size: 156 KB
- Stars: 0
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# bootstrap
python code to do bootstraps, wrapping fast C codeWorking in C we can avoid large memory allocations for the bootstrap subsets
```python
from bootstrap import bootstrap, Bootstrapmean = array( [2.5, -5.6] )
cov = array([ [1.5, 0.2],
[0.4, 2.7] ])# create correlated data using cholesky sampling
np = 10000
rdata = cholesky_sample(mean,cov, np)nboot=1000
ecov = numpy.cov(rdata.T)
print('expected mean:',mean)
print('expected cov: ')
print(ecov/np)res=bootstrap(rdata, nboot)
print('boot mean:',res['mean'])
print('boot cov:')
print(res['cov'])# the result is a dict with the following entries
# A dictionary with entries
# 'mean': mean over the sample
# 'cov': covariance over the sample
# 'err': sqrt of the diagonal of the covariance matrix
# 'seed': the used seed
# 'nboot': number of bootstrap realizations
# You can also use an objectb=Bootstrap(data)
b.go(nboot)
res = b.get_result()```