# Conditioning on a random variable

The number of storms in the upcoming rainy season is Poisson distributed but with a parameter value that is uniformly distributed between (0,5). That is Λ is uniformly distributed over (0,5), and given Λ = λ, the number of storms is Poisson with mean λ. Find the probability there are at least three storms this season

Ok, I feel like I can get started with this problem, but I'm having a really difficult time wrapping my head around the idea of conditioning on a random variable. and I would appreciate if somebody could explain to me, in simple terms, what is going on when we condition on a random variable. I haven't been able to find a good explanation of this concept and I've seen this problem done both by taking the expectation of $\Lambda$ and placing it into the PMF of the Poisson distribution and by multiplying the Poisson the PDF of $\Lambda$, $\frac{1}{5}$ over the interval [0,5] and integrating the product from 0 to 5 w.r.t. $\lambda$.

Anyway, here goes nothing

Obviously, the problem starts out quite simple:

Let $X =$ number of storms in the season
Let $\Lambda =$ the rate of the Poisson distribution, which varies as a uniform r.v. over [0,5].

We want the following:

$Pr(X \geq 3|\Lambda = \lambda) = 1- Pr(X < 3|\Lambda = \lambda)$

And then of course we can count down to zero storms in a season in a summation. But that's where I get lost. I don't know how to handle the random parameter and more-so how to handle these type of problems in general and I'd appreciate some feedback. Please note that I am not looking to solve this problem using the definition of conditional probability. I am trying to solve this by conditioning on $\Lambda$, that is, treating it as a constant.

Please note that this is NOT homework but rather for independent study.

-

## 2 Answers

I hope I am not repeating concepts you are already familiar with.

Roughly speaking, a random variable can take one of many values. Which exact value will appear as the outcome of your experiment is not known in advance to you. The probability distribution gives the frequency of these values if you were to perform a large number of experiments.

When you condition on a random variable, you fix a particular value for that variable and do the calculations you want. However, you are not supposed to know the value (otherwise, it will not be a random variable!), so you uncondition to get what you will get after a large number of experiments.

In your example, you first condition on $\Lambda$ taking the value of $\lambda$, and then compute the probability of three or more storms using $$P(X\geq 3| \Lambda = \lambda).$$ Since $\Lambda$ is a random variable fixing it to one particular $\lambda$ does not give you the whole picture because $\Lambda$ can take any value between $0$ and $5$. Some of these values may appear more often than others, and you need to take this into account. And, this is done by unconditioning on $\Lambda$. That is, $$P(X\geq 3) = \int_0^5 P(X\geq 3|\Lambda = \lambda)f_\Lambda(\lambda)d\lambda$$

-
Not a problem at all; repetition is always good as long as it clears things up. So I think I see it now. So essentially we're fixing $\Lambda$ and asking ourselves what the desired probability would be for every value of $\lambda$. But we also need to be aware of the probability that $\Lambda$ takes on a certain value. In terms of conditional probability: $$Pr(X \geq 3 |\Lambda = \lambda) = \frac{Pr(X \geq 3, \Lambda = \lambda)}{Pr(\Lambda = \lambda)} = \frac{Pr(X \geq 3) Pr(\Lambda = \lambda)}{Pr(\Lambda = \lambda)}$$ multiplying both sides by $Pr(\Lambda = \lambda$) we have...next post – audiFanatic Mar 27 '14 at 3:49
Multiplying leftmost and rightmost sides by $Pr(\Lambda = \lambda)$ (and dropping the middle term from the equation), we have $$Pr(X \geq 3 |\Lambda = \lambda)Pr(\Lambda = \lambda) = Pr(X \geq 3)$$ Rearranging, I have what you have: $$Pr(X \geq 3) = Pr(X \geq 3 |\Lambda = \lambda)Pr(\Lambda = \lambda)$$ And now we do this for all $\lambda$ – audiFanatic Mar 27 '14 at 3:53
of course that only works if $\Lambda$ and $X$ are independent – audiFanatic Mar 27 '14 at 4:01
Yes, that works only if $\Lambda$ and $X$ are independent. Otheriwse, you will have to use the Law of total probability (see en.wikipedia.org/wiki/Law_of_total_probability) – user137846 Mar 27 '14 at 9:24

The approach sketched below is very informal, and intended to provide some intuition.

Let $s$ be between $0$ and $5$. Then the probability that $\Lambda$ is between $s$ and $s+ds$ is approximately (well, in this case exactly) $\frac{ds}{5}$. If the density function of $\Lambda$ were $g(s)$, we would replace $\frac{ds}{5}$ by $g(s)\,ds$.

Given that the parameter of the Poisson is between $s$ and $s+ds$, the probability that $X=k$ is approximately $e^{-s}\frac{s^k}{k!}$. So the probability that $\Lambda$ is between $s$ and $s+ds$, and $X=k$, is approximately $e^{-s}\frac{s^k}{k!}\frac{ds}{5}$. "Add up" (integrate) from $s=0$ to $s=5$. We get $$\Pr(X=k)=\int_0^5 e^{-s}\frac{s^k}{5k!}\,ds.$$

-
Roughly. But the $ds$ stuff is important, the probability that $\Lambda$ is exactly $s$ is $0$ for any fixed $s$. – André Nicolas Mar 27 '14 at 3:09
Sorry, deleated comment to fix $LaTeX{}$ issues, so they're out of order now, but anyway. So what you're saying is that we multiply the density and mass functions together because by the definition of conditional probability: $$Pr(X = k | \Lambda = \lambda) = \frac{Pr(X = k , \Lambda = \lambda)}{Pr(\Lambda = \lambda)}$$ – audiFanatic Mar 27 '14 at 3:15
I answered this, somewhat vaguely, above. Note that each probability in your fraction is $0$. Formally, we are working with the limit as $\Delta \lambda\to 0$ of something similar to what you wrote, except that top and bottom should have something like $\lambda\le \Lambda\le \lambda+\Delta \lambda$. That is what my informal $ds$ stuff is intended to capture. – André Nicolas Mar 27 '14 at 3:21
But regarding the $ds$ stuff, so what you're saying is that the probability that $\Lambda$ is on the set (0,5) is $$\frac{(s+ds)-s}{5}$$ and the $s$ cancels out so we're left with $$\frac{ds}{5}$$ But after that I'm lost because you made the variable we're integrating over $x$ and I don't see any $x$'s in the integration. Typo perhaps? – audiFanatic Mar 27 '14 at 3:24
Typo for sure, thanks! Corrected. – André Nicolas Mar 27 '14 at 3:26