# Finding the expected value

A merchant has found that the number of items of brand XYZ that he can sell in a day is a Poisson random variable with mean $4$.

We need to calculate the expected number of days out of 25 that the merchant will sell no items of brand XYZ.

I tried as follows:

$$P(\text{No item is sold in a single day}) = \dfrac{4^{0}}{0!}e^{-4} = e^{-4} .$$

Let $N$ denotes the number of days out of $25$ on which no items of brand XYZ are sold. Thus, we have:

$$N \sim \operatorname{Bin}(25, e^{-4})$$

So , $E(N) = 25e^{-4}$ (Since when $X \sim \operatorname{Bin}(n,p)$, $E(X) = np$).

Is the interpretation stated above alright?

$E(N)$ comes out to be $0.458$, it doesn't seem right. Can anyone help?

• If brand $XYZ$ is the product of brands $X$, $Y$ and $Z$, are they independent brands, or dependent? Your notation! – wolfies Oct 10 '16 at 14:01
• Actually $XYZ$ is a single product brand. @wolfies – User9523 Oct 10 '16 at 14:10

## 2 Answers

Your analysis looks sound.

In these cases, where something seems intuitively wrong, it sometimes pays to simulate the setting and check the result. If it doesn't match your analysis, you can backtrack and see which step failed.

Unfortunately (or, rather, fortunately), simulations back up your analysis. In numpy, you can check it in 2 lines of code:

 import numpy as np

>>> np.mean((np.random.poisson(4, (999999, 25)) == 0).sum(axis=1))
0.45892245892245892

• np.random.poisson(4, (999999, 25)) == 0 checks the number of days which were 0 in 9999999 25-day months.
• .sum(axis=1) adds each row.
• np.mean(...) takes the mean.
• +1 for the idea of simulating. I wonder if the OP just needed the tiniest bit of help interpreting his/her correct output. – Antoni Parellada Oct 9 '16 at 22:06

Perhaps the issue stems from the interpretation of the output.

$\small \mathbb E(\text{no. sales-less days in a period of 25 days)}= 0.458\text{ days}$. Yes! That is correct: We should expect less than $1$ day with no sales in a period of $25\text{ days}$. Or you can think of it as expecting one blank day every couple of periods.

As @Ami illustrated this is consistent with the results of a simulation. Here is the complementary simulation in R. Let's see how many days of any of these $25\text{ day}$ chunks should we expect to at least make one sale:

sim  = 1000
MC = t(replicate(sim, (rpois(25, 4))))
mean(colSums((apply(MC, 1, function(x) x > 0))))
 24.548


Right! Over $24$ of these $25$ days will at least show some cash at the registry.

Notice that we haven't used the binomial, as you correctly did, and yet obtained the same result:

mean(colSums((apply(MC, 1, function(x) x == 0))))
 0.452


In fact, it is easiest to just walk yourself through the story verbally. You have calculated that the probability of making no sales in one day is $\small e^{-4}=0.018\sim 0.02=2\%$. In $100$ days, with a probability of roughly $2\%$ each day, you can expect $2$ days going cashless. Now it is clear what to expect in $25$ days.

Or you can just visually check the plausibility of your result with:

sim  = 100000
MC = rpois(sim, 4) 