## EXAMPLE 1:
## We want to estimate the seroprevalence of Brucella abortus in a population 
## of cattle. An estimate of the unknown prevalence of B. abortus in this 
## population is 0.15. We would like to be 95% certain that our estimate is 
## within 20% of the true proportion of the population seropositive to 
## B. abortus. Calculate the required sample size assuming use of a test
## with perfect diagnostic sensitivity and specificity.
epi.sssimpleestb(N = NA, Py = 0.15, epsilon = 0.20,
   error = "relative", se = 1.00, sp = 1.00, nfractional = FALSE, 
   conf.level = 0.95)
## A total of 545 cattle need to be sampled to meet the requirements of the 
## survey.
## EXAMPLE 1 (continued):
## Why don't I get the same results as other sample size calculators? The 
## most likely reason is misspecification of epsilon. Other sample size 
## calculators (e.g., OpenEpi) require you to enter the absolute
## error (as opposed to relative error). For the example above the absolute 
## error is 0.20 * 0.15 = 0.03. Re-run epi.simpleestb:
epi.sssimpleestb(N = NA, Py = 0.15, epsilon = 0.03,
   error = "absolute", se = 1.00, sp = 1.00, nfractional = FALSE, 
   conf.level = 0.95)
## A total of 545 cattle need to be sampled to meet the requirements of the 
## survey.
## EXAMPLE 1 (continued):
## The World Organisation for Animal Health (WOAH) recommends that the 
## compliment fixation test (CFT) is used for bovine brucellosis prevalence 
## estimation. Assume the diagnostic sensitivity and specficity of the bovine 
## brucellosis CFT to be used is 0.94 and 0.88 respectively 
## (Getachew et al. 2016). Re-calculate the required sample size 
## accounting for imperfect diagnostic test performance. 
n.crude <- epi.sssimpleestb(N = NA, Py = 0.15, epsilon = 0.20,
   error = "relative", se = 0.94, sp = 0.88, nfractional = FALSE, 
   conf.level = 0.95)
n.crude 
## A total of 1168 cattle need to be sampled to meet the requirements of the
## survey.
## EXAMPLE 1 (continued):
## Being seropositive to brucellosis is likely to cluster within herds.
## Otte and Gumm (1997) cite the intraclass correlation coefficient (rho) of
## Brucella abortus to be in the order of 0.09. Adjust the sample size
## estimate to account for clustering at the herd level. Assume that, on
## average, 20 animals will be sampled per herd:
## Let D equal the design effect and nbar equal the average number of 
## individuals per cluster:
## rho = (D - 1) / (nbar - 1)
## Solving for D:
## D <- rho * (nbar - 1) + 1
rho <- 0.09; nbar <- 20
D <- rho * (nbar - 1) + 1
n.adj <- ceiling(n.crude * D)
n.adj
## After accounting for use of an imperfect diagnostic test and the presence 
## of clustering of brucellosis positivity at the herd level we estimate that 
## a total of 3166 cattle need to be sampled to meet the requirements of 
## the survey.
Run the code above in your browser using DataLab