Let's assume that 5% of the population has disease D. We have a test that determines if a person has that disease. For people who do have the disease, the test is accurate 95% and 90% for people who do not have the disease. What is the probability of an accurate diagnosis for a randomly selected person?
My attempt:
Events
$D = \{$ random person has the disease $\} \implies \mathbb{P}(D)=5\% = 0.05$
$\overline{D} = \{$ random person doesn't have the disease $\}\implies \mathbb{P}(\overline{D})=1-\mathbb{P}(D) = 0.95$
$T = \{$ test gives a positive result (the disease is present) $\}$
$\overline{T} = \{$ test gives a negative result (no disease) $\}$
For people who have the disease, the test is 95% accurate $\implies \mathbb{P}(T|D)=0.95$.
For people who don't have the disease, the test is 90% accurate $\implies \mathbb{P}(\overline{T}|\overline{D})=0.90$.
5% of the total population has the disease and out of those 5%, the test will correctly diagnose 95% i.e.
$\mathbb{P}(D)\cdot\mathbb{P}(T|D) = 0.05 \cdot 0.95 = 0.0475$
95% of the total population doesn't have the disease and out of those 95%, the test will correctly diagnose 90% i.e.
$\mathbb{P}(\overline{D})\cdot\mathbb{P}(\overline{T}|\overline{D}) = 0.95 \cdot 0.90 = 0.855$
We conclude that the test will correctly diagnose $0.0475 + 0.855 = 0.9025 = 90.25\%$ of the total population i.e. for a randomly selected person, the probability of a correct diagnosis is $90.25\%$.