S1547 of 56
0 XP
  1. Hook
  2. Play
  3. Predict
  4. Name it
  5. Check
  6. Explain

S15 · Lesson 47 · Diagnostic accuracy, device software and regulation

Sensitivity and specificity from a threshold, predictive values and prevalence by Bayes' rule, likelihood ratios and false alarms, embedded systems inside medical devices, software safety classes and cybersecurity, and how devices are classified and cleared for sale

A new screening device detects atrial fibrillation from a wristband with 95% sensitivity and 90% specificity. That sounds excellent, until it is sold to millions of healthy people, of whom about 2% have the condition: then only one positive result in six is real. And before it could be sold at all, its makers had to show regulators how the device's software was designed, tested and protected, and which class of risk it falls into. This lesson covers how a medical instrument's performance is judged and how it reaches patients.

  • A test's value is spread as a bell curve in healthy people (centered at 0) and in people with the condition (centered at d). Anyone above the threshold is called positive.
  • The curves show the test's sensitivity (the fraction of sick people called positive) and its specificity (the fraction of healthy people called negative) as the threshold moves.
  • Raising the threshold trades sensitivity for specificity. The readouts give both at the threshold you set, and the predictive value of a positive result at the prevalence you set. Lower the prevalence and watch the positive predictive value collapse even though the test hasn't changed.

Predict

A test has 95% sensitivity and 90% specificity. In a population where 2% have the disease, what fraction of positive results are true?

Name it

Diagnostic accuracy

Compare a test against a reference standard and count true and false positives and negatives (TP, FP, TN, FN):

  • sensitivity = TP/(TP + FN), the fraction of the diseased the test detects;
  • specificity = TN/(TN + FP), the fraction of the healthy it clears.

Both depend on where the threshold is set. Plotting sensitivity against 1 − specificity as the threshold sweeps gives the receiver operating characteristic (ROC); the area under it summarizes how well the test separates the groups whatever the threshold.

What a clinician needs is the probability of disease given the result. By Bayes' rule, with prevalence p,

PPV=sens⋅psens⋅p+(1−spec)(1−p),NPV=spec(1−p)spec(1−p)+(1−sens)p

The likelihood ratio of a positive result, sens/(1 − spec), multiplies the odds of disease before the test to give the odds after it.

Alarms

Monitors face the same arithmetic per event. A detector that misclassifies one heartbeat in 10,000 as an arrhythmia raises about 10 false alarms a day at 100,000 beats a day. Staff learn to ignore frequent false alarms, so alarm algorithms favor specificity, add delays and require confirmation over several beats.

Embedded systems in medical devices

Most instruments in this course end in a microcontroller: an amplifier and anti-alias filter, an ADC whose step referred to the input sets the resolution (lesson 1), processing such as QRS detection (lesson 52), a display, alarms, and often a wireless link. Webster's example is an ECG system on a small microcontroller board, streaming to a phone. Two concerns are specific to medicine:

  • Software safety. IEC 62304 assigns software a safety class by the worst harm a failure could contribute to: A (no injury), B (non-serious injury), C (death or serious injury). The class sets how much design documentation, verification and testing the software needs. Risk management (ISO 14971) identifies hazards and shows each is reduced to an acceptable level.
  • Cybersecurity. Connected devices, from infusion pumps to pacemakers with wireless programmers, must authenticate who can change their settings and protect patient data. Regulators now require a security plan and the ability to patch software.

Regulation

In the United States the FDA sorts devices into three classes by risk:

  • Class I (low risk, such as tongue depressors and stethoscopes): general controls, mostly exempt from premarket review.
  • Class II (moderate risk, such as ECG monitors, infusion pumps and most diagnostic equipment): usually a 510(k) submission showing the device is substantially equivalent to one already legally sold, plus special controls such as performance standards.
  • Class III (life-sustaining or implanted, such as pacemakers and implantable defibrillators): premarket approval (PMA), with clinical evidence of safety and effectiveness.

Electrical safety and essential performance are demonstrated against IEC 60601-1 and its collateral and particular standards (the leakage-current limits of lesson 46 come from it). Other regions use similar risk classes; the European Union requires a CE mark under its medical device regulation. Development follows design controls: documented user needs, requirements, design reviews, verification that the design meets its requirements, and validation that it meets the users' needs.

Worked example

A wristband rhythm test has 95% sensitivity and 90% specificity. Find its predictive values in a population with 2% prevalence, and what improving specificity to 99% does.

Show the solution
  1. Count each outcome. Per person tested: TP=0.95×0.02=0.019FP=0.10×0.98=0.098TN=0.90×0.98=0.882FN=0.05×0.02=0.001
  2. Positive predictive value. PPV=0.0190.019+0.098=0.0190.117=16%
  3. Negative predictive value. NPV=0.8820.882+0.001=0.8820.883=99.9% A negative result is very reassuring; a positive one usually isn't disease.
  4. With 99% specificity. The false positives fall from 98 to 9.8 per 1000: PPV=0.0190.019+0.0098=66%
  5. Likelihood ratio. It rises from 9.5 to 95: 0.950.10=9.50.950.01=95 For screening healthy people, specificity matters most.

Answer at 2% prevalence the PPV is 16% and the NPV 99.9%; raising specificity to 99% lifts the PPV to 66% and the likelihood ratio from 9.5 to 95.

Worked example

Classify these devices and the software in them: a bedside ECG monitor with arrhythmia alarms, and an implantable cardioverter-defibrillator.

Show the solution
  1. The bedside monitor's class. It is moderate risk: a Class II device cleared through a 510(k), compared against monitors already on the market and tested to IEC 60601-1 and the particular standard for ECG monitoring.
  2. Its software. The arrhythmia software could contribute to serious injury if it missed a lethal rhythm with no other safeguard, so it is likely safety class C.
  3. What can lower that. The class can be lowered if the risk analysis shows that hardware or procedures outside the software prevent that harm.
  4. The implantable defibrillator's class. It sustains life and is implanted: Class III, requiring premarket approval with clinical data.
  5. Its firmware. It decides when to shock, so it is class C, with the most rigorous verification, and its wireless programming link must be secured.

Answer the bedside monitor is a Class II device whose arrhythmia software is likely safety class C; the implantable defibrillator is Class III, with class C firmware.

Worked example

A new arrhythmia detector is expected to have 95% sensitivity. How many patients with the arrhythmia must a study enroll so that the 95% confidence interval's lower edge stays at or above 90%?

Show the solution
  1. Standard error of a sensitivity. The sensitivity is a proportion measured on the diseased patients: SE=p(1−p)n
  2. Sample size. Keeping 1.96 standard errors within 5 points needs n=1.962×0.95×0.050.052=73 diseased patients.
  3. People to screen. At a prevalence of 2% that means screening about 3650 people, which is why such studies enroll known cases, then test specificity separately on healthy volunteers.

Answer the study must enroll 73 patients with the arrhythmia.

Check

Against a reference standard, a test is positive in 90 of the patients who have the disease and negative in 3 of them. What's its sensitivity?

Check

Among healthy subjects the test is negative in 900 and positive in 20. What's its specificity?

Check

A test with sensitivity 0.95 and specificity 0.9 is used where the prevalence is 0.2. What's its positive predictive value?

Check

For the same test and prevalence (sensitivity 0.95, specificity 0.9, prevalence 0.2), what's the negative predictive value?

Check

What's the positive likelihood ratio of a test with sensitivity 0.9 and specificity 0.9?

Check

An arrhythmia detector falsely flags 2 beats in 100,000. How many false alarms does it raise for a patient with a heart rate of 60 beats/min monitored for 72 hours?

Check

Under the FDA's classification, which pathway does an infusion pump usually take to market?

Check

A study must show a sensitivity of about 0.95 with a 95% confidence half-width of 0.02, in a condition with prevalence 0.1.

(a)

How many patients with the condition must it include?

(b)

How many people would an unselected screening study need?

Check

A test has sensitivity s and specificity c, used at prevalence p.

Step 1

What is its positive predictive value?

Type it the way you would write it, like 3sin(2πft) or 3*sin(2*pi*f*t). Angles can be in radians or carry a degree sign, like 45°.

Explain why

Why does a test with excellent sensitivity and specificity produce mostly false positives when used to screen a healthy population?

Practice

Keep practicing

9 kinds of problem on this topic, dealt one at a time with new numbers every time, for as long as you like.