开始使用免费开始使用

Bootstrapping vs. normality

You've seen the results of a bootstrap confidence interval for Pearson's R. But what about common situations like making a confidence interval for a mean? Why would you use a bootstrap confidence interval over a "normal" confidence interval coming from stats.norm?

A DataFrame showing investments from venture capital firms (investments_df) has been loaded for you, as have the packages pandas as pd, NumPy as np, and stats from SciPy.

本练习是课程的一部分

Foundations of Inference in Python

查看课程

交互式实操练习

通过完成这段示例代码来试试这个练习。

# Select just the companies in the Analytics market
analytics_df = ____[____ == 'Analytics']

# Confidence interval using the stats.norm function
norm_ci = stats.norm.____(alpha=____,
                         loc=____,
                         scale=____.std() / np.___(____))

# Construct a bootstrapped confidence interval
bootstrap_ci = stats.bootstrap(data=(____, ),
                              statistic=np.____)

print('Normal CI:', norm_ci)
print('Bootstrap CI:', bootstrap_ci.confidence_interval)
编辑并运行代码