9  Diagnosis and Test Accuracy

A diagnostic test is a piece of evidence, and its value depends on two things: how well it separates the diseased from the healthy, and how likely the disease was before the test. Both are uncertain. The accuracy of a test is estimated from a study, often a small one, and the prevalence of the disease varies from one clinic to the next. Many tests also have no perfect reference against which their accuracy can be measured. Stool examination for a parasite misses infections, antibody testing flags past infections as current ones, and a biopsy can miss a tumour. The chapter follows the Bayesian latent class methods of Lawrence Joseph and his colleagues for the case where no gold standard exists.

9.1 Sensitivity, specificity and predictive values

Let \(D\) indicate disease and \(T\) a binary test result. The sensitivity \(S = \Pr(T=1\mid D=1)\) is the probability that the test is positive in a diseased person. The specificity \(C = \Pr(T=0\mid D=0)\) is the probability that it is negative in a healthy person. The prevalence \(\pi = \Pr(D=1)\) is the probability of disease in the population being tested, which is the prior probability for a patient drawn from that population. Bayes’ theorem converts these three numbers into the quantities a clinician needs. The positive predictive value is the probability of disease after a positive test,

\[ \mathrm{PPV} = \Pr(D=1\mid T=1) = \frac{\pi S}{\pi S + (1-\pi)(1-C)}, \tag{9.1}\]

and the negative predictive value is the probability of health after a negative test,

\[ \mathrm{NPV} = \Pr(D=0\mid T=0) = \frac{(1-\pi) C}{(1-\pi) C + \pi (1-S)}. \tag{9.2}\]

These are the posterior probabilities \(p^+\) and \(1-p^-\) of Chapter 4, with the prior \(p\) equal to the prevalence. Sensitivity and specificity are properties of the test and, to a first approximation, travel from one population to another. The predictive values are properties of the test in a population and change with the prevalence. A test with sensitivity 0.95 and specificity 0.95 has a positive predictive value of 0.50 when the prevalence is 5 percent and 0.98 when it is 70 percent. Reporting sensitivity and specificity alone leaves the clinician to do this arithmetic, and many do it badly.

The three inputs are not known. They are estimated, and the estimates have error that the predictive values inherit. The Bayesian treatment gives each input a distribution. An accuracy study that finds \(x_S\) positive results among \(n_S\) diseased people gives the sensitivity a \(\mathrm{Beta}(a_S + x_S, b_S + n_S - x_S)\) posterior under a \(\mathrm{Beta}(a_S, b_S)\) prior, and the specificity is updated in the same way from the healthy group. The prevalence has its own Beta distribution, from a local survey or from clinical judgement. Because the three come from different studies they can be treated as independent. A posterior sample of the predictive values is then a sample of the three inputs pushed through Equation 9.1 and Equation 9.2.

Take a hypothetical study in which 90 of 100 diseased people and 190 of 200 healthy people test correctly, analysed with uniform priors, and a clinic in which the prevalence is thought to be about 10 percent, expressed as a \(\mathrm{Beta}(2, 18)\) prior.

Show the R code
set.seed(1)
S <- rbeta(1e5, 91, 11); C <- rbeta(1e5, 191, 11); p <- rbeta(1e5, 2, 18)
ppv <- p * S / (p * S + (1 - p) * (1 - C))
npv <- (1 - p) * C / ((1 - p) * C + p * (1 - S))
round(rbind(PPV = quantile(ppv, c(.025, .5, .975)), NPV = quantile(npv, c(.025, .5, .975))), 3)
     2.5%   50% 97.5%
PPV 0.172 0.617 0.875
NPV 0.958 0.990 0.999

A positive result has a median posterior probability of disease of 0.62, with a 95 percent interval from 0.17 to 0.88. A negative result has a median probability of health of 0.99, with an interval from 0.96 to 1.00. The point estimate of the positive predictive value, computed from the posterior means of the three inputs, is 0.65, which looks more certain than it is. The interval is wide mainly because the prevalence is uncertain: the \(\mathrm{Beta}(2, 18)\) prior has a 95 percent range from about 0.01 to 0.26, so the prior odds of disease vary by a factor of about 27. The uncertainty in \(1-C\), estimated from only 10 positive results among 200 healthy people, adds a smaller part: with the prevalence fixed at 0.10 and \(S\) and \(C\) drawn from their posteriors, the interval is 0.52 to 0.78.

On the odds scale, Equation 9.1 reads \[ \frac{\mathrm{PPV}}{1-\mathrm{PPV}} = \frac{\pi}{1-\pi}\cdot\frac{S}{1-C}. \] The posterior odds of disease are the prior odds times the likelihood ratio \(S/(1-C)\) of a positive result. Uncertainty in the prior odds and in the likelihood ratio therefore multiply, and on the log scale they add. Prior odds that are uncertain by a factor of two and a false positive rate that is uncertain by a factor of two each move the posterior odds by the same factor; for a low prevalence the prior odds and the prevalence are nearly the same. Sensitivity matters less for the positive result when it lies in \([0.8, 1]\), as in the example above, because it then varies little in relative terms.

9.2 The decision: to test, to treat, or to wait

A predictive value matters only through the decision it supports. Chapter 4 set out the threshold approach of Pauker and Kassirer (1980). A patient with disease probability \(p\) should be treated when \(p > p_T = H/(B+H)\), where \(B\) is the net benefit of treating a diseased patient and \(H\) the net harm of treating a healthy one, both measured on a utility scale such as QALYs (Chapter 2). A test is worth doing when its result can move the probability across \(p_T\).

The new point here is the role of uncertainty about accuracy. For a single decision on a single patient, the value of the test depends on \(S\) and \(C\) only through their posterior means. The reason is that the decision maker needs the joint probabilities of disease status and test result, \(\Pr(D=1, T=1) = \pi S\), \(\Pr(D=1, T=0) = \pi (1-S)\), \(\Pr(D=0, T=1) = (1-\pi)(1-C)\) and \(\Pr(D=0, T=0) = (1-\pi)C\). Each is linear in \(S\) or in \(C\). Averaging over a posterior in which accuracy is independent of the patient’s own prior probability replaces \(S\) and \(C\) by their means. The expected utility of the best action after a given test result is a maximum of linear functions of these joint probabilities, so it too depends on the accuracy only through the means. The spread of the posterior for \(S\) and \(C\) does not change the value of testing one patient. It does matter in two other ways: for the reliability of the predictive value that is reported to the patient, and for the value of further accuracy studies, which is the subject of Chapter 11.

With the posterior means from the previous section (\(\bar S = 0.89\), \(\bar C = 0.95\)), a treatment with \(B = 10\) and \(H = 1\), and a patient with prior probability 0.10, the treatment threshold is \(1/11 = 0.091\). Treating without testing has expected utility 0.10 on this scale. The test lowers the probability below the threshold after a negative result and raises it after a positive one, so the decision changes with the result.

Show the R code
B <- 10; H <- 1; s <- mean(S); f <- mean(C); p0 <- 0.10
U <- function(p) max(p * B - (1 - p) * H, 0)
pp <- p0 * s + (1 - p0) * (1 - f)                     # probability of a positive result
EU_test <- pp * U(p0 * s / pp) + (1 - pp) * U(p0 * (1 - s) / (1 - pp))
c(treat_now = U(p0), with_test = EU_test, value_of_test = EU_test - U(p0))
    treat_now     with_test value_of_test 
    0.1000000     0.8430367     0.7430367 

The test is worth 0.74 utility units to this patient, about seven times the expected utility of treating without testing. This is the expected value of sample information of Chapter 11 computed for one patient. A test with a cost or a risk, expressed on the same scale, should be done when the cost is below 0.74. The test is valuable here because the patient sits close to the treatment threshold, where a result can change what is done, and in this example it is a good test for a patient in that position. For a patient with prior probability 0.50 the test has no value, because both results leave the probability above \(p_T\) and the patient is treated either way.

The same calculation shows what accuracy is worth. Sensitivity and specificity do not matter equally. For a patient who is treated after a positive result and not after a negative one, the expected utility of testing is \(p_0 \bar S B - (1-p_0)(1-\bar C)H\), where \(p_0\) is the patient’s prior probability, so a unit of sensitivity is worth \(p_0 B\) and a unit of specificity is worth \((1-p_0)H\). Their ratio is the prior odds of disease divided by the threshold odds \(H/B\). Here the two are 1.0 and 0.9, so losing 0.05 of sensitivity costs 0.050 and losing 0.05 of specificity costs 0.045. Sensitivity weighs more for patients well above the threshold, and specificity for patients well below it. A manufacturer who reports a single accuracy number, such as the area under a curve or the overall percentage correct, hides that the clinical value of a test is a weighted combination of its sensitivity and specificity with weights set by the decision.

9.3 No gold standard: the latent class model

Everything above assumed that the accuracy study could classify people as diseased or healthy without error. Often it cannot. Stool examination finds a parasite only when eggs or larvae are shed on the day of collection, and serology detects antibodies that may persist after the infection has cleared. Neither is a gold standard, and the common practice of treating one as the truth biases the accuracy of the other. If serology is taken as the truth, the sensitivity of stool examination is estimated as the proportion of serology positives that are stool positive, and the infected people who are serology negative, and the uninfected people who are serology positive, are classified wrongly.

Joseph, Gyorkos, and Coupal (1995) proposed a Bayesian solution. Let the disease status of each person be a latent variable that is never observed, and model the observed pattern of test results as a mixture over the two latent classes, diseased and healthy. With two tests, a person falls in one of four cells of a two by two table: positive on both, positive on the first only, positive on the second only, or negative on both. If the tests are independent given disease status, the probability of each cell is a mixture,

\[ \Pr(T_1=t_1, T_2=t_2) = \pi\, S_1^{t_1}(1-S_1)^{1-t_1} S_2^{t_2}(1-S_2)^{1-t_2} + (1-\pi)\,(1-C_1)^{t_1}C_1^{1-t_1}(1-C_2)^{t_2}C_2^{1-t_2}. \tag{9.3}\]

The unknowns are the prevalence and the two sensitivities and two specificities, five parameters in all. Conditional independence means that, once disease status is known, the result of one test carries no information about the other. It is an assumption, and the next section relaxes it.

The data set does not determine five parameters. A two by two table with a fixed total has three free cells, so it supplies three degrees of freedom. Five unknowns cannot be recovered from three pieces of information. This is non-identifiability: many different combinations of prevalence, sensitivities and specificities give exactly the same probabilities for the four cells, so the likelihood has a ridge or several ridges and the data cannot choose among them. With one test in one population the situation is worse, one degree of freedom for three parameters. A flat prior on all parameters then produces a posterior that is wide and often bimodal, and the unconstrained posterior has a second mode in which the roles of “diseased” and “healthy” are exchanged, with \(S + C < 1\), worse than chance, for tests that are better than chance.

There are two ways out. The first is to collect more degrees of freedom than parameters. Hui and Walter (1980) showed that if the same two tests, conditionally independent given disease status, are applied in two populations with different prevalences, and sensitivity and specificity are the same in both, the data are two two by two tables with six degrees of freedom and six unknowns, two prevalences and four accuracy parameters, which is exactly enough. A third test in one population also suffices. The model is then identifiable, with the exchange of classes excluded by requiring each test to be better than chance (\(S + C > 1\)). The assumption that accuracy is equal in the two populations is real and has to be defended clinically: a test whose performance depends on the stage or spectrum of disease will not have the same sensitivity in a screening clinic as in a referral centre.

The second way out is to bring in outside information through the prior. Joseph, Gyorkos, and Coupal (1995) placed independent Beta priors on the prevalence and on each sensitivity and specificity, and the prior information comes from earlier studies, from expert judgement about plausible ranges, or from both. A Beta prior is chosen to match a plausible range, for example by finding the Beta distribution whose central 95 percent interval is the range an expert gives for the specificity of a test. Their posterior is computed by the Gibbs sampler, which alternates between imputing the latent disease status of each person given the parameters and drawing the parameters from their Beta posteriors given the imputed status. Informative priors pick out the part of the likelihood ridge that is consistent with what is already known. The method is Bayesian in a strong sense, since the answer depends on the prior in the directions the data do not identify, and the prior has to be reported, defended and varied.

Let \(n_{11}, n_{10}, n_{01}, n_{00}\) be the observed counts in the four cells. Conditional on the parameters, the number of truly diseased people in cell \((t_1, t_2)\) is binomial with \(n_{t_1 t_2}\) trials and probability equal to the diseased term of Equation 9.3 divided by the whole mixture. Given those latent counts, the parameters have Beta full conditionals: the prevalence from the total number diseased, each sensitivity from the number of diseased people who test positive on that test, and each specificity from the number of healthy people who test negative. With Beta priors these updates are conjugate, which is why a Gibbs sampler is natural for this problem. The sampler in code/08-latent-class.R is a random walk Metropolis sampler, because the dependence model of the next section has no conjugate form. It imposes \(S + C > 1\) for each test, which removes the mirror mode, and it runs four chains from dispersed starting points. The Gelman-Rubin statistic is below 1.01 for every parameter in every fit, so the chains agree.

The Strongyloides survey

Joseph, Gyorkos, and Coupal (1995) illustrated the method with a survey of all Cambodian refugees who arrived in Montreal over eight months, tested for Strongyloides infection by stool examination and by serology. Of 162 people, 38 were positive on both tests, 87 were positive on serology only, 2 were positive on stool examination only, and 35 were negative on both. The analysis below uses the paper’s priors (its Table 5). A panel of experts from the McGill Centre for Tropical Diseases gave a 95 percent range for the sensitivity and the specificity of each test, from the literature and clinical opinion, and each range was turned into a Beta prior by matching its mean to the centre of the range and its standard deviation to a quarter of the range (the prior for the specificity of serology, mean 0.70, sits slightly above the centre of its range). Under these priors serology is sensitive and moderately specific, and stool examination is specific but insensitive. The posterior depends on these priors, which is the lesson of the paper.

Taking either test at face value gives very different pictures. Serology is positive in \((38+87)/162 = 0.77\) of the sample and stool examination in \((38+2)/162 = 0.25\). The truth cannot be 0.77 and 0.25 at once, and the latent class model reconciles them. The priors were \(\mathrm{Beta}(21.96, 5.49)\) for the sensitivity of serology (mean 0.80), \(\mathrm{Beta}(4.1, 1.76)\) for its specificity (mean 0.70, wide), \(\mathrm{Beta}(4.44, 13.31)\) for the sensitivity of stool examination (mean 0.25), \(\mathrm{Beta}(71.25, 3.75)\) for its specificity (mean 0.95), and a uniform prior for the prevalence. The ranges behind the four Beta priors are 0.65 to 0.95, 0.35 to 1.00, 0.05 to 0.45 and 0.90 to 1.00. Each test is required to satisfy \(S + C > 1\). Table 9.1 gives the posterior medians and 95 percent intervals, computed by the sampler, and Figure 9.1 shows the posterior densities, with the posteriors from flat priors on all five parameters, under the same constraint, for comparison.

Table 9.1: Posterior medians and 95 percent credible intervals for the Strongyloides counts (38, 87, 2, 35), under flat priors, under the informative priors with conditional independence, and with the covariance terms of the next section. All fits impose \(S + C > 1\) for each test. Made by code/08-latent-class.R; values in data/08-latent-class.csv.
Parameter Flat priors Informative priors Informative priors, dependence
Prevalence 0.532 (0.174, 0.839) 0.773 (0.524, 0.923) 0.842 (0.532, 0.988)
Sensitivity, serology 0.952 (0.823, 0.998) 0.889 (0.791, 0.953) 0.839 (0.746, 0.932)
Specificity, serology 0.437 (0.240, 0.951) 0.699 (0.373, 0.955) 0.659 (0.300, 0.948)
Sensitivity, stool 0.426 (0.255, 0.944) 0.305 (0.224, 0.428) 0.280 (0.206, 0.401)
Specificity, stool 0.949 (0.812, 0.997) 0.960 (0.905, 0.989) 0.953 (0.891, 0.987)
Figure 9.1: Posterior densities for the prevalence and for the sensitivity and specificity of each test, under flat priors (wide), the informative priors, and the informative priors with conditional dependence. Made by code/08-latent-class.R.

With flat priors and the constraint \(S + C > 1\) the posterior is still wide: the prevalence interval runs from 0.17 to 0.84, the specificity of serology from 0.24 to 0.95, and the sensitivity of stool examination from 0.26 to 0.94. The data fix only three combinations of the five parameters. With the informative priors the posterior is more concentrated: the prevalence is about 0.77 with an interval from 0.52 to 0.92, which equals the 0.77 that serology alone suggests and is well above the 0.25 of stool examination. The paper reports 0.76 with an interval from 0.52 to 0.91 (its Table 6), without the constraint \(S + C > 1\). The model infers that most of the serology positives that were stool negative are infected (a probability of about 0.88 at the posterior medians), because the sensitivity of stool examination is believed to be low, so a negative stool result is weak evidence against infection. The posterior for the specificity of serology, 0.70 with an interval from 0.37 to 0.96, is close to its prior, and the data add little to it. These conclusions follow from the data together with the prior. The interval for the prevalence is still wide because three degrees of freedom are being spent on five parameters. The quality of the answer depends on how good the prior information is, and the paper’s point was that a Bayesian analysis lets one say so explicitly.

9.4 Conditional dependence between tests

The model of Equation 9.3 assumes that the two tests are independent given disease status. This is often false. Two tests that detect the same biological signal, such as two antibody assays for the same antigen, will tend to agree on the same diseased people and to err on the same healthy people, in particular those with an unusual biology. Ignoring the dependence overstates how much two concordant results confirm one another and biases the estimates of accuracy.

Dendukuri and Joseph (2001) put the dependence in the model through a covariance parameter in each disease class. For diseased people, the probability that both tests are positive is \(S_1 S_2 + \delta_S\), and the probability of exactly one positive result is reduced by \(\delta_S\) in each of the two mixed cells. For healthy people the probability that both tests are negative is \(C_1 C_2 + \delta_C\) in the same way. A positive \(\delta\) means that the tests tend to agree beyond what independence predicts, and a negative one means that they tend to disagree. The covariance cannot be arbitrary, because the four cell probabilities must be nonnegative, and the bounds depend on the accuracy parameters. The authors take both covariances to be nonnegative, the case that arises most often in practice, so that

\[ 0 \le \delta_S \le \min\{S_1(1-S_2),\,(1-S_1)S_2\} = \min(S_1, S_2) - S_1 S_2, \]

and the same form for \(\delta_C\) in terms of \(C_1\) and \(C_2\). They give each covariance a uniform prior over that range. The paper proposes both fixed and random effects versions of the dependence model, and the covariance form is the most direct and is the one used here. The paper also points out that a classical analysis needs at least four tests to identify a model with conditional dependence, so with two or three tests the prior has to do the work. The paper’s own illustration uses the Strongyloides survey above.

Two features of the dependence model carry over to any dataset. First, it makes the identification problem worse, not better. With two tests in one population the dependence model has seven unknowns for three degrees of freedom, and the prior has to carry still more of the inference. The data cannot tell conditional dependence from a different prevalence or a different accuracy, because a change in any one of them can be offset by changes in the others that leave the four cell probabilities the same. Second, the posterior depends strongly on the prior even with a large sample, and if the correlation between the tests is not known with some precision, the result is wider intervals that carry all of the uncertainty. Fitting both the dependent and the independent models and comparing them is good practice, and more than two tests or more than one population should be used whenever the study design allows.

For the Strongyloides counts, the last column of Table 9.1 and the third curve in Figure 9.1 show the dependence model under the same informative priors and a uniform prior on each covariance over its nonnegative range. The posterior medians of the two covariances are small, 0.028 for the diseased class and 0.013 for the healthy class, with intervals from 0.003 to 0.057 and from 0.001 to 0.053. The posterior medians of the four accuracy parameters change by at most 0.05, and that of the prevalence by 0.07, from 0.77 to 0.84. The interval for the prevalence widens, from 0.52 to 0.92 under independence to 0.53 to 0.99 with dependence, the cost of allowing for the possibility that the tests are not independent. Dendukuri and Joseph report similar values for this model (prevalence 0.85 with an interval from 0.54 to 0.99, covariances 0.03 and 0.02), and conclude that allowing for conditional dependence can have a substantial effect on the estimates. The widened interval is the honest statement of what two tests in one population can say, and it is the price of making a weaker assumption.

The Hui and Walter design shows that more information can restore identification. We simulated two populations of 500 people with prevalences 0.15 and 0.55 and tests with sensitivities 0.90 and 0.75 and specificities 0.95 and 0.90, the same in both populations. The data are in data/08-hui-walter-data.csv. The model was fitted with flat priors, requiring only that each test be better than chance.

Table 9.2: Hui-Walter model fitted to simulated data from two populations, with flat priors. Made by code/08-latent-class.R; values in data/08-hui-walter.csv.
Parameter True value Posterior median 95% interval
Prevalence, population A 0.15 0.101 (0.065, 0.147)
Prevalence, population B 0.55 0.565 (0.497, 0.628)
Sensitivity, test 1 0.90 0.910 (0.842, 0.974)
Specificity, test 1 0.95 0.925 (0.889, 0.961)
Sensitivity, test 2 0.75 0.743 (0.673, 0.810)
Specificity, test 2 0.90 0.913 (0.881, 0.942)

Five of the six intervals contain the true value. The interval for the prevalence in population A, 0.065 to 0.147, falls just short of 0.15, which is an ordinary event for one interval in six and not a failure of the method. With flat priors the posterior is concentrated near the truth, unlike the single population in Table 9.1, because the second population supplied the missing degrees of freedom. This is the practical lesson: design the study to be identifiable, and use informative priors for what the design cannot identify.

9.5 Sample size for an accuracy study without a gold standard

An accuracy study needs a sample size, and the usual formulas assume a gold standard. Dendukuri et al. (2004) gave Bayesian sample size criteria for prevalence and diagnostic test studies when the true disease status is unobserved. They extend earlier work on a single imperfect test, which had shown very large sample sizes compared with methods that assume a perfect test, to two conditionally independent imperfect tests, and they apply several Bayesian criteria for sample size, for studies whose aim is the prevalence and for studies whose aim is the sensitivity and specificity of the tests. A typical criterion of this kind, used in the companion volume, Bayesian Clinical Trials, for trial design, asks for the smallest sample for which the expected length of a posterior credible interval is at most a chosen value, with the expectation taken over data generated from the prior predictive distribution.

The new feature is that, because the problem is typically nonidentifiable, the accuracy of estimation has a limit as the sample size goes to infinity. The posterior stays wide in the unidentified directions however many people are tested, and the interval length reaches a floor set by the prior. The authors investigate this limit, and show with two examples from infectious diseases that adding a second test usually lowers the required sample size compared with a single test, but that the sample size can still be prohibitively large unless accurate information is available about the sensitivities and specificities of the tests. A sample size calculation that ignores the floor promises precision that cannot be had. Dendukuri and colleagues compute the criteria by Monte Carlo, as a preposterior analysis in the sense of Chapter 11: they draw the parameters from the prior, simulate data from the multinomial model, compute the posterior of the prevalence for each simulated dataset, and average the length or the coverage of its highest posterior density intervals. By the same reasoning, which is ours and not a result of the paper, a design that adds degrees of freedom, such as a second population, should lower the floor on interval length more cheaply than extra subjects in an unidentified design.

9.6 Continuous tests and thresholds

Many tests produce a number: a blood level, an antibody titre, an imaging score. A binary test is a continuous one with a cutoff, and the sensitivity and specificity depend on where the cutoff is placed. The receiver operating characteristic curve plots sensitivity against one minus specificity as the cutoff moves, and it describes the test independently of any cutoff. The same ideas extend to a latent true status, with a model for the marker in each class, but this chapter does not develop that case.

Choosing the cutoff is a decision, and the decision framework gives a rule. A patient with marker value \(x\) should be treated when the posterior probability of disease exceeds the threshold \(p_T\), which is the same as saying that the likelihood ratio \(\mathrm{LR}(x) = f_1(x)/f_0(x)\) of the marker density in the diseased to the healthy exceeds

\[ \mathrm{LR}(x) > \frac{1-\pi}{\pi}\cdot\frac{H}{B}. \tag{9.4}\]

The cutoff depends on the prevalence and on the benefit and harm of treatment. Two common summaries of the curve, the area under it and the cutoff that maximizes the Youden index \(S + C - 1\), ignore the decision. When the likelihood ratio increases with the marker value, as in the normal example below, maximizing the Youden index is the same as choosing the cutoff where the likelihood ratio is one, which is the optimal rule when \(\pi B = (1-\pi)H\), for example when the prevalence is a half and the benefit equals the harm. For a marker that is normal with unit variance in both classes and mean 0 in the healthy and \(\mu\) in the diseased, Equation 9.4 gives the cutoff in closed form.

Show the R code
mu <- 1.5; prev <- 0.10; B <- 10; H <- 1
cut_u <- log((1 - prev) / prev * H / B) / mu + mu / 2   # utility-based cutoff
cut_y <- mu / 2                                          # Youden cutoff
sens <- function(x) 1 - pnorm(x - mu); spec <- function(x) pnorm(x)
round(rbind(utility = c(cutoff = cut_u, sens = sens(cut_u), spec = spec(cut_u)),
            Youden = c(cut_y, sens(cut_y), spec(cut_y))), 3)
        cutoff  sens  spec
utility   0.68 0.794 0.752
Youden    0.75 0.773 0.773

The utility based cutoff is 0.68, lower than the Youden cutoff of 0.75, because the tenfold ratio of benefit to harm outweighs the low prevalence, which pulls the cutoff the other way. The lower cutoff raises the sensitivity from 0.77 to 0.79 and lowers the specificity from 0.77 to 0.75. The gain is small in this example because the two cutoffs are close, but it grows with how far \((1-\pi)H/(\pi B)\) is from one. Here the prevalence of 0.10 nearly cancels the tenfold ratio of \(B\) to \(H\). The same logic leads to a different cutoff in a screening clinic with low prevalence than in a referral clinic with high prevalence, and a cutoff reported without the prevalence and the utilities behind it is a number that cannot be transferred to another setting.

Uncertainty enters the continuous case as before. The parameters of the two marker distributions have posteriors, the likelihood ratio at each \(x\) has a posterior, and the utility-optimal cutoff has a posterior distribution, whose credible interval summarizes how well the data determine it. The value of collecting more data to sharpen the cutoff is again an expected value of information, and it is largest when the likelihood ratio is uncertain near the threshold.

9.7 What carries over to the rest of the book

Three points carry over to the later chapters. First, a test is an experiment on a single patient, and the Bayes machinery of the trial chapters applies to it without change: a prior, a likelihood, a posterior and a decision. Second, the model for the test is itself uncertain, and in the diagnostic setting the uncertainty is often not reducible by collecting more of the same data, because the latent structure is not identified. The prior then carries part of the answer, and a careful analysis reports which part. Third, the value of a test is a decision quantity. Accuracy summaries that are indifferent to the benefit and harm of treatment, such as the area under the curve, do not measure it. The same idea underlies the value of biomarkers in the heterogeneity chapter (Chapter 6) and the worked case of testing before treating in Chapter 8.

ImportantKey points
  • Sensitivity, specificity and prevalence determine the predictive values through Bayes’ theorem. Giving each input a Beta distribution carries the uncertainty through to a posterior for the positive and negative predictive values, whose intervals are usually wider than the point estimates suggest.
  • A test has value only when a result can move the patient across the treatment threshold of Chapter 4. For one patient the value of a test depends on accuracy only through the posterior means of sensitivity and specificity, and it is an expected value of information that can be compared with the cost of the test.
  • Without a gold standard, the latent class model treats disease status as unobserved. Two tests in one population give three degrees of freedom for five parameters, so the model is not identified, and a flat prior returns a wide posterior.
  • Identification comes from more degrees of freedom (two populations with different prevalences, as in Hui and Walter, or a third test). Without them, informative priors on accuracy can still give useful inference, but the model stays nonidentified. The prior is then part of the result and should be reported and varied.
  • Conditional dependence between tests, modelled by covariance terms within each disease class, worsens the identification problem. It should be fitted alongside the independence model and the two compared.
  • Sample size for an accuracy study without a gold standard has a limit set by the prior: with a nonidentifiable model the posterior interval does not shrink to zero as the sample grows, and a sample size that ignores this promises precision that cannot be had.
  • The cutoff for a continuous test is a decision, set by the likelihood ratio, the prevalence and the benefit and harm of treatment. It is the Youden cutoff only when \(\pi B = (1-\pi)H\).
TipDiscussion questions
  1. A test has sensitivity 0.90 and specificity 0.90 and is used in a clinic where the prevalence is 2 percent. Compute the positive predictive value. How would you present the result to a patient, and which of the three inputs would you most want to know better?
  2. For one patient, why does the value of a test depend on sensitivity and specificity only through their posterior means? Describe a situation in which the spread of the posterior for the sensitivity would matter for the decision.
  3. Explain, in terms of counts of parameters and degrees of freedom, why a two by two table cannot identify the prevalence and the accuracy of both tests. Why does a second population with a different prevalence help, and what has to be true of the tests for that help to be valid?
  4. Take the Strongyloides analysis and double the prior sample size (the sum of the two Beta parameters) for the specificity of stool examination. What do you expect to happen to the posterior for the prevalence and for the specificity of serology, and why? Run code/08-latent-class.R with the change to check.
  5. Two assays detect the same antigen. Why would you expect a positive covariance between them in the diseased class, and what happens to the apparent evidence of two concordant positive results if the covariance is ignored?
  6. For a screening test, a clinician proposes to use the cutoff that maximizes sensitivity plus specificity. Under what conditions on the prevalence, the benefit and the harm of treatment is this the right cutoff? When is it far from right?