# Probability theory. quick question regarding conditionalizing the binomial dist

1. Feb 9, 2012

### Applejacks01

Hello,
so suppose we have B(n,p), where n is discretely uniformly distributed on the integers of the interval (1,5)

Is the expected value 3p, and is the variance 3p-p^2
?

I arrived at those answers by treating n as another variable, so np/5 summed over all n is 3p, and similar logic for E(x^2) yields the variance.

Also when I use the equation E(V(Y/n)) + V(E(Y/n)) I get the same variance.

However this will give a non-zero variance for p =1, which makes NO sense.

Thank you very much

Last edited: Feb 9, 2012
2. Feb 9, 2012

### Ray Vickson

If p = 1, every trial gives "success". Is there variation in the number of trials?

RGV

3. Feb 10, 2012

### Applejacks01

I didn't think about it like that. You're right..there is variation. I suppose that would make sense.

So in general, for the binomial given n, where n is distributed by f(n) we have the variance is:
Sum(Sum f(n)*B(n,p)*x^2 over all x) over all n) - (Sum(Sum f(n)*B(n,p)*x over all x) over all n))^2

Which can be simplified or evaluated much quicker using the law of total variance.

4. Feb 10, 2012

### Applejacks01

Hi, I actually have one more question.
suppose I wanted to calculate the probability that x=#successes =2.
Do I need to conditionalize f(n) = distribution of n(# trials) such that n>=2, or do I just assume that the probabilities when n=0 and 1 are 0??

5. Feb 10, 2012

### Ray Vickson

$$P\{X=2\} = \sum_{n=1}^5 f(n) P\{X=5 | n \}.$$
What do you think the values of P{X=5|n} are for n = 1 and 2?

RGV

6. Feb 10, 2012

### Applejacks01

Well actually I think that P(X=2) is Sum C(n,2) *p^2 * (1-p)^(n-2) from n = 1 to 5, and when n equals 1, C(n,2) =0.

But to directly answer your question,I would say the values are 0.

Sorry for not using latex BTW. I'm on my lunch break. Just trying to learn.

Last edited: Feb 10, 2012
7. Feb 10, 2012

### Ray Vickson

Your answer for P(X=2) is correct; the point is that you use the original f(n), and not some conditional version of it, and you let P{X=k|n} take care of the zeros or not.

Don't worry about not using LaTeX; what you wrote is clear enough and not very complicated, so it is perfectly readable without ambiguity.

RGV

8. Feb 10, 2012

### Applejacks01

Thank you so much Ray, you've been very helpful!