Statistics: Why doesn't the probability of an accurate medical test equal the probability of you having disease? Suppose there is a test for Disease A that is correct 90% of the time. You had this test done, and it came out positive. I understand that the chance that this test is right is 90%, but I thought this would mean the chance that you have a disease should be 90% too. However, according to Bayes' rule, your chance of disease depends on the percentage of the population that has this disease. It sounds absurd: If the test is correct then you have it, and if it's not then you don't, 90% of the time- so there should be 90% chance that the results are right for you...
But on other hand, say 100% of population has it. Then regardless of the chance the test says you have it, let it be 90% or 30%, your chance is still 100%... now all of a sudden it doesn't sound absurd.
Please avoid using weird symbols as I'm not statistics expert. It just deludes things for me and buries the insight.
 A: Consider a disease that only affects 2% of the population (and there are tests for rarer diseases than that). If you have a 10% chance of being assessed as having the disease even if you don't, then even if the test always identifies those affected by the disease, the number of positive results will be five times more than the number of people with the disease. 
So in that case the chance of having the disease, given a positive test result (and no other information) would stand at about 17%, not 90%.
A: Look at it this way. There is a $10$% chance that any given instance of the test is wrong. It can be wrong in either of two ways: it can be positive when you don’t have the disease (a false positive), or it can be negative when you do have the disease (a false negative). 


*

*If the disease is very common, most of the people being tested will have the disease, so most of the errors will be made on those people and will therefore be false negatives. In that case few of the errors will be false positives, so if you test positive, you probably have the disease; a negative test, on the other hand, could easily be one of the false negatives. You already pointed out the extreme case of this, in which the entire population has the disease, and every error is a false negative.

*If the disease is very rare, however, most of the people being tested will not have the disease, and most of the errors will therefore be false positives; if you test negative, you probably don’t have the disease, but a positive test could easily be one of the false positives. The extreme case would be when no one has the disease, and every error is a false positive.
As the incidence of the disease shifts from $100$% to $0$%, the probability that an error is a false positive increases from $0$ to $1$.
A: Consider the following table which shows the probabilities all the possibilities of presence of disease and the result of the test. One can see that the proportion of people in the population with the disease, $x$, 
will affect the final outcomes.
$$
\begin{array}{c|c|c|}
 & \text{Has disease} & \text{No disease} \\ \hline
\text{Test positive} & 0.9 \times x & 0.1 \times (1-x) \\ \hline
\text{Test negative} & 0.1 \times x & 0.9 \times (1-x)
\end{array}
$$
Indeed, if $x$ is equal to the failure rate of the test, then a positive result will only have a 50% chance of being correct!
A: Good question, and lots of good answers here. I recommend Steven Strogatz's New York Times column on this very point.
http://opinionator.blogs.nytimes.com/2010/04/25/chances-are/
He reports on doctors faced with this problem:

The probability that one of these women has breast cancer is 0.8
  percent.  If a woman has breast cancer, the probability is 90 percent
  that she will have a positive mammogram.  If a woman does not have
  breast cancer, the probability is 7 percent that she will still have a
  positive mammogram.  Imagine a woman who has a positive mammogram. 
  What is the probability that she actually has breast cancer?

Later on:

When Gigerenzer asked 24 other German doctors the same question, their  estimates whipsawed from 1 percent to 90 percent.   Eight of
  them thought the chances were 10 percent or less, 8 more said 90
  percent, and the remaining 8 guessed somewhere between 50 and 80
  percent.  Imagine how upsetting it would be as a patient to hear such
  divergent opinions.
As for the American doctors, 95 out of 100 estimated the woman’s probability of having breast cancer to be somewhere around 75 percent.
The right answer is 9 percent.

Then Strogatz shows you why the problem confuses people, and how to think about it correctly. No formulas.
A: 
Suppose there is a test for Disease A that is correct 90% of the time. You had this test done, and it came out positive. I understand that the chance that this test is right is 90%, but I thought this would mean the chance that you have a disease should be 90% too.

Let's change that 90% to 50%:
I have developed a software that analyzes your eye movements and detects if you have brain cancer. Because it's actually a difficult thing to do and I was lazy, I programmed the software just to flip a coin and tell YES or NO, with 50% chance each.
So, we have a test for Disease A that is correct 50% of the time. I had this test done, and it came out positive. Is the chance that the test was right 50%?
A: Put in real values and it's easier. Test is 90% accurate for both false positives and false negatives so if you don't have the disease it will falsely say you do 10% of the time. If you do have he disease it will falsely say you don't 10% of the time.
There is a population of 1000 and 1% actually have the disease. So 10 people out of 1000. Apply the test to the whole population and you get 100 false positives and 1 false negative .For any individual then who tests positive what's the likelihood the test is wrong? The odds are 10:1 it's wrong, because 100 people will get positive results but only 10 will actually have the disease. So even though the test is 90% accurate, there's only a 1 in 10 chance that a positive result means you really have the disease.
Change the percentage of the population that actually has the disease to say 50% and you'll see this changes the situation dramatically.
A: A visual for the issue at hand - say the population has 10% sick people and a test that's 90% accurate. Of the 10 sick people in 100, it identifies 9 (the red X). But of the 90% who are not sick 10% are bad results identifying as sick (the blue X). 
A "sick" result, therefore, has a 50/50 chance of correctly identifying a sick person or falsely identifying a well person. 

The other answers are good ones. I just prefer the visual approach to clarify. 
A: Your intuition is relying on the test always being accurate. However, this is not the case. There are four conditions that we have to account for: 


*

*The test is positive and you have the disease;

*The test is positive and you don't have the disease;

*The test is negative and you have the disease; 

*The test is negative and you don't have the disease.


If the test were perfect, only results #1 and #4 would happen. But this is not the case in the real world. As a consequence, we have to condition ourselves on the probability that the test makes a mistake--or, looking at it another way, we have to evaluate the results on the test based on the as-yet unknown reality as to whether we have the disease or not. A test has a given accuracy independent of whether the disease is present or not.
Put another way, suppose you notice a cookie is missing, and you ask a child. That child will either tell the truth, or not. Regardless of what the child tells you, there are two possible truths: the cookie is gone, or you miscounted your number of cookies.
A: Part of the difficulty in understanding this is that we automatically involve other aspects of the imagined scenario in our thinking. The Bayesian approach takes a simplistic view. Here's an example:
In a population of 1000 people, suppose 10 have a disease (ignore how we know that 10 people do....) Suppose we have a test which is correct 90% of the time it claims the disease is present, and also correct 90% of the time it claims the disease is absent. (These two numbers need not be the same, but let's suppose they are.)
Story #1: A new health initiative leads to the entire population being tested. Out of the 10 people with the disease, 9 are correctly identified by the test, while 1 is missed. Out of the 990 people without the disease, 891 (90%) are cleared as healthy, while 99 (10%) are mistakenly labeled as diseased.
Out of the 99 + 9 = 108 people who were tagged as having the disease, only 9 really do. (about 8%). So if we take one of the positive test results at random, that person who tested positive has only an 8% chance of having the disease.
Because the number of healthy people WHO WERE TESTED is so high, more false positives than true positives occurred.
Story #2: The test is expensive and rarely done. Only people who have symptoms suggesting the disease bother to have the test done. So out of our population of 1000, only 30 have the test done, including all 10 who really have the disease. Now, 9 of the 10 people with the disease get positive test results, and 2 of the 20 people WHO WERE TESTED but don't have the disease get positive test results. The chance of having the disease, given that you WERE TESTED and tested positive for the disease, is 9 / 11, or 82%.
The Bayesian analysis describes Story #1 above, but real life is usually more like Story #2. That contributes to the result seeming so counter to intuition.

To more directly address the OP's question: you had the test, and it came out positive. Your question is now "was that positive test result one of the correct positive results, or one of the false positives?"  In a situation like Story #1 there are many more false positives than true positives, so you are likely to have gotten a false positive result.
A: Just to add to the previous answers:
Think of it this way: If, say, 60% of the tested population is known to have the disease, is the test really detecting a disease, or is it just a coincidence that 90% of those who tested positive actually have the disease?
Let's say 60% of a population has influenza. 90% of those who have the common cold also have influenza. We develop a test, thinking it will help us identify those who have influenza. This test returns a positive result whenever we test someone who has a cold and influenza. So, how do we know how accurate the test is? We can include in our test a) those who have only influenza and b) those who are known to be perfectly healthy, and c) those who have only a cold.  We can then uses Bayes's theorem to figure out the probability that the test has correctly identified or ruled out influenza.
A: There is a very good tutorial on Bayes Theorem at http://www.yudkowsky.net/rational/bayes/
As others have mentioned, the issue is that you must consider the base rate (the occurence of the disease). The link above deals with this as the very first example.
A: Let's say 1/1000 people have a disease and we test 1000 people with a 10% fail rate on a test.

In this instance (1000 people) I haven't shown any false negatives. If we were showing 10,000 people we could include one.
