res0a <- svyby(~outcome1, ~person+exposure, survey_design, svytotal,
vartype=c("se","ci"), deff=TRUE, proportion = TRUE,
prop_method = c("logit"))
res0b <- svyby(~outcome1, ~person+exposure, survey_design, svymean,
vartype=c("se","ci"), deff=TRUE, proportion = TRUE,
prop_method = c("logit"))
res1 <- svyby(~outcome1, ~person+exposure, survey_design, svymean,
vartype=c("se","ci"), deff=TRUE, proportion = TRUE,
prop_method = c("logit"))
res1$exposure_ <- "Educational levels"
res1b <- survey_design %>%
group_by(person,exposure) %>%
summarize(n = unweighted(n()))
res1 <- full_join(res1,res1b)
res1$outcome1_ <- "Mean"
res_1 <- svyby(~outcome1, ~person, survey_design, svymean,
vartype=c("se","ci"), deff=TRUE, proportion = TRUE,
prop_method = c("logit"))
res_1$exposure <- "All"
res_1b <- survey_design %>%
group_by(person) %>%
summarize(n = unweighted(n()))
res_1 <- full_join(res_1,res_1b)
res_1$outcome1_ <- "Mean"
res_1 <- full_join(res_1,res_1b)
res1 <- full_join(res_1,res1)
# res1$value <- res1$outcome1
# res1$value <- res1$outcome1*111
res1$CI_i <- (res1$outcome1-1.96*res1$se)
res1$CI_s <- (res1$outcome1+1.96*res1$se)
res2 <- svyby(~outcome2, ~person+exposure, survey_design, svymean,
vartype=c("se","ci"), deff=TRUE, proportion = TRUE,
prop_method = c("logit"))
res2$exposure_ <- "Educational levels"
res2b <- survey_design %>%
group_by(person,exposure) %>%
summarize(n = unweighted(n()))
res2 <- full_join(res2,res2b)
res2$outcome_ <- "Mean"
res_2 <- svyby(~outcome2, ~person, survey_design, svymean,
vartype=c("se","ci"), deff=TRUE, proportion = TRUE,
prop_method = c("logit"))
res_2$exposure <- "All"
res_2b <- survey_design %>%
group_by(person) %>%
summarize(n = unweighted(n()))
res_2 <- full_join(res_2,res_2b)
res_2$outcome_ <- "Mean"
res_2 <- full_join(res_2,res_2b)
res2 <- full_join(res_2,res2)
# res2$value <- res2$outcome
# res2$value <- res2$outcome*100
res2$CI_i <- (res2$outcome2-1.96*res2$se)
res2$CI_s <- (res2$outcome2+1.96*res2$se)
res3 <- svyby(~outcome3, ~person+exposure, survey_design, svymean,
vartype=c("se","ci"), deff=TRUE, proportion = TRUE,
prop_method = c("logit"))
res3$exposure_ <- "Educational level"
res3b <- survey_design %>%
group_by(person,exposure) %>%
summarize(n = unweighted(n()))
res3 <- full_join(res3,res3b)
res3$outcome_ <- "Mean"
res_3 <- svyby(~outcome3, ~person, survey_design, svymean,
vartype=c("se","ci"), deff=TRUE, proportion = TRUE,
prop_method = c("logit"))
res_3$exposure <- "All"
res_3b <- survey_design %>%
group_by(person) %>%
summarize(n = unweighted(n()))
res_3 <- full_join(res_3,res_3b)
res_3$outcome_ <- "Mean"
res_3 <- full_join(res_3,res_3b)
res3 <- full_join(res_3,res3)
# res3$value <- res3$outcome
# res3$value <- res3$outcome*100
res3$CI_i <- (res3$outcome3-1.96*res3$se)
res3$CI_s <- (res3$outcome3+1.96*res3$se)