Table of Contents
Epidemiology Research International
Volume 2011, Article ID 608719, 5 pages
Research Article

Estimating Prevalence Using an Imperfect Test

1CHICAS, Faculty of Health and Medicine, Lancaster University, Lancaster LA1 4YA, UK
2Johns Hopkins University School of Public Health, Baltimore, MD 21205, USA

Received 18 June 2011; Accepted 2 August 2011

Academic Editor: Leo J. Schouten

Copyright © 2011 Peter J. Diggle. This is an open access article distributed under the Creative Commons Attribution License, which permits unrestricted use, distribution, and reproduction in any medium, provided the original work is properly cited.


The standard estimate of prevalence is the proportion of positive results obtained from the application of a diagnostic test to a random sample of individuals drawn from the population of interest. When the diagnostic test is imperfect, this estimate is biased. We give simple formulae, previously described by Greenland (1996) for correcting the bias and for calculating confidence intervals for the prevalence when the sensitivity and specificity of the test are known. We suggest a Bayesian method for constructing credible intervals for the prevalence when sensitivity and specificity are unknown. We provide R code to implement the method.

1. Introduction

The prevalence, , of a disease is the proportion of subjects in the population of interest who have the disease in question [1, page 46]. A standard way to estimate prevalence is to apply a diagnostic test to a random sample of individuals and use the estimator where is the number of individuals who test positive.

The sensitivity, , of a diagnostic test for presence/absence of a disease is the probability that the test will give a positive result, conditional on the subject being tested having the disease, whilst the specificity, , is the probability that the test will give a negative result, conditional on the subject not having the disease. An imperfect test is one for which at least one of and is less than one. An imperfect test may give either or both of a false positive or a false negative result, with respective probabilities and . A similar issue arises in individual diagnostic testing. In that context, prevalence is assumed to be known and the objective is to make a diagnosis for each subject tested. Important quantities are then the positive and negative predictive values, defined as the conditional probabilities that a subject does or does not have the disease in question, given that they show a positive or negative test result, respectively. Even when both and are close to one, the positive and negative predictive values of a diagnostic test depend critically on the true prevalence of the disease in the population being tested. In particular, for a rare disease, the positive predictive value can be much smaller than either or .

2. Estimation of Prevalence

Suppose that an imperfect test is applied to a random sample of subjects, of whom give a positive result. The standard estimator given by (1) is now biased for . Let denote the expectation of . Then, the relationship between and is linear, and given by [2]. Under the reasonable assumption that , that is, that the test is superior to the toss of a coin and is an increasing function of . It follows that if the values of and are known a confidence interval, say, for can be converted straightforwardly to a confidence interval for by applying the pair of transformations See Figure 1 for an illustration.

Figure 1: Converting an interval estimate of , the probability of a positive test result, into an interval estimate of , the true prevalence, for a test with sensitivity 0.9 and specificity 0.75. The vertical and horizontal arrows denote the interval estimates of and , respectively.

Typically, when the true prevalence is low, and the effect of the bias correction is to shift the interval estimate of prevalence towards lower values. For example, if and , then . As the true prevalence increases, the relative difference between and decreases; for example, if as before but now , then .

3. Unknown Sensitivity and Specificity

If and are unknown, can still be estimated, albeit with reduced precision, using a Bayesian approach. This requires us to specify a prior distribution for and informative prior distributions for and (informative, because the data give essentially no information about or ). Assume temporarily that and are both known. The sampling distribution of , the number of positive test results out of individuals tested, given is binomial, with number of trials and probability of a positive outcome , where and . A convenient, uninformative prior for is the uniform distribution on . The marginal distribution of is then obtained as where is the incomplete beta function. The posterior distribution for given and follows as where is given by (4). Finally, to allow for the uncertainty in and , we substitute and on the right-hand-side of (6) and integrate with respect to the joint prior, say, for and , to give the posterior distribution for as

4. Example

Suppose that we sample individuals, of whom give positive results. The uncorrected estimate of prevalence (1) is 0.2. Solving the quadratic equation gives a 95% confidence interval for as . If we assume that , inversion of (2) gives the corrected estimate , whilst (3) gives the corresponding 95% confidence interval as .

We now assume that and are unknown and specify independent beta prior distributions, each with parameters but scaled to lie in the interval ; hence, the prior for each of and is unimodal wit prior expectation 0.9. A 95% Bayesian credible interval for is , wider than and shifted to the left of the classical confidence interval. Incidentally, the corresponding 95% Bayesian credible interval for assuming known is . This is much closer to the classical confidence interval, which is as expected since we have specified an uninformative prior for . Figure 2 shows the posterior distributions for assuming known or unknown and . The greater spread of the latter represents the loss of precision that results from not knowing the sensitivity and specificity of the test.

Figure 2: Posterior distributions of prevalence for a sample of 100 individuals of whom 20 tested positive, using a test with (a) known sensitivity and specificity each equal to 0.9 (solid line); (b) unknown sensitivity and specificity with prior expectations each equal to 0.9 (dashed line, see text for details of prior specification).

5. Discussion

When both and are close to one, the absolute bias of the uncorrected estimator defined in (1) is small but the relative bias may still be substantial. Also, in some settings, practical constraints dictate the use of tests with relatively low sensitivity and/or specificity. An example is the use by the African Programme for Onchocerciasis Control of a questionnaire-based assessment of community-level prevalence of Loa loa in place of the more accurate, but also more expensive and invasive, finger-prick blood-sampling and microscopic detection of microfilariae [3].

The simple method described here to take account of known sensitivity and/or specificity less than one is rarely described explicitly in epidemiology text books. For example, [4, Section  4.2] note that it is “possible to correct for biases due to the use of a nonspecific diagnostic test” but give no details, perhaps because their focus is on comparing efficacies of different treatments rather than on estimating prevalence.

Exactly the same argument would apply to the estimation of prevalence in more complex settings. For example, where prevalence is modelled as a function of explanatory variables, say , an interval estimate for can be calculated at each value of by applying (3) to the corresponding interval estimate of .

The Bayesian method for dealing with unknown and does not yield explicit formulae for point or interval estimates of prevalence, but the required computations are not burdensome; an R function is listed in the Algorithm and can be downloaded from the author's web-site (

Algorithm 1: R code.


For more details, see Algorithm 1.


  1. K. J. Rothman, S. Greenland, and T. L. Lash, Modern Epidemiology, Lippincott Williams & Wilkins, Philadelphia, Pa, USA, 3rd edition, 2008.
  2. S. Greenland, “Basic methods for sensitivity analysis of biases,” International Journal of Epidemiology, vol. 25, no. 6, pp. 1107–1116, 1996. View at Google Scholar
  3. I. Takougang, M. Meremikwu, S. Wandji et al., “Rapid assessment method for prevalence and intensity of L. loa infection,” Bulletin of the World Health Organization, vol. 80, no. 11, pp. 852–858, 2002. View at Google Scholar
  4. P. G. Smith and R. H. Morrow, Field Trials of Health Interventions in Developing Countries, McMillan, Oxford, UK, 2nd edition, 1996.