Stats for

Psychometrics and Measurement

Sensitivity and Specificity

Sensitivity and specificity show how often a diagnostic test gets it right.

Sensitivity and specificity take a yes/no test result and a reference-standard diagnosis for the same people and estimate how often the test correctly flags those who have the condition and clears those who don't.

Example

How well does the PHQ-9, at a cutoff of 10, pick out primary-care patients with major depression? Three hundred primary-care patients filled in the PHQ-9 and, separately, had a structured diagnostic interview; 45 of them (15%) had major depression.

One Sample + Yes/No Test Result + Reference-Standard Diagnosis → Sensitivity and Specificity
Estimates
How accurately a test classifies people, against a reference standard
Observations
Independent
Parametric
No
Headline Statistic
\text{Se}
Groups
1

The Basics

When to Use It

Use it when you have a yes/no test result, such as a questionnaire score above or below a cutoff, and a trusted diagnosis (the reference standard) for the same people, and you want to know how often the test gets it right. For example:

  • How well does the PHQ-9, at a cutoff of 10, pick out primary-care patients with major depression?
  • How well does a 10-minute cognitive screen flag older adults who meet criteria for dementia on a full neuropsychological assessment?
  • How accurately does a brief ADHD rating scale, completed by teachers, identify children diagnosed with ADHD in a clinical evaluation?

If your test gives a score and the question is where to put the cutoff, start with ROC curve analysis, which repeats this page's calculation at every possible cutoff.

Vocabulary You Need

Definition Sensitivity (\text{Se})

Of the people who really have the condition (by the reference standard), the proportion the test calls positive: true positives ÷ everyone with the condition. It runs from 0 to 1. A highly sensitive test misses few cases, so a negative result helps rule the condition out. It is computed only among people who have the condition, so on its own it says nothing about false alarms, and it depends on the cutoff: lowering the cutoff for a positive result raises sensitivity and lowers specificity. It's often treated as a fixed property of a test, but it can shift with the mix of mild and severe cases in the sample and with the reference standard used. Also called the true-positive rate. Glossary →

Definition Specificity (\text{Sp})

Of the people who really don't have the condition (by the reference standard), the proportion the test calls negative: true negatives ÷ everyone without the condition. It runs from 0 to 1. A highly specific test raises few false alarms, so a positive result helps rule the condition in. 1 − specificity is the false-positive rate. Raising the cutoff for a positive result raises specificity and lowers sensitivity, so the two are always read together, at a stated cutoff. Also called the true-negative rate. Glossary →

Definition Positive Predictive Value (\text{PPV})

Of the people the test calls positive, the proportion who really have the condition: true positives ÷ all positive results. It answers the question a person with a positive result actually asks: how likely is it that I have it? Unlike sensitivity and specificity, it depends heavily on the base rate. With the same test, a positive result is much more often right where the condition is common than where it is rare, because in a mostly healthy group even a small false-positive rate produces many false alarms. By Bayes' theorem, PPV = Se × π ÷ [Se × π + (1 − Sp)(1 − π)], where π is the base rate. Also called precision. Glossary →

Definition Base Rate (\pi)

The proportion of people in a population or sample who have the condition, by the reference standard: everyone with it ÷ everyone. In a single study it's also called the prevalence. It's what a person's chance of having the condition is before the test result comes in (the pre-test probability), and it shifts a great deal between settings: a depression screen meets far more cases in a psychiatric clinic than in a community survey. Predictive values depend on it; sensitivity and specificity, in principle, don't, though in practice they can shift between settings because the mix of mild and severe cases shifts too. Glossary →

Assumptions

1. A Trustworthy Reference Standard, Applied to Everyone Everyone gets the same accurate reference standard, judged without seeing the test result.
What It Means
Accuracy is measured against the reference standard, so the estimates are only as good as it is. It should classify people correctly, be applied to every participant (or to a random subset), be the same for everyone, and be judged without knowing the index test's result. Errors in the reference standard are counted as errors of the test, which usually makes the test look worse if the two err independently, and better if they tend to err together. Checking mainly the people who test positive (partial verification) inflates sensitivity and deflates specificity. Letting the assessor see the test score inflates both. Using a different standard for positives and negatives can push either way.
Applies To
Design
How to Check
By design, not by a test. Did every participant get the same reference standard, close in time to the index test? Was its assessor blind to the test result, and the test's scorer blind to the diagnosis? Draw the flow of participants, as STARD asks, and count who got which standard.
How Much It Matters
A lot, and it can't be fixed afterward. If only people who screen positive get the interview, the missed cases never show up and sensitivity looks too high. If the interviewer sees the PHQ-9 score, the diagnosis leans toward it and both indices look too good. A weaker reference standard changes the answer too: Levis et al. (2019) found the PHQ-9's sensitivity was 5 to 22 points higher against semistructured interviews than against fully structured ones. The depression-screening study is simulated, so its .80 doesn't stand for either kind; in a real study, say which kind of interview you used.

If It's Violated

  • Design Change Give every participant the reference standard, or a random sample of those who screen negative, and weight the results back up.
  • Design Change Have the interviewer work without the questionnaire score, and score the questionnaire without the diagnosis.
  • Proceed with Caveat Say who got which reference standard and when, in a flow diagram, and which way any shortfall would push the estimates.
2. The Right People in the Sample Your sample looks like the people the test will actually be used on.
What It Means
Sensitivity and specificity describe how the test separates the people in the sample. If the sample holds only clear-cut cases and obviously healthy volunteers, the test separates them easily and looks better than it will in practice, where the cases are milder and the non-cases include people with look-alike problems. The fix is to study a consecutive or random series of people from the setting where the test will be used, such as everyone attending a primary-care clinic.
Applies To
Design
How to Check
By design. How were participants found: consecutively, at random, or as known cases and controls? Compare the severity of the cases, and the other problems the non-cases have, with the intended setting. STARD asks for both.
How Much It Matters
A lot. Comparing clear-cut patients from a depression clinic with healthy volunteers makes almost any questionnaire look accurate. Sensitivity drops when the cases are milder, and specificity drops when the non-cases include people with anxiety, grief or physical illness whose symptoms overlap.

If It's Violated

  • Design Change Recruit everyone (or a random sample) attending the setting where the test will be used, such as consecutive primary-care visits.
  • Proceed with Caveat Report the severity of the cases and the other problems among the non-cases, so readers can judge how far the estimates travel.
3. Independent Observations The people (or other units) in your study don't influence each other.
What It Means
Each person's data comes from a separate, unconnected source, so knowing one person's scores tells you nothing about anyone else's. In designs that measure people more than once, their own scores are meant to be related; it's different people who must be independent. Methods built for clustered data, such as multilevel models and GEE, also allow members of the same group to be related, as long as the analysis names the grouping; then it's the groups that must be independent.
Applies To
Observations
How to Check
By design, not by a test. Did each person contribute their own data, with no clusters such as roommates, couples, therapy groups or classrooms whose members influence each other? If there are clusters, does the analysis model every one of them?
How Much It Matters
Moderate. The estimates still describe the table, but if some patients appear more than once, or come in clusters such as several clinics with their own practices, the intervals come out too narrow.

If It's Violated

  • Design Change Count each patient once, at a single screening visit.
  • Robust Estimation With several clinics, resample clinics rather than patients to build the intervals.

Limitations

This Is Not Your Test If…

What It Doesn't Tell You

  • Whether the interview was right. Every accuracy figure is measured against the structured interview. Where the interview misjudges a patient, the PHQ-9 gets the blame or the credit.
  • What a positive screen means elsewhere. A PPV of .49 belongs to a clinic where 15% of patients are depressed. In a community sample it would be far lower, and in a psychiatric clinic far higher.
  • Who else. The estimates describe patients like these 300, in primary care. Screening adolescents, older adults or people with serious physical illness can shift both sensitivity and specificity.
  • Whether screening helps. Accurate classification isn't better care. Whether screening everyone with the PHQ-9 gets more people effective treatment is a question for a trial, not for this table.

Common Mistakes

  • Don'tChoose the cutoff that looks best in the same data you report accuracy from.

    InsteadFix the cutoff in advance, or check a data-chosen one in a new sample, and say which you did (STARD item 12a).

  • Don'tReport sensitivity and specificity without their intervals.

    InsteadGive each a 95% confidence interval (STARD item 24), such as the Wilson interval, which works with small counts.

  • Don'tEstimate accuracy by comparing known cases with healthy volunteers.

    InsteadRecruit a consecutive series from the setting where the test will be used.

  • Don'tRead predictive values off a table where you chose how many cases and how many non-cases to recruit.

    InsteadCompute them with Bayes' theorem from sensitivity, specificity and the base rate of a real setting. In a recruited case-control sample the base rate is your choice, so the table's PPV describes your design, not any clinic.

  • Don'tSummarize the screen as the percentage of people it classified correctly.

    InsteadReport sensitivity and specificity. Overall accuracy rides on the base rate: here, saying no to everyone would be right 85% of the time, more than the screen's 84%.

  • Don'tTreat a significant chi-square or a high kappa as evidence the test is accurate.

    InsteadReport sensitivity and specificity. A test can be strongly related to the diagnosis and still miss many cases.

  • Don'tRead sensitivity as the chance that a positive result is correct.

    InsteadRead it as the share of people with the condition who test positive. The chance a positive result is correct is the positive predictive value.

  • Don'tCarry a predictive value over to a setting with a different base rate.

    InsteadRecompute it from sensitivity, specificity and the base rate where the test will be used.

Result Decoder

How It's Reported

Equation Form

Example

Sensitivity = .80, 95% CI [.66, .89]; specificity = .85, 95% CI [.80, .89]; PPV = .49, 95% CI [.38, .60]; NPV = .96, 95% CI [.93, .98]; LR+ = 5.37, 95% CI [3.87, 7.45]; LR− = 0.24, 95% CI [0.13, 0.42]; Youden's J = .65

Table 1. PHQ-9 Screen Results by Interview Diagnosis

Example
DepressedNot DepressedTotal
Screen positive (PHQ-9 ≥ 10) 363874
Screen negative (PHQ-9 ≤ 9) 9217226
Total 45255300

Note. N = 300 primary-care patients (simulated). A positive screen is a PHQ-9 score of 10 or more; diagnoses are from a structured clinical interview done without the PHQ-9 score.

Table 2. Accuracy of the PHQ-9 at a Cutoff of 10

Example
Correct / TotalEstimate95% CI
Sensitivity 36 / 45.80[.66, .89]
Specificity 217 / 255.85[.80, .89]
Positive predictive value 36 / 74.49[.38, .60]
Negative predictive value 217 / 226.96[.93, .98]

Note. Intervals are Wilson score intervals. Predictive values apply at this sample's base rate of 15%.

Full Text (APA Style)

Example

Of the 300 patients, 45 (15%) had major depression on the structured interview (Table 1). At a cutoff of 10, the PHQ-9 identified 36 of the 45 depressed patients, a sensitivity of .80, 95% CI [.66, .89], and correctly screened out 217 of the 255 who were not depressed, a specificity of .85, 95% CI [.80, .89] (Table 2). At this base rate, fewer than half of the positive screens were confirmed, a positive predictive value of .49, 95% CI [.38, .60], while 96% of negative screens were correct, NPV = .96, 95% CI [.93, .98]. After a positive screen, the odds that a patient was depressed were about five times the pre-screen odds, LR+ = 5.37, 95% CI [3.87, 7.45]; after a negative screen, about a quarter of them, LR− = 0.24, 95% CI [0.13, 0.42]. Intervals for proportions are Wilson score intervals; intervals for likelihood ratios use the log method (Simel et al., 1991).

  • Give the full 2 × 2 table (STARD item 23), so readers can recompute anything, including predictive values at their own base rate.
  • Report each index with its 95% interval (STARD item 24), and name the interval method: Wilson for the proportions, the log method for likelihood ratios. Sensitivity rests on only the people with the condition, so its interval is the wide one.
  • State the cutoff and whether it was fixed in advance, and give the base rate next to the predictive values.
  • Follow the STARD 2015 checklist (Bossuyt et al., 2015) for the rest: how participants were recruited, the reference standard, and who was blind to what.

Reading Each Piece

The equation form above, piece by piece, in this order: how big, then how certain.

Sensitivity = .80 The PHQ-9 flagged 80% of the patients the interview found depressed, and missed 9 of 45.
95% CI [.66, .89] The true sensitivity is plausibly anywhere from about two thirds to nine in ten. With only 45 depressed patients, that's a wide range.
Specificity = .85 The PHQ-9 correctly cleared 85% of the patients without depression; the other 15%, 38 patients, screened positive anyway.
95% CI [.80, .89] The true specificity is plausibly between 80% and 89%. It's pinned down more tightly than sensitivity because it rests on 255 patients, not 45.
PPV = .49 Fewer than half of the patients who screened positive were depressed. That's not a flaw in the arithmetic: with only 15% depressed, the 15% false-alarm rate among the other 255 patients produces as many false positives (38) as the screen finds true ones (36).
95% CI [.38, .60] In clinics like this one, somewhere between about 4 and 6 in 10 positive screens would be confirmed by an interview.
NPV = .96 96% of the patients who screened negative really weren't depressed. Much of that comes from depression being uncommon here: 85% of patients would have been correctly called negative by a screen that said no to everyone.
95% CI [.93, .98] Somewhere between 93% and 98% of negative screens in clinics like this would be right.
LR+ = 5.37 A positive screen is about five times as likely in a depressed patient as in a non-depressed one, so it multiplies the odds that the patient is depressed by 5.37. A useful nudge, not a diagnosis.
LR− = 0.24 A negative screen cuts the odds that the patient is depressed to about a quarter of what they were, taking a patient's chance from 15% to about 4%.
95% CI [3.87, 7.45] For LR+, by the log method (Simel et al., 1991): the log of a ratio is closer to normal than the ratio itself, so the interval is built on that scale and turned back. A positive screen plausibly multiplies the odds somewhere between about 4 and 7 times.
95% CI [0.13, 0.42] For LR−, by the same method. Resting on only 9 missed cases, it's imprecise: a negative screen could cut the odds to anywhere from about an eighth to about two fifths.
Youden's J = .65 The screen's true-positive rate (.80) is .65 higher than its false-positive rate (.15). It treats a missed case and a false alarm as equally bad, which for depression screening they aren't.

Calculations

The Running Example

Example

The depression-screening study: 300 primary-care patients, each with a PHQ-9 score (positive at 10 or more) and a structured interview diagnosis of major depression or not, done without seeing the score.

There's no hypothesis test here. The question is how accurate the screen is, so the page estimates each accuracy index with a 95% confidence interval. Testing whether sensitivity is above zero, or whether the screen and interview are related at all, would ask far too little of a screen.

What Your Data Should Look Like

One row per person, with the test result and the reference-standard diagnosis in separate columns, each coded the same way (here 1 = positive or depressed, 0 = not). Keeping the raw score too, as here with phq9, lets you recompute everything at another cutoff. Software counts the rows into a 2 × 2 table of test result by diagnosis; the percentages within each diagnosis column are the sensitivity and specificity.

Example
patientphq9screen_positivedepressed
1900
22211
31010
4200
5200
6300
… 294 more rows
DepressedNot DepressedTotal
Screen Positive (PHQ-9 ≥ 10)36 (80%)38 (15%)74
Screen Negative (PHQ-9 ≤ 9)9 (20%)217 (85%)226
Total45255300

Counts, with the percentage of each interview (each column adds to 100%).

Simulated data.

Download all 300 rows (data.csv)

Napkin Math

The whole test, one idea at a time. Under each heading, a line says why the step matters, and the green note reads the equation in plain English with the depression-screening study's numbers. Collapse all to read just the headings: they tell the whole story on their own.

  1. 1. Sort Every Patient into One of Four Boxes

    Each patient either has depression or doesn't, by the interview, and either screens positive or doesn't. That makes four kinds of patient: two kinds of right answer (true positives and true negatives) and two kinds of mistake (false positives and false negatives).

    \begin{array}{l|cc} & \text{Depressed} & \text{Not depressed} \\ \hline \text{Screen +} & a & b \\ \text{Screen −} & c & d \end{array} =\begin{array}{l|cc} & \text{Dep.} & \text{Not} \\ \hline \text{+} & 36 & 38 \\ \text{−} & 9 & 217 \end{array}

    a = 36 patients

    b = 38 patients

    c = 9 patients

    d = 217 patients

    \pi = .15

    a is the 36 true positives, depressed patients the PHQ-9 caught, and c the 9 false negatives it missed. b is the 38 false positives, non-depressed patients it flagged anyway, and d the 217 true negatives it correctly cleared. 45 of the 300 were depressed, a base rate \pi of 45 ÷ 300 = .15.

  2. 2. Find How Many Depressed Patients the Screen Catches

    The first job of a screen is to find the people who need help. Look only at the depressed patients and ask what share screened positive.

    \text{Se} = \dfrac{a}{a + c} =\dfrac{36}{36 + 9} = \dfrac{36}{45}

    = .80

    a is the 36 depressed patients who screened positive and a + c is all 45 depressed patients. 36 ÷ 45 = .80, so the PHQ-9 caught 4 in 5 and missed 1 in 5.

  3. 3. Find How Many Non-Depressed Patients the Screen Clears

    The second job is to leave everyone else alone. Look only at the patients without depression and ask what share screened negative.

    \text{Sp} = \dfrac{d}{b + d} =\dfrac{217}{38 + 217} = \dfrac{217}{255}

    = .85

    d is the 217 non-depressed patients who screened negative and b + d is all 255 non-depressed patients. 217 ÷ 255 = .85, so about 15% of them, 38 people, got a false alarm.

  4. 4. Give a Range of Plausible Values for Each

    Sensitivity rests on only 45 patients, so another sample could easily give .70 or .90. The Wilson interval gives the range of true values that fit the data, and unlike the simpler ± formula, p̂ ± 1.96 × √(p̂(1 − p̂) / n), it behaves well with small counts and proportions near 1.

    \dfrac{x + z^{*2}/2}{n + z^{*2}} \pm \dfrac{z^{*}\sqrt{n}}{n + z^{*2}}\sqrt{\hat{p}(1 - \hat{p}) + \dfrac{z^{*2}}{4n}} =\dfrac{36 + 1.92}{45 + 3.84} \pm \dfrac{1.96\sqrt{45}}{45 + 3.84}\sqrt{.80 \times .20 + \dfrac{3.84}{4 \times 45}}

    \text{Se} = [.66, .89]

    \text{Sp} = [.80, .89]

    For sensitivity, x = 36 caught out of n = 45, and z^{*} = 1.96 (so z^{*2} = 3.84). The centre is 37.92 ÷ 48.84 = .776, pulled a little toward .50, and the margin is .115, so the range runs from .66 to .89. The same recipe for specificity, 217 of 255, gives .80 to .89.

  5. 5. Find How Often a Positive Screen Is Right

    A patient with a positive screen doesn't care about sensitivity. They want to know how likely it is that they're depressed. Look only at the positive screens and ask what share were confirmed.

    \text{PPV} = \dfrac{a}{a + b} =\dfrac{36}{36 + 38} = \dfrac{36}{74}

    = .49

    \text{NPV} = .96

    \text{PPV} = [.38, .60]

    \text{NPV} = [.93, .98]

    a is the 36 true positives and a + b is all 74 positive screens. 36 ÷ 74 = .49: more than half the positive screens were false alarms. The negative screens, d \div (c + d) = 217 ÷ 226 = .96, were almost all right.

  6. 6. Work Out What a Positive Screen Would Mean Where Depression Is Rarer

    Sensitivity and specificity travel from one setting to another far better than predictive values do. Bayes' theorem rebuilds the PPV for any base rate: of everyone screened, what share are true positives, and what share false alarms?

    \text{PPV} = \dfrac{\text{Se} \times \pi}{\text{Se} \times \pi + (1 - \text{Sp})(1 - \pi)} =\dfrac{.80 \times .05}{.80 \times .05 + .149 \times .95} = \dfrac{.040}{.040 + .142}

    = .22

    In a community survey where only \pi = 5% are depressed, the same screen (\text{Se} = .80, 1 - \text{Sp} = .149) would find 40 true positives per 1,000 people screened but raise 142 false alarms. 40 ÷ 182 = .22: only about 1 positive screen in 5 would be right. At our own 15%, the same formula gives back .49.

  7. 7. Say How Much Each Result Shifts the Odds

    Likelihood ratios package sensitivity and specificity into how strongly a result should change your mind, whatever the base rate. A positive result is this many times more common in depressed patients than in everyone else.

    \text{LR}_{+} = \dfrac{\text{Se}}{1 - \text{Sp}}, \quad \text{LR}_{-} = \dfrac{1 - \text{Se}}{\text{Sp}} =\text{LR}_{-} = \dfrac{.20}{.851} = 0.24, \quad \text{LR}_{+} = \dfrac{.80}{1 - .851} = \dfrac{.80}{.149}

    = 5.37

    \text{LR}_{-} = 0.24

    \text{LR}_{-} = [0.13, 0.42]

    \text{LR}_{+} = [3.87, 7.45]

    \text{Se} = .80 of depressed patients screen positive, against 1 - \text{Sp} = .149 of the rest, so a positive result is 5.37 times as common in depression. A negative result is .20 ÷ .851 = 0.24 times as common. Odds compare the chance of having depression with the chance of not having it: before the screen, 45 to 255, or .15 ÷ .85 = 0.176, about 1 to 6. Multiplying by the likelihood ratio gives the odds after a positive screen, 0.176 × 5.37 = 0.95, and odds ÷ (1 + odds) turns them back into a chance: 0.95 ÷ 1.95 = .49, the PPV again.

  8. 8. Sum Up the Screen's Accuracy in One Number

    Youden's index adds sensitivity and specificity and subtracts 1, so a test that guesses scores 0 and a perfect test scores 1. (It goes below 0 only when a test does worse than guessing, which usually means the positive and negative codes are swapped.) It's handy for comparing cutoffs, but it hides which kind of mistake the test makes.

    J = \text{Se} + \text{Sp} - 1 =.80 + .851 - 1

    = .65

    \text{Se} = .80 plus \text{Sp} = .851 is 1.651; minus 1 is .65. The screen gets about two thirds of the way from a useless test (one that flags cases and non-cases at the same rate) to a perfect one.

Run It in Software

The code below reads the running example's data from data.csv; save it in the same folder you run the code from.

SPSS (version 30, as documented by IBM)
  1. Analyze → Descriptive Statistics → Crosstabs. Move screen_positive into Row(s) and depressed into Column(s).
  2. Click Cells, check Column and Row under Percentages, click Continue, then OK. The column percentages give sensitivity and specificity; the row percentages give the predictive values.
  3. For Wilson intervals, split the file by depressed (Data → Split File → Compare groups), then Analyze → Compare Means and Proportions → One-Sample Proportions. Move screen_positive into Test Variable(s), choose the Wilson Score interval, and click OK. The syntax below hasn't been run in SPSS; if it errors, set the dialog up this way and click Paste to get your version's keywords.

Or paste this syntax:

CROSSTABS
  /TABLES=screen_positive BY depressed
  /CELLS=COUNT ROW COLUMN.

* Wilson intervals: the proportion screening positive within each diagnosis.
SORT CASES BY depressed.
SPLIT FILE LAYERED BY depressed.
PROPORTIONS
  /ONESAMPLE screen_positive TESTTYPES=NONE CITYPES=WILSON_SCORE
  /SUCCESS VALUE=LEVEL(1).
SPLIT FILE OFF.

Reading the Output

Read the Crosstabulation first. In the depressed = 1 column, the "% within depressed" for screen_positive = 1 is the sensitivity (80.0%); in the depressed = 0 column, the percentage for screen_positive = 0 is the specificity (85.1%). The "% within screen_positive" in the row for 1 is the PPV (48.6%), and in the row for 0 the NPV (96.0%). SPSS sorts the codes, so 0 comes before 1.

screen_positive * depressed Crosstabulation

depressed 0 depressed 1 Total
screen_positive 0 Count 217 9 226
% within screen_positive 96.0% 4.0% 100.0%
% within depressed 85.1% 20.0% 75.3%
screen_positive 1 Count 38 36 74
% within screen_positive 51.4% 48.6% 100.0%
% within depressed 14.9% 80.0% 24.7%
Total Count 255 45 300
% within screen_positive 85.0% 15.0% 100.0%
% within depressed 100.0% 100.0% 100.0%

One-Sample Proportions then gives the proportion screening positive within each diagnosis, with its Wilson interval. For depressed patients that's the sensitivity, .800, [.662, .891]. For the others it's the false-positive rate, .149, [.111, .198]; subtract from 1 for the specificity's interval, [.802, .889]. SPSS doesn't print likelihood ratios, their intervals or Youden's J; work them out from the table.

Output laid out from this page's computed results, not captured from a live run; labels and layout may differ slightly in your version.

R
screening <- read.csv("data.csv")
tab <- table(screen = screening$screen_positive, interview = screening$depressed)
tab <- tab[c("1", "0"), c("1", "0")]   # positives and depressed first
tab

# Sensitivity and specificity, each with a Wilson score interval
prop.test(tab["1", "1"], sum(tab[, "1"]), correct = FALSE)$conf.int
prop.test(tab["0", "0"], sum(tab[, "0"]), correct = FALSE)$conf.int

sens <- tab["1", "1"] / sum(tab[, "1"])
spec <- tab["0", "0"] / sum(tab[, "0"])
ppv  <- tab["1", "1"] / sum(tab["1", ])
npv  <- tab["0", "0"] / sum(tab["0", ])
round(c(sensitivity = sens, specificity = spec, PPV = ppv, NPV = npv,
        LR_pos = sens / (1 - spec), LR_neg = (1 - sens) / spec,
        youden = sens + spec - 1), 3)

# Likelihood ratios' 95% intervals, by the log method
a <- tab["1", "1"]; b <- tab["1", "0"]; c <- tab["0", "1"]; d <- tab["0", "0"]
se_pos <- sqrt(1/a - 1/(a + c) + 1/b - 1/(b + d))
se_neg <- sqrt(1/c - 1/(a + c) + 1/d - 1/(b + d))
round(exp(log(sens / (1 - spec)) + c(-1.96, 1.96) * se_pos), 2)
round(exp(log((1 - sens) / spec) + c(-1.96, 1.96) * se_neg), 2)
      interview
screen   1   0
     1  36  38
     0   9 217
[1] 0.6617703 0.8910387
attr(,"conf.level")
[1] 0.95
[1] 0.8020776 0.8894654
attr(,"conf.level")
[1] 0.95
sensitivity specificity         PPV         NPV      LR_pos      LR_neg
      0.800       0.851       0.486       0.960       5.368       0.235
     youden
      0.651
[1] 3.87 7.45
[1] 0.13 0.42

prop.test(..., correct = FALSE) gives the Wilson score interval. Leave out correct = FALSE and R adds a continuity correction, which widens it; binom.test() gives the exact Clopper-Pearson interval instead ([.654, .904] for sensitivity).

Output from a real run: R 4.6.1, run 2026-10-10.

Python
import pandas as pd
from statsmodels.stats.proportion import proportion_confint

screening = pd.read_csv("data.csv")
table = pd.crosstab(screening["screen_positive"], screening["depressed"]).loc[[1, 0], [1, 0]]
print(table)

a, b = table.loc[1, 1], table.loc[1, 0]   # true and false positives
c, d = table.loc[0, 1], table.loc[0, 0]   # false negatives and true negatives

for name, x, n in [("sensitivity", a, a + c), ("specificity", d, b + d),
                   ("PPV", a, a + b), ("NPV", d, c + d)]:
    lo, hi = proportion_confint(x, n, method="wilson")
    print(f"{name:12} {x / n:.3f}  95% CI [{lo:.3f}, {hi:.3f}]")
depressed         1    0
screen_positive
1                36   38
0                 9  217
sensitivity  0.800  95% CI [0.662, 0.891]
specificity  0.851  95% CI [0.802, 0.889]
PPV          0.486  95% CI [0.376, 0.598]
NPV          0.960  95% CI [0.926, 0.979]

proportion_confint uses the Wald interval unless you pass method="wilson".

Output from a real run: Python 3.9.6 (statsmodels 0.14.6, pandas 2.3.3), run 2026-10-03.

Impact

Effect Size

There's no single effect size for a screen. Sensitivity and specificity together describe how well it separates the two groups, and they have to be read as a pair: a screen that calls everyone positive has perfect sensitivity and no specificity at all. Likelihood ratios recast the pair as how far each result shifts the odds. Youden's J (Youden, 1950) and the diagnostic odds ratio often met in meta-analyses (LR+ ÷ LR−, here 22.8) fold it into one number, hiding which mistake the test makes. Predictive values say what a result means in one particular setting.

\text{PPV} = \dfrac{\text{Se} \times \pi}{\text{Se} \times \pi + (1 - \text{Sp})(1 - \pi)}

The same PHQ-9, with sensitivity .80 and specificity .851, means very different things in different places. Per 1,000 patients screened: where 5% are depressed, it finds 40 true cases among 182 positives (PPV .22); in our clinic, at 15%, 120 among 247 (PPV .49); in a mental-health clinic where 40% are depressed, 320 among 409 (PPV .78).

That's the key point of this page: sensitivity and specificity describe the test; predictive values describe the test in a setting. Meehl and Rosen (1955) made the case to psychologists long ago: a sign or cutting score has to be judged against the base rate, and it earns its place only if it leads to more correct decisions than the base rate alone. Levis et al. (2019) make the same point with real PHQ-9 data: at their pooled sensitivity of .88 and specificity of .85, and a base rate of 14%, about half of all positive screens would be false positives. Their .88 and .85 are close to the .88 and .88 that Kroenke et al. (2001) reported in the original validation at the same cutoff. Sensitivity and specificity aren't perfectly fixed either. They depend on the cutoff, on the sample of people they were estimated in, and on the reference standard (Trevethan, 2017).

The table gives a usable PPV only because the 300 patients were a consecutive series from one clinic. If you recruit cases and non-cases separately, say 100 of each, the table's base rate is your choice, not a fact about any clinic: at 50% this screen's PPV would be .84. Rebuild predictive values with Bayes' theorem from a real setting's base rate instead.

Moving the cutoff trades one kind of mistake for the other. In our simulated scores, a cutoff of 8 catches 40 of the 45 depressed patients (sensitivity .89) but flags 60 of the others (specificity .76); a cutoff of 12 catches 34 (.76) and flags only 22 (.91). Several nearby cutoffs have a higher Youden's J here than 10 does (.65), highest at 11 (.69), but choosing one because it won in this sample would flatter it. (In these simulated scores no depressed patient scored exactly 10, so moving to 11 happens to lose no cases. In real data, each step of the cutoff usually costs some.)

Whether 9 missed cases and 38 false alarms per 300 patients is acceptable depends on what follows a positive screen. If it's a 20-minute clinical interview, false alarms are cheap and missed cases are costly, which argues for a lower cutoff.

Uncertainty

This page doesn't test a null hypothesis, so there's no p. You could test whether the screen and the interview are related (a chi-square test on the 2 × 2 table), but a screen barely better than chance would pass that test in a large enough sample. The useful questions are how accurate the screen is and how precisely you know it, which is what the estimates and their confidence intervals answer.

The sensitivity of .80 comes with an interval from .66 to .89. With 45 depressed patients, the data fit a screen that misses 1 case in 3 as well as one that misses 1 in 10. The specificity, from 255 patients, is known much more precisely, .80 to .89.

The intervals here are Wilson score intervals (Wilson, 1927). The simpler Wald interval, p̂ ± 1.96 × √(p̂(1 − p̂) / n), misbehaves when counts are small or proportions are near 0 or 1, which is exactly where sensitivities and specificities tend to live; Brown, Cai and DasGupta (2001) recommend the Wilson interval instead. Some software gives the exact Clopper-Pearson interval, which is a little wider. Say which you used.

An interval that clears some value isn't a verdict that the screen is good enough. That depends on what the screen is for.

Precision and Sample Size

Power is the chance that a study detects an effect that's really there. There's no effect to detect here, so the planning question is precision: how many people you need for the interval around sensitivity (or specificity) to be narrow enough to be useful. STARD asks studies to report their intended sample size and how it was set (Bossuyt et al., 2015).

The catch is that sensitivity is estimated only from the people who have the condition. When the condition is uncommon, you need to recruit many people to get enough cases (Buderer, 1996).

Suppose we expect a sensitivity of about .80 and want a 95% Wilson interval whose half-width is .10 (a total width of .20). That needs about 60 depressed patients. At a base rate of 15%, that means screening about 60 ÷ .15 = 400 patients. Our 45 depressed patients give a half-width of .115 (.66 to .89, not quite symmetric around .80).

Plan the number of people with the condition first, then divide by the base rate you expect to get the total sample. Do the same for specificity: plan the number of people without the condition and divide by 1 minus the base rate. Recruit the larger of the two totals. In the planner below, set the expected sensitivity; its sample size is the number of people with the condition, not the total. Try it:

Other Info

Follow-Up and Post Hoc Tests

None. This page estimates rather than tests, so there are no follow-up comparisons to run.

References

  • Bossuyt, P. M., Reitsma, J. B., Bruns, D. E., Gatsonis, C. A., Glasziou, P. P., Irwig, L., Lijmer, J. G., Moher, D., Rennie, D., de Vet, H. C. W., Kressel, H. Y., Rifai, N., Golub, R. M., Altman, D. G., Hooft, L., Korevaar, D. A., Cohen, J. F., & the STARD Group. (2015). STARD 2015: An updated list of essential items for reporting diagnostic accuracy studies. BMJ, 351, h5527. https://doi.org/10.1136/bmj.h5527
    “Estimates of diagnostic accuracy and their precision (such as 95% confidence intervals)” (Table 1, item 24)
    “Cross tabulation of the index test results (or their distribution) by the results of the reference standard” (Table 1, item 23)
    “Whether clinical information and index test results were available to the assessors of the reference standard” (Table 1, item 13b)
    “Whether participants formed a consecutive, random, or convenience series” (Table 1, item 9)
  • Trevethan, R. (2017). Sensitivity, specificity, and predictive values: Foundations, pliabilities, and pitfalls in research and practice. Frontiers in Public Health, 5, 307. https://doi.org/10.3389/fpubh.2017.00307
    “the four metrics should not be regarded as unquestionably valid and fixed attributes of a screening test: the values that are entered into the cells of Figure 1 depend on how stringent the screening test is and the prevalence of the target condition in the sample of people used in the analysis.” (Determining Sensitivity, Specificity, and Predictive Values)
    “Predictive values are more relevant than are sensitivity and specificity when people are being screened.” (Assessing Desirable Predictive Values and Consequences for Sensitivity and Specificity)
  • Levis, B., Benedetti, A., Thombs, B. D., & the DEPRESsion Screening Data (DEPRESSD) Collaboration. (2019). Accuracy of Patient Health Questionnaire-9 (PHQ-9) for screening to detect major depression: Individual participant data meta-analysis. BMJ, 365, l1476. https://doi.org/10.1136/bmj.l1476
    “Across cut-off scores 5-15, sensitivity with semistructured interviews was 5-22% higher than for fully structured interviews (MINI excluded; 14 studies, 7680 participants) and 2-15% higher than for the MINI (15 studies, 2952 participants).” (Abstract, Results)
    “Using our cut-off 10 accuracy estimates (sensitivity 0.88, specificity 0.85), the positive predictive value would be only 49%; thus 51% of all positive screens would be false positives.” (Discussion)
  • Kroenke, K., Spitzer, R. L., & Williams, J. B. W. (2001). The PHQ-9: Validity of a brief depression severity measure. Journal of General Internal Medicine, 16(9), 606–613. https://doi.org/10.1046/j.1525-1497.2001.016009606.x
    “Using the MHP reinterview as the criterion standard, a PHQ-9 score ≥10 had a sensitivity of 88% and a specificity of 88% for major depression.” (Abstract)
  • Wilson, E. B. (1927). Probable inference, the law of succession, and statistical inference. Journal of the American Statistical Association, 22(158), 209–212. https://doi.org/10.1080/01621459.1927.10502953
  • Simel, D. L., Samsa, G. P., & Matchar, D. B. (1991). Likelihood ratios with confidence: Sample size estimation for diagnostic test studies. Journal of Clinical Epidemiology, 44(8), 763–770. https://doi.org/10.1016/0895-4356(91)90128-V
  • Brown, L. D., Cai, T. T., & DasGupta, A. (2001). Interval estimation for a binomial proportion. Statistical Science, 16(2), 101–133. https://doi.org/10.1214/ss/1009213286
    “Based on this analysis, we recommend the Wilson interval or the equal-tailed Jeffreys prior interval for small n and the interval suggested in Agresti and Coull for larger n.” (Abstract, p. 101)
  • Youden, W. J. (1950). Index for rating diagnostic tests. Cancer, 3(1), 32–35. https://doi.org/10.1002/1097-0142(1950)3:1<32::AID-CNCR2820030106>3.0.CO;2-3
  • Meehl, P. E., & Rosen, A. (1955). Antecedent probability and the efficiency of psychometric signs, patterns, or cutting scores. Psychological Bulletin, 52(3), 194–216. https://doi.org/10.1037/h0048070
  • Buderer, N. M. (1996). Statistical methodology: I. Incorporating the prevalence of disease into the sample size calculation for sensitivity and specificity. Academic Emergency Medicine, 3(9), 895–900. https://doi.org/10.1111/j.1553-2712.1996.tb03538.x

Spot an error? Something still confusing? Tell us at support@statsforpsychology.com.