R로 배우는 범주형 데이터 추론
Andrew Bray
Assistant Professor of Statistics at Reed College
SE
0.009998905
SE_small_n
0.03809731
SE_low_p
0.00547912
표준오차는 다음일 때 증가합니다
n이 작을 때p가 0.5에 가까울 때

일명 "종 모양 곡선".
만약
n이 크다면그러면

$$\sqrt{\frac{ \hat{p} \times (1 - \hat{p})}{n}}$$
"관측치가 독립"인지 어떻게 확인하나요?
"n이 큽니다"는 무엇을 의미하나요?
p_hat <- gss2016 %>%
summarize(mean(happy == "HAPPY")) %>%
pull()
n <- nrow(gss2016)
c(n * p_hat, n * (1 - p_hat))
116 35
SE_approx <- sqrt(p_hat * (1 - p_hat) / n)
SE_approx
0.03418468
boot <- gss2016 %>%
specify(response = happy, success = "HAPPY") %>%
generate(reps = 500, type = "bootstrap") %>%
calculate(stat = "prop")
SE_boot <- boot %>%
summarize(sd(stat)) %>%
pull()
SE_boot
0.03176741
ggplot(boot, aes(x = stat)) +
geom_density()

ggplot(boot, aes(x = stat)) +
geom_density() +
stat_function(fun = dnorm,
color = "purple",
args =
list(mean = p_hat,
sd = SE_approx))

ggplot(boot, aes(x = stat)) +
geom_density() +
stat_function(fun = dnorm,
color = "purple",
args =
list(mean = p_hat,
sd = SE_approx))

R로 배우는 범주형 데이터 추론