A patient gets tested for a disease. The test is 90% reliable (that is P(testing positive│have disease)=.9 . 2% of the population has this disease. The test gives a false positive 5% of the time (that is P(testing positive│NOT diseased)=.05). What is the probability that the patient has the disease given that she tested positive?

To find the probability that the patient has the disease given that she tested positive, we can use Bayes' theorem. Bayes' theorem states that the probability of an event A occurring given that event B has occurred is equal to the probability of event B occurring given that event A has occurred, multiplied by the probability of event A occurring, divided by the probability of event B occurring.

Let's define the events:
A: The patient has the disease.
B: The patient tested positive.

We are given the following probabilities:
P(A) = 0.02 (2% of the population has the disease).
P(B|A) = 0.9 (the test is 90% reliable, so the probability of testing positive given that the patient has the disease is 0.9).
P(B|not A) = 0.05 (the test gives a false positive 5% of the time, so the probability of testing positive given that the patient does not have the disease is 0.05).

We want to find P(A|B), the probability that the patient has the disease given that she tested positive.

Using Bayes' theorem:
P(A|B) = (P(B|A) * P(A)) / P(B)

To find P(B), the probability of testing positive, we can use the law of total probability:
P(B) = P(B|A) * P(A) + P(B|not A) * P(not A)

P(not A) = 1 - P(A) = 1 - 0.02 = 0.98 (the probability of not having the disease).

Substituting the values into the equation:
P(B) = (0.9 * 0.02) + (0.05 * 0.98)

Now we can calculate P(A|B):
P(A|B) = (0.9 * 0.02) / [(0.9 * 0.02) + (0.05 * 0.98)]

Simplifying the equation:
P(A|B) = 0.018 / (0.018 + 0.049)

Calculating:
P(A|B) ≈ 0.268 (approximately 26.8%)

Therefore, the probability that the patient has the disease given that she tested positive is approximately 26.8%.