## EXAMPLE 1 (without covariates):
## Adapted from Dohoo, Martin and Stryhn (2009). Data have been collected on
## the incidence of tuberculosis (TB) )positive herds in two areas ("A" and
## "B"). Provided are the counts of incident TB positive herds and counts
## of the herd population at risk. The herd level TB incidence risk for this
## population is 0.060 (6 TB positive herds per 100 herds at risk).
## In their text Dohoo et al. present this example as incidence rate data
## (the number of TB positive herds per herd-year at risk). For this example
## the frequency of tuberculosis is expressed as an incidence risk
## (i.e., the number of TB positive herds divided by the size of the herd
## population 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)
## In area A the observed number of TB positive herds was 0.97 (95% CI
## 0.73 to 1.22) times the number expected. In area B the observed number
## of TB positive herds was 1.1 (95% CI 0.90 to 1.3) times the number expected.
## EXAMPLE 2 (with covariates):
## We now have, for each area, the data stratified by herd type (dairy, beef).
## The incidence risks of TB for beef herds, dairy herds and the
## total population are 0.025, 0.085, and 0.060 (2.5, 8.5 and 6.0 TB positive
## herds per 100 herds at risk), 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 herd level incidence risk of TB in area A was 5.8 (95% CI 4.0
## to 7.5) per 100 herds at risk. The crude herd level incidence risk
## of TB in area B was 6.5 (95% CI 5.4 to 7.7) per 100 herds at risk.
## The indirectly adjusted herd level incidence risk of TB in area A was 6.7
## (95% CI 5.1 to 8.4) per 100 herds at risk. The indirectly adjusted
## herd level incidence risk of TB in area B was 5.6 (95% CI 4.6 to 6.6)
## per 100 herds at risk.
Run the code above in your browser using DataLab