Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- library(survey)
- library(RNHANES)
- library(tidyverse)
- dat <- nhanes_load_data("EPHPP_H", "2013-2014", demographics = TRUE) %>%
- filter(!is.na(URXBPH), !is.na(URXBP3))
- des <- nhanes_survey_design(dat, "WTSB2YR")
- logmean <- svymean(~log(URXBPH), des, na.rm = TRUE)
- # Geometric mean lower 95% confidence interval
- exp(logmean[1] - 1.96 * sqrt(attr(logmean, "var")))
- # Geometric mean
- exp(logmean)[1]
- # Geometric mean upper 95% confidence interval
- exp(logmean[1] + 1.96 * sqrt(attr(logmean, "var")))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement