Search code examples
pythonstatistics-bootstrap

boot() equivalent in python?


Is there an equivalent of boot and boot.ci in python? In R I would do

library(boot)
result <- boot(data,bootfun,10000)
boot.ci(result)

Solution

  • There's now also a bootstrap function in the scipy.stats module scipy.stats.bootstrap

    from scipy import stats
    
    results = stats.bootstrap(data, bootfun, n_resamples=10000)
    ci = results.confidence_interval
    

    The confidence interval is returned as a named tuple of low, high values.