假设检验与置信区间
正如本章一开始所提到的,假设检验与置信区间有着紧密联系。前者用于检验关于世界的某个特定假设是否与您的数据相一致。后者不涉及假设,它只是通过加减误差范围来量化您对点估计的不确定性。
在本练习中,您将通过围绕比例差 d_hat 构建置信区间来探索这种对偶关系。为帮助您开始,这里给出您用于构造原假设分布的代码:
# Reference code for null distribution
null <- gss2016 %>%
specify(cappun ~ sex, success = "FAVOR") %>%
hypothesize(null = "independence") %>%
generate(reps = 500, type = "permute") %>%
calculate(stat = "diff in props", order = c("FEMALE", "MALE"))`
本练习是课程的一部分
R 中的分类数据推断
交互式实操练习
通过完成这段示例代码来试试这个练习。
# Create the bootstrap distribution
___ <- gss2016 %>%
# Specify the variables and success
___ %>%
# Generate 500 bootstrap reps
___ %>%
# Calculate statistics
___