# NOT RUN {
### Example from Essential Medical Statistics
# Page 178, Chapter 18: Controlling for confounding: Stratification
lepto <- expandTables(
male = c(36, 14, 50, 50), female = c(24, 126, 10, 90),
exp_name = "area", exp_lvl = c("Rural", "Urban"),
case_name = "ab", case_lvl = c("Yes", "No"),
strata_name = "gender"
)
## label variables and data
lepto <- labelData(lepto, "Prevalence survey of leptospirosis in West Indies")
lepto <- labelVar(lepto,
c(area, ab, gender),
c("Type of area", "Leptospirosis Antibodies",
"Gender: Male or female"))
## check dataset
codebook(lepto)
## Calculate OR
mhor(lepto, area, by = ab, case_value = "Yes")
# }
Run the code above in your browser using DataLab