假設檢定與信賴區間
本章一開始就提到,假設檢定與信賴區間之間有緊密的關聯。前者用來檢視你對世界的某個特定假設是否與你的資料相容;後者則不設定假設,而是透過加減誤差範圍,量化你對點估計的不確定性。
在這個練習中,你要藉由對比例差 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
___