0
$\begingroup$

Problem:
Let $X$ be a geometric r.v. with parameter $p$. Find the variance of $X$ using the fact that the moment generating function for $X$ is $M_x(t) = \frac{pe^t}{1 - qe^{t}} $.
Answer:
\begin{eqnarray*} M_x'(t) &=& \frac{(1 - qe^{t})pe^t - pe^t(-qe^t) } { (1 - qe^{t})^2} \\ M_x'(t) &=& \frac{(1 - qe^{t})pe^t + pqe^{2t} } { (1 - qe^{t})^2} \\ M_x'(t) &=& p(1 - qe^{t})^{-1}e^t + pq(1 - qe^{t})^{-2}e^{2t} \\ M_x''(t) &=& p(1-qe^t)^{-1}e^t - p(1 - qe^t)^{-2}(-qe^t)e^t \\ &+& 2pq(1 - qe^{t})^{-2}e^{2t} - 2pq(1 - qe^{t})^{-3}e^{2t} \\ \sigma^2 &=& M_x''(0) \\ M_x''(0) &=& p(1-q)^{-1} - p(1-q)^{-2}(-q) + 2pq(1-q)^{-2} - 2pq(1-q)^{-3} \\ M_x''(0) &=& p(p)^{-1} + pq(p)^{-2} + 2pq(p)^{-2} - 2pq(p)^{-3} \\ M_x''(0) &=& 1 +\frac{q}{p} + 2q(p)^{-1} - 2q(p)^{-2} \\ M_x''(0) &=& 1 +\frac{q}{p} + \frac{2q}{p} - \frac{2q}{p^2} \\ M_x''(0) &=& 1 + \frac{3q}{p} - \frac{2q}{p^2} = \frac{p^2 + 3pq - 2q}{p^2} \\ M_x''(0) &=& \frac{p^2 + 3p(1-p) - 2(1-p)}{p^2} = \frac{p^2 + 3p - 3p^2 -2 + 2p}{p^2} \\ M_x''(0) &=& \frac{-2p^2 + 5p - 2}{p^2} \\ \sigma^2 &=& \frac{-2p^2 + 5p - 2}{p^2} \\ \end{eqnarray*} However, the variance of a geometric r.v. is $\frac{1 - p}{p^2}$. What did I do wrong?
Thanks,
Bob

$\endgroup$
3
  • 2
    $\begingroup$ For one, $\sigma^2 \ne M''(0),$ but you're making some error in the computation of $M''(0)$ as well, probably a small algebra error. I'm sure if you do the calculation again more slowly it will come out right (and maybe organize the thing a little better... multiplying through by $e^{-t}$ at the beginning will simplify things and there's some opportunities to factor things to keep it nice in the middle.) $\endgroup$ Jul 12, 2018 at 23:46
  • 1
    $\begingroup$ +1 to spaceisdarkgreen, you calculate 2nd moment there, plus according to Wolfram, you made a mistake somewhere in your calculations $\endgroup$
    – mike239x
    Jul 12, 2018 at 23:51
  • 1
    $\begingroup$ After some squinting, I see a mistake: that last term in $M''$ needs a plus sign, not a minus sign. (I actually caught it cause of the $-2$ in the numerator at the end and tracked it back to that term.) $\endgroup$ Jul 12, 2018 at 23:57

2 Answers 2

0
$\begingroup$

Expanding a little on "spaceisdargreen" answer, and to show more details: We are given: $$ M_x(t)=\frac{pe^t}{1-qe^t}$$

Using the moment generating function, the variance is given by: $$ \sigma^2=E[X^2]-(E[X])^2 = \frac{d^2}{dt^2}M_x(t){\Bigr|_{t=0}}-\left(\frac{d}{dt}M_x(t){\Bigr|_{t=0}}\right)^2$$

Notice that if the expected value or mean $E[X]=0$ then $$\sigma^2=E[X^2]=\frac{d^2}{dt^2}M_x(t){\Bigr|_{t=0}}$$ It appears that you assumed the mean was zero, but this is not (presumably) the case.

Now, continuing with the assumption that $p + q = 1$ and $p \ne 0$:

$$ \frac{d}{dt}M_x(t) = \frac{\left(1-qe^t\right)pe^t-pe^t\left(-qe^t\right)}{\left(1-qe^t\right)^2} =\frac{pe^t}{\left(1-qe^t\right)^2}$$

Therefore $$\frac{d}{dt}M_x(t){\Bigr|_{t=0}} = \frac{p}{\left(1-q\right)^2}=\frac{p}{p^2}=\frac{1}{p} $$

Also $$\frac{d^2}{dt^2}M_x(t) = \frac{d}{dt}\left(\frac{pe^t}{\left(1-qe^t\right)^2}\right) = \frac{\left(1-qe^t\right)^2pe^t-pe^t(2)\left(1-qe^t\right)(-qe^t)}{\left(1-qe^t\right)^2}=\frac{pe^t-pq^2e^{3t}}{\left(1-qe^t\right)^4}$$

Therefore $$\frac{d^2}{dt^2}M_x(t){\Bigr|_{t=0}} =\frac{pe^t-pq^2e^{3t}}{\left(1-qe^t\right)^4}{\Bigr|_{t=0}}=\frac{p-pq^2}{\left(1-q\right)^4}=\frac{p(1-q^2)}{\left(1-q\right)^4} = \frac{p(1+q)}{\left(1-q\right)^3}=\frac{1+q}{p^2}$$

Finally, $$ \sigma^2=\frac{d^2}{dt^2}M_x(t){\Bigr|_{t=0}}-\left(\frac{d}{dt}M_x(t){\Bigr|_{t=0}}\right)^2 = \frac{1+q}{p^2} - \left(\frac{1}{p}\right)^2$$ $$=\frac{(1+q)p^2-p^2}{p^4}=\frac{(2-p)p^2-p^2}{p^4}=\frac{(2-p-1)p^2}{p^4}=\frac{(1-p)p^2}{p^4}$$

Hence $$ \sigma^2 = \frac{(1-p)}{p^2}$$

$\endgroup$
0
$\begingroup$

Here is a more orderly way to do the calculation. $$M(t) = \frac{p}{e^{-t}-q}\\M'(t) = \frac{p}{(e^{-t}-q)^2}e^{-t} = \frac{p}{(e^{-t/2}-qe^{t/2})^2}\\M''(t) = 2\frac{p}{(e^{-t/2}-qe^{t/2})^3}\frac{1}{2}(e^{-t/2}+qe^{t/2})\\M''(0) = \frac{p}{p^3}(1+q)= \frac{2-p}{p^2}.$$

Then we have $$ \sigma^2 = M''(0) - M'(0)^2 = \frac{2-p}{p^2} - \frac{1}{p^2} = \frac{1-p}{p^2} $$

$\endgroup$
7
  • 1
    $\begingroup$ Minor correction: You have $p$ in the denominator of final answer instead of $p^2$. $\endgroup$ Jul 13, 2018 at 1:33
  • $\begingroup$ @MichaelMartin thanks $\endgroup$ Jul 13, 2018 at 1:54
  • 1
    $\begingroup$ The calculation is much simpler when you simplify $M_x'(t)=\frac{pe^t}{(1-qe^t)^2}$. $\endgroup$ Jul 13, 2018 at 2:46
  • 1
    $\begingroup$ @herbsteinberg I could see thinking it's simpler, but much simpler? This is subjective of course, but I prefer my way. I made a sign error just scratching out the rest of it from what you put there. I prefer to avoid having multiple terms whenever possible so signs don't even matter (if you know what the sign of the answer should be). $\endgroup$ Jul 13, 2018 at 4:20
  • 1
    $\begingroup$ @spaceisdarkgreen Your expression is $M_x'(t)=\frac{(1-qe^t)pe^t+pqe^t}{(1-qe^t)^2}$. All I did was to get rid of $-pqe^t+pqe^t$ in the numerator. $\endgroup$ Jul 13, 2018 at 14:52

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .