0

May I ask does anyone know if there is a library for calculating t-statistics based on bootstrapped standard error instead of regular standard error in python? I have searched for so long but it seems there isn't anyone... Thank you in advance.

1 Answers1

0

Bootstrapping can be performed in Python using the bootstrapped package (GitHub, PyPI):

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)
PiCTo
  • 924
  • 1
  • 11
  • 23