R로 하는 설문 데이터 분석
Kelly McConville
Assistant Professor of Statistics
4단계 설계를 사용하여 수집됩니다.
0단계: 미국을 지리 및 소수 집단 비율에 따라 층화합니다.
library(NHANES)
dim(NHANESraw)
20293 78
library(dplyr)
summarize(NHANESraw, N_hat = sum(WTMEC2YR))
# A tibble: 1 x 1
N_hat
<dbl>
1 608534400
NHANESraw <- mutate(NHANESraw, WTMEC4YR = WTMEC2YR / 2)
NHANES_design <- svydesign(data = NHANESraw, strata = ~SDMVSTRA, id = ~SDMVPSU, nest = TRUE, weights = ~WTMEC4YR)distinct(NHANESraw, SDMVPSU)
# A tibble: 3 x 1
SDMVPSU
<int>
1 1
2 2
3 3

R로 하는 설문 데이터 분석