Hello, mauro21!
Suppose there was a cancer diagnostic test that was 95% accurate
both on those that do and those that do not have the disease.
If 4% of the population have cancer, compute the probability that a tested person
has cancer, given that his/her test result indicates so.
This is a Conditional Probability problem
. . and requires a lot of "translating".
Let C mean the person has cancer.
And ~C mean the person does not have cancer.
. . Then: .P(C) = 0.04, .P(~C) = 0.96
Let pos mean the test was positive for cancer.
Let neg means the test was negative for cancer.
The test is 95% accurate.
This means: if a person has cancer, 95% of the time the test will be posistive.
. . That is: .P(pos | C) = 0.95
And if a person does not have cancer, 95% of the time the test will be negative.
. . That is: .P(neg | ~C) = 0.95
We want the probability that the person has cancer, given that the test is positive.
. . That is: .P(C | pos)
. . . . . . . . . . . . . . . . . . . . . . . . P(C and pos)
Bayes' Theorem: . P(C | pos) . = . ---------------
. . . . . . . . . . . . . . . . . . . . . . . . . . P(pos)
For the numerator: .P(C and pos) .= .(0.04)(0.95) .= .0.038
For the denominator, there are two ways that the test can be positive.
. . (1) The person has cancer and the test is accurate: (0.04)(0.95) = 0.38
. . (2) The person does not have cancer and the test is wrong: (0.96)(0.05) = 0.048
Hence: .P(pos) .= .0.38 + 0.48 .= .0.086
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 0.038
Bayes' Theorem becomes: .P(C | pos) .= .------- .≈ .44%
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 0.086