# Thread: Gamma distribution, mgf and unbiased estimator

1. ## Gamma distribution, mgf and unbiased estimator

Question.

Let $Y_1, ... Y_n$ be a random sample from a Gamma distribution $\Gamma(k, \frac{1}{\theta})$ with density function

$f_y(y)=\frac{{\theta}^k}{(k-1)!}y^{k-1}e^{{-\theta}y}$ for x>0,
$0$ $otherwise$

where $k\geq1$ is a known integer, and $\theta>0$ is an unknown parameter.

i. Show that the moment generating function of $Y_1+Y_2+ ... +Y_n$ is $M_Y(t)=(1-\frac{t}{\theta})^{-nk}$

ii. Find the constant c such that $c/{\bar}Y$ (that's "c over Y bar", if it does not show up properly on the screen) is an unbiased estimator for $\theta$, where ${\bar}X$ (X bar) is the sample mean. Calculate the vairance of this estimator and compare it with the Cramer-Rao lower bound.

(This is an exact wording from the book, including X bar which appears out of nowhere)

(i) $E(e^{t(Y_1+Y_2+...+Y_n)}=E(e^{ntY_i})=[M_Y(t)]^n$ since Ys are iid.

$=[(\frac{\theta}{\theta-t})^k]^n=(\frac{1}{1-\frac{t}{\theta}})^{nk}=(1-\frac{t}{\theta})^{-nk}$

(ii) I need to find $E(c/{\bar}Y)$, and I don't think I can simply substitute the mean in the denominator $E(1/{\bar}Y)$ (expected value of the 1 over Y bar) here, so what else can I do?

I could also try $E(\frac{c}{1/n\Sigma_{i=1}^nY_i})$. Any pointers?

2. Hello,

For the mgf, you got it wrong.
$\frac{\theta}{\theta-t}=\frac{1}{1-\frac{1}{\theta}}$, so there's no factor $\theta^n$ (you just got messed up in the algebra)

3. Ah! cancels out from nominator and denominator, of course ))))
I will adjust the original post
thanks!

4. For the second question, all I can see is that you notice, from the mgf, that the sum $Y=Y_1+\dots+Y_n$ follows a Gamma distribution $\Gamma(nk,1/\theta)$, hence you have its density $\tilde{f}_Y(y)$ ( $y\in (0,\infty)$)

So $\displaystyle E[1/Y]=\int_0^\infty \frac{\tilde{f}_Y(y)}{y}~dy$

I didn't do the calculations, but this integral can be solved by retrieving the pdf of another gamma (which integral is 1)

5. Thanks - let me try.
Can I ask what you use the tilde over y for here? as in $\tilde{f}_Y(y)$. To show that it is a distribution function?

Now then,
let $U=Y_1+\dots+Y_n$ (to distinguish it from Y variable)
then per (a), $M_U(t)=(1-t{\theta})^{-nk}$ and we conclude that $U\simGamma(nk, \frac{1}{\theta})$ as Moo has pointed out and I should have seen myself ))) (probably it is a good idea to use part (a) in working out part (b))

$E(\frac{1}{\bar{Y}})=E(\frac{1}{1/n*U})=E(\frac{n}{U})$ and I will use the distribution of U to find the expected value of U:

$E(1/U)=\int_{range of u}\frac{1}{u}f_u(u)du=\int_0^{\infty}\frac{1}{u}\f rac{\theta^{nk}}{\Gamma(nk)}u^{nk-1}e^{-{\theta}u}du=\frac{{\theta}{\Gamma}(nk-1)}{\Gamma(nk)}\int_0^{\infty}\frac{{\theta}^{nk-1}}{\Gamma(nk-1)}u^{nk-2}e^{-{\theta}u}du=\theta\frac{1}{nk-1}$ since the integral is a Gamma distribution integral for $Gamma(nk-1,\frac{1}{\theta})$ and is equal to 1.

Therefore

$E(\frac{1}{\bar{Y}})=nE(\frac{1}{U}=\frac{n\theta} {nk-1}$

and $E(\frac{c}{\bar{Y}})=\frac{nc{\theta}}{nk-1}=\theta$

$c=\frac{nk-1}{n}$, and the unbiased estimator is $\frac{c}{\bar{Y}}=\frac{nk-1}{n\bar{Y}}$

6. I now need to find variance of that unbiased estimator

$Var(\frac{c}{\bar{Y}})=\frac{(nk-1)^2}{n^2}Var(\frac{1}{\bar{Y}})=\frac{(nk-1)^2}{n^2}n^2Var(\frac{1}{U})$

$Var(\frac{1}{U})=E[(\frac{1}{U})^2]-E[\frac{1}{U}]^2=\frac{\theta^2}{(nk-2)(nk-1)}-\frac{\theta^2}{(nk-1)^2}=\frac{\theta^{2}(nk-1)-{\theta}^2(nk-2)}{(nk-1)^{2}(nk-2)}=\frac{\theta^2}{(nk-1)^{2}(nk-2)}$

Here is how I came up with

$E[(\frac{1}{U})^2]=\int_0^{\infty}\frac{1}{u^2}\frac{\theta^{nk}}{\G amma(nk)}u^{nk-1}e^{-{\theta}u}du=\frac{\Gamma(nk-2)\theta^2}{\Gamma(nk)}\int_0^{\infty}\frac{\theta ^{nk-2}}{\Gamma(nk-2)}u^{nk-3}e^{-{\theta}u}du=\frac{\Gamma(nk-2)\theta^2}{\Gamma(nk)}=\frac{\theta^2}{(nk-2)(nk-1)}$

Then finally the variance of the unbiased estimator

$Var(\frac{c}{\bar{Y}})=\frac{(nk-1)^2}{n^2}Var(\frac{1}{\bar{Y}})=\frac{(nk-1)^2}{n^2}n^2Var(\frac{1}{U})==\frac{(nk-1)^2}{n^2}n^2\frac{\theta^2}{(nk-1)^2(nk-2)}=\frac{\theta^2}{nk-2}$

Not sure if it is OK to have theta in the formula?

Next, I must figure out Cramer-Rao lower bound for variance...

7. The tilde was here because I name the rv Y. So when I saw that there could be a confusion with the very first pdf you defined, I chose to call the pdf differently instead of calling the rv differently

Your calculations for finding c are correct

It's ok for the variance too, and it's not a problem if there is $\theta$. You can simplify from the beginning the n²... It's too bad you want to keep it 'til the end

For Cramér-Rao's bound, you have to compute Fisher's information, right ? So just try it ^^ It's not that difficult.
FYI : $I(\theta)=-E\left[\frac{\partial^2}{\partial \theta^2} \ln(f_Y(Y;\theta))\right]$

8. I am sorry, I was just building up to it - I am terribly insecure when it comes to Cramer-Rao

Log-likelihood

$l(\theta, y)=kln(\theta)-ln(k-1)!+(k-1)lny-{\theta}y$

Information

$I_Y(\theta)=-E(\frac{\partial^2}{\partial\theta^2}l_y(\theta;y) )=E(\frac{k}{\theta^2})=\frac{k}{\theta^2}$, for a single observation

Then for a random sample of iid $nI_Y(\theta)=\frac{kn}{\theta^2}$

$Var({\theta}hat){\geq}\frac{1}{nI_Y(\theta)}$

$\frac{\theta^2}{nk-2}{\geq}\frac{\theta^2}{nk}$, as expected.

I think I am done here. By the way, how do you place a 'hat' on the top of the variable in Latex code?

9. It's correct

By the way, it's $l_y(Y;\theta)$ : you consider the rv Y, and the second member is for the parameter, which is $\theta$ here.

\hat{something}
\tilde{something}
\bar{something} or \overline{something}