1
$\begingroup$

If I have two normal distributions A (mean = 0, variance = 4) and B (mean = 0, variance = 16), how can I calculate the probability that an observation with magnitude 2 comes from A?

$\endgroup$
  • $\begingroup$ I assume your mixture has equal weights, since you don't specify otherwise? $\endgroup$ – Stephan Kolassa Feb 5 at 15:18
  • $\begingroup$ @StephanKolassa you are correct, apologies for leaving it out $\endgroup$ – Bob Doe Feb 5 at 15:23
  • $\begingroup$ Welcome to CV. This is a good question for a newer learner to work on. It is valuable to look at the different ways you can engage the question. What form of an answer is more meaningful to you? $\endgroup$ – EngrStudent Feb 5 at 16:10
  • $\begingroup$ @EngrStudent Thank you. An example would be great but a hint or two would suffice. $\endgroup$ – Bob Doe Feb 5 at 16:29
  • $\begingroup$ Bob, there are several families of answers with many answers per family. Computationally, you could do it in R, python, excel, or something else. You could simulate it a hundred thousand times and look at rates. Computationally-Analytically you could do one of Nick Cox's convolutions and get results that are equivalent to infinite samples. Analytics/Symbolic - you could do it a number of ways with "squiggly herding" in a structure of a mathematical proof. There are 100 ways to make an example, and hearing that gives you a start exploring the (wonderful and miraculous) landscape of stats. $\endgroup$ – EngrStudent Feb 5 at 17:09
0
$\begingroup$

Here's some Python code

from scipy.stats import norm
pA = norm.cdf(2.0, loc=0, scale=2) - norm.cdf(-2.0, loc=0, scale=2)
pB = norm.cdf(2.0, loc=0, scale=4) - norm.cdf(-2.0, loc=0, scale=4)
print('P(-2.0 < x < 2.0 | A) = {}'.format(pA))
print('P(-2.0 < x < 2.0 | B) = {}'.format(pB))
print('P(-2.0 < x < 2.0 | A) / P(-2.0 < x < 2.0 | B)= {}'.format(pA / pB))

And it's output:

P(-2.0 < x < 2.0 | A) = 0.6826894921370859
P(-2.0 < x < 2.0 | B) = 0.38292492254802624
P(-2.0 < x < 2.0 | A) / P(-2.0 < x < 2.0 | B)= 1.7828285701395248

I just ask, what's the probability I'd draw a data point within the specified value of 2.0 (two-sided). Do this for both, and take ratio. This means it's 1.78 more likely the data point belongs to A.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.