# Test to see what population an observation came from

I have a population with a mean (mean_1) (which was calculated through many trials and so have a very very small uncertainty in the mean). The standard deviation of the population is 'S'.

I have a second population with mean_2 (which again has a very very small uncertainty) and a standard deviation which is again 'S'.

Say I make a single further observation and the value falls somewhere in between mean_1 and mean_2, is there a test that I can perform to say with what certainty the observation came from population 1 and what certainty it came from population 2?

Thank you.

• Yes, there is, provided you first tell us beforehand what the relative chances of each population are of being the one the observation came from. If you do not do that, this question is unanswerable. – whuber Sep 25 '13 at 22:30
• I'm not sure I understand. The chances of the observation being from either population is what I am trying to find out. – user1551817 Sep 25 '13 at 22:40
• Won't the observation's proximity to either mean say something about the relative probablilty? – user1551817 Sep 25 '13 at 22:46
• It will say something about the change in the relative probability only. – whuber Sep 25 '13 at 23:01

Suppose that the populations are distributed as $N(\mu_1, \sigma^2)$ and $N(\mu_2, \sigma^2)$ , and the value is $x$, then $$P(\text{X is from population 1}|X=x) = {P(X=x|\text{X is from population 1})P(\text{X is from population 1}) \over P(X=x)}$$ But $$P(X=x) = \sum_{i=1}^2 P(X=x|\text{X is from population i})$$ Therefore $$P(\text{X is from population 1}|X=x) = {P(X=x|\text{X is from population 1})P(\text{X is from population 1}) \over \sum_{i=1}^2 P(X=x|\text{X is from population i})} = {(1/\sqrt{2\pi}\sigma) e^-{\left(x-\mu_1\right)^2 \over 2\sigma^2} P(\text{X is from population 1}) \over \sum_{i=1}^2 (1/\sqrt{2\pi}\sigma) e^-{\left(x-\mu_i\right)^2 \over 2\sigma^2} P(\text{X is from population i})} = {e^-{\left(x-\mu_1\right)^2 \over 2\sigma^2} P(\text{X is from population 1}) \over \sum_{i=1}^2 e^-{\left(x-\mu_i\right)^2 \over 2\sigma^2} P(\text{X is from population i})}$$

If $P(\text{X is from population 1}) = P(\text{X is from population 2})$ (we have no prior knowledge what population is X from), then the probability is equal to:

$$P(\text{X is from population 1}|X=x) = {e^-{\left(x-\mu_1\right)^2 \over 2\sigma^2} \over \sum_{i=1}^2 e^-{\left(x-\mu_i\right)^2 \over 2\sigma^2} }$$

• This answer implicitly assumes both populations are equally likely: that requires justification, as pointed out by the existing answer and in the comments. – whuber Nov 25 '13 at 14:05
• No, it assumes it explicitly, not implicitly. I wrote "If P(X is from population 1)=P(X is from population 2) (we have no prior knowledge what population is X from) ..." If the populations are not equally likely, we should use the previous formula. – user31264 Nov 25 '13 at 15:42
• I may be struggling with your notation and your language. "P(X is from population 1)" would seem to be what you are trying to find, and so you do not appear to obtain a solution at all. I do not see any place where you refer to the prior probabilities of the two populations. Part of the struggle may be that "$X$" has no explicit definition. Another source of my difficulty is that "no prior knowledge" means you simply don't know what the prior distribution is; it does not automatically allow you to assume that both populations are equally likely. – whuber Nov 25 '13 at 16:06

I think whuber was asking about the proportion of further observations that may come from population 1 and 2. For example, if population 1 contains 100,000 individuals and population 2 contains 200,000, and you randomly select one individual from both populations combined, you will have 1/3 chance of getting an individual from pop1 and 2/3 from pop2.

If we assume that the chances are equal, simply convert the new observation to z-scores for both populations by subtracting the mean and dividing by the corresponding S. The population with the less extreme z-score is more likely to be the one that the observation came from. This assumes that the distributions of both populations are normal.

Not sure how I would calculate exact chances. A crude way would be to select a small range around the z-scores (e.g., if your z is 1.22, select 1.21 to 1.23), find the chance that you would get that z-score for both populations, then divide the proportion for pop1 by pop2. You can get a relative chance this way, but I think there may be better methods.