首页 > 解决方案 > 从自举标准误差计算的 T 统计量

问题描述

请问有谁知道是否有一个库可以根据引导标准错误而不是python中的常规标准错误来计算t统计?我已经搜索了很长时间,但似乎没有人......提前谢谢你。

标签: pythont-teststandard-error

解决方案


可以使用bootstrapped包(GitHubPyPI )在 Python 中执行引导

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)

推荐阅读