# Calculate conditional probability using mean and variance [closed]

I have a set where its values follow a normal distribution, but I only have the sum of all of them, and the sum of its squares.

Having: $$\sum_{i=0}^n X_i$$ and $$\sum_{i=0}^n X_i^2$$.

I have the following "table":

((+ (fever 245 5975))
(- (fever 176 4540)))

There are two types of classes: Positive (+) and Negative(-). For both, I have the sum (245 and 176), and the sum of their squares (5975 and 4540).

How can I calculate P(Positive class given 45)?

P(Positive class given 45) or $$P(Positive|45)$$ means that given a fever of 45, it will be positive case and the patient will have measles. This is an invented example.

I think I have to use the mean and the variance, but I don't know how.

## closed as off-topic by callculus, dantopa, clathratus, Santana Afton, Lee David Chung LinMar 27 at 2:41

This question appears to be off-topic. The users who voted to close gave this specific reason:

• "This question is missing context or other details: Please provide additional context, which ideally explains why the question is relevant to you and our community. Some forms of context include: background and motivation, relevant definitions, source, possible strategies, your current progress, why the question is interesting or important, etc." – callculus, dantopa, clathratus, Lee David Chung Lin
If this question can be reworded to fit the rules in the help center, please edit the question.

• What does "$P(Positive|25)$" mean? – robjohn Mar 25 at 16:21
• I have updated my question. – VansFannel Mar 25 at 16:26
• Sorry, but your table is unreadable. Please fix it. Additional it seems that you´ve omitted some context. – callculus Mar 25 at 16:38
• @callculus I don't think so. I'm only asking if it is possible to calculate conditional probability with the mean and the variance. – VansFannel Mar 25 at 16:44
• This question is really unclear to me. What do the $X_i$ represent? What does $n$ represent? I'm guessing that the positive class is actually positive for some condition (say, measles), and the negative class is actually negative for that condition; is that right? Why do you think that the $X_i$ are normally distributed? (You probably shouldn't use "fever" as an example, since a fever of $45$ means DEAD whether you're talking F or C.) – Brian Tung Mar 25 at 17:14

I'm going to hazard a guess as to what you mean, in ordinary terms. I'm going to guess that you have two normal distributions, with estimated means $$\mu_c$$ (class $$c = 1, 2$$) and standard deviations $$\sigma_c$$. These can be derived from the sum and sum of squares, provided that you know $$n$$ (for each class, if they're different).

The estimated mean is

$$\mu = \frac1n \sum_{i=1}^n X_i$$

and the estimated standard deviation is

$$\sigma = \sqrt{\frac{\left(\sum_{i=1}^n X_i^2\right) - n\mu^2}{n-1}}$$

We can then use the PDF of the normal distribution at a given value $$x$$ to compute the relative likelihoods of being positive or negative for the condition:

$$f_c(x) = \frac{1}{\sqrt{2\pi\sigma_c^2}}\exp\left[-\frac{(x-\mu_c)^2}{2\sigma_c^2}\right]$$

Then I think the probability you want is

$$P(\text{class c} \mid x) = \frac{p_cf_c(x)}{p_1f_1(x)+p_2f_2(x)} \qquad c = 1, 2$$

where $$p_c$$ is the a priori probability of being in class $$c$$.

• Probably the right guess. :) A possible extra twist is I wouldn't be surprised if the no. of samples in each class is different, i.e. $n_1, n_2$... Then you can either use a likelihood approach, or even consider the ratio $n_1 : n_2$ to be a prior and use Bayesian. BTW your final formula ... wouldn't it evaluate to $>1$ in some cases? – antkam Mar 25 at 17:35
• @antkam: Oops, yeah, I forgot the $p_c$! Thanks for the catch. Incidentally, I didn't think of using $n_1 : n_2$ as a prior, since I think it's not likely to be appropriate. But perhaps... – Brian Tung Mar 25 at 17:38
• Who said anything about appropriate? This sounds like a game of "lets guess what the teacher / examiner had in mind" ;) – antkam Mar 25 at 17:56