## EXAMPLE 1 (from Thrusfield 2007 pp. 63 - 64):
## A study was conducted to estimate the seroprevalence of leptospirosis
## in dogs in Glasgow and Edinburgh, Scotland. For the matrix titled pop
## the numbers represent dog-years at risk. The following data were
## obtained for male and female dogs:
obs <- matrix(data = c(15,46,53,16), nrow = 2, byrow = TRUE,
dimnames = list(c("ED","GL"), c("M","F")))
pop <- matrix(data = c(48,212,180,71), nrow = 2, byrow = TRUE,
dimnames = list(c("ED","GL"), c("M","F")))
## Compute directly adjusted seroprevalence estimates, using a standard
## population with equal numbers of male and female dogs:
std <- matrix(data = c(250,250), nrow = 1, byrow = TRUE,
dimnames = list("", c("M","F")))
epi.directadj(obs, pop, std, units = 1, conf.level = 0.95)
## > $crude
## > strata cov est lower upper
## > 1 ED M 0.3125000 0.1749039 0.5154212
## > 2 GL M 0.2944444 0.2205591 0.3851406
## > 3 ED F 0.2169811 0.1588575 0.2894224
## > 4 GL F 0.2253521 0.1288082 0.3659577
## > $crude.strata
## > strata est lower upper
## > 1 ED 0.2346154 0.1794622 0.3013733
## > 2 GL 0.2749004 0.2138889 0.3479040
## > $adj.strata
## > strata est lower upper
## > 1 ED 0.2647406 0.1866047 0.3692766
## > 2 GL 0.2598983 0.1964162 0.3406224
## The confounding effect of sex has been removed by the gender-adjusted
## incidence rate estimates.
Run the code above in your browser using DataLab