# NOT RUN {
d <- health_data
# RII with 95% CI
rii(d, bad, pop, quintile, age, ethnicity == "all")
# SII with 99% CI, using weighted least squares
rii(d, bad, pop, quintile, age, ethnicity == "all", RII = FALSE, CI = 99, W = TRUE)
# Supply own population weights
new_w <- c(0.075, 0.075, 0.075, 0.06, 0.060, 0.060, 0.06, 0.070, 0.050,
0.050, 0.050, 0.06, 0.060, 0.055, 0.050, 0.040, 0.025, 0.025)
# RII with user supplied weights
rii(d, bad, pop, quintile, age, ethnicity == "all", RII = FALSE, CI = 99, st_pop = new_w)
# SII for new age groups with 95% CI
rii(d, bad, pop, quintile, age, ethnicity == "Scot" & ur2fold == "Urban",
age_group=c("0-19", "20-34", "35-49"), RII = FALSE)
# }
Run the code above in your browser using DataLab