Un’applicazione importantissima della probabilità condizionata sono i test diagnostici (medici, antidoping, di qualità). Un test non è mai perfetto: può dare falsi positivi o falsi negativi. Da qui nascono tre quantità chiave — sensibilità, specificità e precisione — e il celebre “paradosso dei test rari”, in cui un test apparentemente ottimo diventa poco affidabile su una malattia poco diffusa. Il teorema di Bayes è lo strumento che permette di calcolare ciò che davvero interessa al paziente.

A hugely important application of conditional probability are diagnostic tests (medical, anti-doping, quality). A test is never perfect: it can give false positives or false negatives. From here arise three key quantities — sensitivity, specificity and precision — and the celebrated “paradox of rare tests”, in which an apparently excellent test becomes unreliable for a rarely occurring illness. Bayes’ theorem is the tool that lets us calculate what really interests the patient.

Un’applicazione importantissima della probabilità condizionata sono i test diagnostici (medici, antidoping, di qualità, ecc.). Un test non è mai perfetto: può dare falsi positivi (allarme senza malattia) o falsi negativi (malattia non rilevata).

Definiamo:

  • AA = “il soggetto è effettivamente malato”;
  • BB = “il test dà esito positivo”.

Le quattro combinazioni possibili sono:

AA (malato)A\overline{A} (sano)
BB (test ++)vero positivo (TPTP)falso positivo (FPFP)
B\overline{B} (test -)falso negativo (FNFN)vero negativo (TNTN)

A partire da questa tabella si definiscono tre quantità importanti.

Definizione

  • Sensibilità (o recall) =TPTP+FN=P(BA)= \dfrac{TP}{TP+FN} = P(B\mid A): probabilità di essere positivo al test sapendo di essere malato. Un test sensibile “non si fa scappare” i malati.
  • Specificità =TNTN+FP=P(BA)= \dfrac{TN}{TN+FP} = P(\overline{B}\mid \overline{A}): probabilità di essere negativo al test sapendo di essere sano. Un test specifico “non dà falsi allarmi”.
  • Precisione (o valore predittivo positivo) =TPTP+FP=P(AB)= \dfrac{TP}{TP+FP} = P(A\mid B): se il test è positivo, qual è la probabilità di essere davvero malato? È la quantità più utile per il paziente, e la domanda a cui risponde il teorema di Bayes.

Attenzione — Paradosso dei test rari

Un test con alta sensibilità e alta specificità può comunque avere bassa precisione se la malattia è rara. Questo è il famoso “paradosso dei test rari”: se solo 11 persona su 1000010\,000 è malata, anche un test al 99%99\% di sensibilità e 99%99\% di specificità produce un numero di falsi positivi paragonabile al numero di veri positivi, e P(AB)P(A\mid B) risulta molto più bassa di quanto ci si aspetterebbe. È lo stesso meccanismo dei test su malattie a bassa prevalenza: con una malattia allo 0,1%0{,}1\%, sensibilità 99%99\% e specificità 98%98\%, la precisione era solo del 4,7%4{,}7\%.

Collegamenti

Argomenti: Probabilita
Concetti: Precisione · Probabilita condizionata · Sensibilita · Specificita · Teorema di bayes
Competenze: Calcolo probabilita

A hugely important application of conditional probability are diagnostic tests (medical, anti-doping, quality, etc.). A test is never perfect: it can give false positives (an alarm without illness) or false negatives (an illness not detected).

Let us define:

  • AA = “the subject is actually ill”;
  • BB = “the test gives a positive result”.

The four possible combinations are:

AA (ill)A\overline{A} (healthy)
BB (test ++)true positive (TPTP)false positive (FPFP)
B\overline{B} (test -)false negative (FNFN)true negative (TNTN)

From this table three important quantities are defined.

Definition

  • Sensitivity (or recall) =TPTP+FN=P(BA)= \dfrac{TP}{TP+FN} = P(B\mid A): the probability of testing positive given that one is ill. A sensitive test “does not let the ill slip through”.
  • Specificity =TNTN+FP=P(BA)= \dfrac{TN}{TN+FP} = P(\overline{B}\mid \overline{A}): the probability of testing negative given that one is healthy. A specific test “does not raise false alarms”.
  • Precision (or positive predictive value) =TPTP+FP=P(AB)= \dfrac{TP}{TP+FP} = P(A\mid B): if the test is positive, what is the probability of actually being ill? It is the most useful quantity for the patient, and the question that Bayes’ theorem answers.

Caution — The paradox of rare tests

A test with high sensitivity and high specificity can nonetheless have low precision if the illness is rare. This is the famous “paradox of rare tests”: if only 11 person in 1000010\,000 is ill, even a test with 99%99\% sensitivity and 99%99\% specificity produces a number of false positives comparable to the number of true positives, and P(AB)P(A\mid B) turns out to be much lower than one would expect. It is the same mechanism as tests for low-prevalence illnesses: with an illness at 0,1%0{,}1\%, sensitivity 99%99\% and specificity 98%98\%, the precision was only 4,7%4{,}7\%.

Topics: Probability
Concepts: Precision · Conditional probability · Sensitivity · Specificity · Bayes’ theorem
Skills: Probability calculation

Esempio — Test epidemiologico

Un test per una malattia rara ha P(A)=0,003P(A) = 0,003 (la malattia colpisce 33 persone su 10001000), P(AB)=0,7P(A\mid B) = 0,7 (precisione) e P(AB)=0,0001P(A\mid \overline{B}) = 0,0001. Riempiamo la tabella di contingenza usando 1000010\,000 persone come popolazione di riferimento.

AA (malato)A\overline{A} (sano)Totale
BB (test ++)2121993030
B\overline{B} (test -)9999619\,96199709\,970
Totale303099709\,9701000010\,000

Da qui si leggono direttamente le tre quantità caratteristiche del test:

  • Sensibilità =P(BA)=2130=70%= P(B\mid A) = \dfrac{21}{30} = 70\%
  • Specificità =P(BA)=9961997099,9%= P(\overline{B}\mid\overline{A}) = \dfrac{9961}{9970} \approx 99,9\%
  • Precisione =P(AB)=2130=70%= P(A\mid B) = \dfrac{21}{30} = 70\%

Un test usato bene: pochi falsi positivi e una specificità molto alta.

Collegamenti

Argomenti: Probabilita
Concetti: Precisione · Sensibilita · Specificita · Tabella di contingenza
Metodi: Bayes · Prob totale
Competenze: Calcolo probabilita

Example — Epidemiological test

A test for a rare illness has P(A)=0,003P(A) = 0,003 (the illness strikes 33 people in 10001000), P(AB)=0,7P(A\mid B) = 0,7 (precision) and P(AB)=0,0001P(A\mid \overline{B}) = 0,0001. Let us fill in the contingency table using 1000010\,000 people as the reference population.

AA (ill)A\overline{A} (healthy)Total
BB (test ++)2121993030
B\overline{B} (test -)9999619\,96199709\,970
Total303099709\,9701000010\,000

From here the three characteristic quantities of the test can be read directly:

  • Sensitivity =P(BA)=2130=70%= P(B\mid A) = \dfrac{21}{30} = 70\%
  • Specificity =P(BA)=9961997099,9%= P(\overline{B}\mid\overline{A}) = \dfrac{9961}{9970} \approx 99,9\%
  • Precision =P(AB)=2130=70%= P(A\mid B) = \dfrac{21}{30} = 70\%

A well-used test: few false positives and a very high specificity.

Topics: Probability
Concepts: Precision · Sensitivity · Specificity · Contingency table
Methods: Bayes · Total probability
Skills: Probability calculation