## EXAMPLE 1 (without covariates):
## Adapted from Dohoo, Martin and Stryhn (2009). In this example the frequency
## of tuberculosis is expressed as incidence risk (i.e., the number of
## tuberculosis positive herds divided by the size of the herd population at
## risk). In their text Dohoo et al. present the data as incidence rate (the
## number of tuberculosis positive herds per herd-year at risk).
## Data have been collected on the incidence of tuberculosis in two
## areas ("A" and "B"). Provided are the counts of (new) incident cases and
## counts of the herd population at risk. The standard incidence risk for
## the total population is 0.060 (6 cases per 100 herds at risk):
obs.m01 <- matrix(data = c(58,130), nrow = 2, byrow = TRUE,
dimnames = list(c("A", "B"), ""))
pop.m01 <- matrix(data = c(1000,2000), nrow = 2, byrow = TRUE,
dimnames = list(c("A", "B"), ""))
std.m01 <- 0.060
epi.indirectadj(obs = obs.m01, pop = pop.m01, std = std.m01, units = 100,
conf.level = 0.95)
## EXAMPLE 2 (with covariates):
## We now have, for each area, data stratified by herd type (dairy, beef).
## The standard incidence risks for beef herds, dairy herds, and the total
## population are 0.025, 0.085, and 0.060 cases per herd, respectively:
obs.m02 <- matrix(data = c(58,130), nrow = 2, byrow = TRUE,
dimnames = list(c("A", "B"), ""))
pop.m02 <- matrix(data = c(550,450,500,1500), nrow = 2, byrow = TRUE,
dimnames = list(c("A", "B"), c("Beef", "Dairy")))
std.m02 <- matrix(data = c(0.025,0.085,0.060), nrow = 1, byrow = TRUE,
dimnames = list("", c("Beef", "Dairy", "Total")))
epi.indirectadj(obs = obs.m02, pop = pop.m02, std = std.m02, units = 100,
conf.level = 0.95)
## > $crude.strata
## > est lower upper
## > A 5.8 4.404183 7.497845
## > B 6.5 5.430733 7.718222
## > $adj.strata
## > est lower upper
## > A 6.692308 5.076923 8.423077
## > B 5.571429 4.628571 6.557143
## > $smr.strata
## > obs exp est lower upper
## > A 58 52 1.1153846 0.8461538 1.403846
## > B 130 140 0.9285714 0.7714286 1.092857
## The crude incidence risk of tuberculosis in area A was 5.8
## (95% CI 4.0 to 7.5) cases per 100 herds at risk. The crude incidence
## risk of tuberculosis in area B was 6.5 (95% CI 5.4 to 7.7) cases
## per 100 herds at risk.
## The indirectly adjusted incidence risk of tuberculosis in area A was 6.7
## (95% CI 5.1 to 8.4) cases per 100 herds at risk. The indirectly
## adjusted incidence risk of tuberculosis in area B was 5.6
## (95% CI 4.6 to 6.6) cases per 100 herds at risk.
Run the code above in your browser using DataLab