## EXAMPLE 1:
## A simple random sample of 150 cows from a herd of 2560 is taken.
## Each cow is given a screening test for brucellosis which has a
## sensitivity of 96% and a specificity of 89%. Of the 150 cows tested
## 45 were positive to the screening test. What is the estimated prevalence
## of brucellosis in this herd (and its 95% confidence interval)?
epi.prev(pos = 45, tested = 150, se = 0.96, sp = 0.89, method = "blaker",
units = 100, conf.level = 0.95)
## The estimated true prevalence of brucellosis in this herd is 22 (95% 14
## to 32) cases per 100 cows at risk. Using this screening test we can expect
## anywhere between 34 and 56 positive test results. Of the positive tests
## between 23 and 42 are expected to be true positives and between 7 and 20 are
## expected to be false positives.
# EXAMPLE 2:
## Moujaber et al. (2008) analysed the seroepidemiology of Helicobacter pylori
## infection in Australia. They reported seroprevalence rates together with
## 95% confidence intervals by age group using the Clopper-Pearson exact
## method (Clopper and Pearson, 1934). The ELISA test they applied had 96.4%
## sensitivity and 92.7% specificity. A total of 151 subjects 1 -- 4 years
## of age were tested. Of this group 6 were positive. What is the estimated
## true prevalence of Helicobacter pylori in this age group?
epi.prev(pos = 6, tested = 151, se = 0.964, sp = 0.927, method = "c-p",
units = 100, conf.level = 0.95)
## The estimated true prevalence of Helicobacter pylori in 1 -- 4 year olds is
## -4 (95% CI -6 to 1) cases per 100. The function issues a warning to alert
## the user that estimate of true prevalence invalid. True positive, false
## positive, true negative and false negative counts are not returned.
## EXAMPLE 3:
## Three dairy herds are tested for tuberculosis. On each herd a different test
## regime is used (each with a different diagnostic test sensitivity and
## specificity). The number of animals tested in each herd were 210, 189 and
## 124, respectively. The number of test-positives in each herd were 8, 12
## and 7. Test sensitivities were 0.60, 0.65 and 0.70 (respectively). Test
## specificities were 0.90, 0.95 and 0.99. What is the estimated true
## prevalence of tuberculosis in each of the three herds?
rval.prev03 <- epi.prev(pos = c(80,100,50), tested = c(210,189,124),
se = c(0.60,0.65,0.70), sp = c(0.90,0.95,0.99), method = "blaker",
units = 100, conf.level = 0.95)
round(rval.prev03$tp, digits = 0)
## True prevalence estimates for each herd:
## Herd 1: 56 (95% CI 43 to 70) cases per 100 cows.
## Herd 2: 80 (95% CI 68 to 92) cases per 100 cows.
## Herd 3: 57 (95% CI 45 to 70) cases per 100 cows.
Run the code above in your browser using DataLab