if (FALSE) { # requireNamespace("survey")
data(efc)
weighted_se(efc$c12hour, abs(runif(n = nrow(efc))))
# survey_median ----
# median for variables from weighted survey designs
data(nhanes_sample)
des <- survey::svydesign(
id = ~SDMVPSU,
strat = ~SDMVSTRA,
weights = ~WTINT2YR,
nest = TRUE,
data = nhanes_sample
)
survey_median(total, des)
survey_median("total", des)
}
Run the code above in your browser using DataLab