3

I'm having trouble with an exercise about maximum likelihood estimators.

Specifically, the exercise gives me values of a protein which was found in 50 adults. We assumed that the data follow a gamma distribution:

$X \sim \Gamma(r,\lambda)= \frac {\lambda^{r}}{\Gamma(r)}x^{r-1}e^{-\lambda x} $ if $x\ge0$.

It asks me to find the maximum likelihood estimators of parameters $\lambda$ and $r$.

How can I find those parameters given that from the data I have $E(X),Var(X)$?

user1868607
  • 5,791
  • The standard recipe: write down the likelihood function, take the logarithm, take the gradient of that with respect to the parameters, set it equal to zero. Doing that here, you readily get that the expected value of the estimated distribution (whatever that is in your parametrization; there are three in common usage and it is not clear which you are using here) is the sample mean. I do not easily see how to find both parameters, however, because the other equation appears to be transcendental. – Ian Jun 03 '16 at 16:22
  • https://math.stackexchange.com/q/1510480/321264 – StubbornAtom Aug 14 '20 at 15:20

1 Answers1

3

We know that $\Gamma(r,\lambda)= \frac {1}{\Gamma(r)}\lambda^{r}x^{r-1}e^{-\lambda x} $ if $x\ge0$. In this case the likelihood function $L$ is $$\prod_i \Gamma(r,\lambda)_{x_i}=\frac{1}{\Gamma(r)^{n}}\lambda^{nr}x_1^{r-1}x_2^{r-1}...x_n^{r-1}e^{-\lambda T}$$ where $T=x_1+...+x_n$;

By apllying the logaritmic function to $L$ we semplificate the problem so

$$logL=(r-1)\sum_ilogx_i-\lambda T +(nr)log\lambda -nlog(\Gamma(r))$$

and now we must find the point of max of $logL$, so $\frac{\partial L}{\partial\lambda}= -T+\frac{nr}{\lambda}=0$ which have as solution $\hat\lambda = \frac{nr}{T}$.

With the same method you can obtain the extimation for $r$. (Find $\frac {\partial L}{\partial r}$ and put it equal to $0$).

Marco Lecci
  • 1,023
  • yes i agree with you but from the one equation i find that λ=\frac{\widehat{r}}{\widetilde{x}} and from the other lnr-Γ'(r)/Γ(r)=lnx-x . i have to find numbers not equations...I imagine in this stage i have to use newton-raphson method to find r estimator to find r1 r2 r3 .... until |r4-r3|<10^-4 for example ....i dony know which r to put in the first equation....sorry for my equations i have to get used latex more....if you have question about the equations i wrote ask me – gensdimi Jun 03 '16 at 18:48
  • the one equation is: \widehat{ \lambda }= \frac{r}{ \bar{x} } and the other equation is: \ln( \hat{r} )-\frac{ \Gamma '(r)}{\Gamma (r)} =\ln \bar{x}- \bar{x} – gensdimi Jun 03 '16 at 19:12
  • Maybe you must stimate T with the expected value, the problem give you any information to the the values that each X_i assume? – Marco Lecci Jun 03 '16 at 19:23
  • no nothing...i can compute μ and σ from the given data but only those....i know that i have to use newton-raphson method for the second equation and after a couple results i have to put r in the first equation but why? and also the first equation has \widehat{r} not r1,r2,....,rn – gensdimi Jun 03 '16 at 19:29
  • In this case i don't know how i can help you, i'm sorry. – Marco Lecci Jun 03 '16 at 19:30
  • Indeed $\frac{\partial L}{\partial r}$ gives a transcendental equation, even if you know the data $x_i$. One first approximation is to set the variance equal to the sample variance, which would give $r=(\lambda S^{-2})^{1/2}$. This is just the "method of moments" estimator. It is probably not the MLE but it is a place to start your numerical method. – Ian Jun 03 '16 at 20:34
  • From the method of moments I have ${{r}{0}}=\frac{{{\overline{x}}^{2}}}{{{s}^{2}}}$ .Even If I run the newton-rapson method until $\left| {{r}{n+1}}-{{r}{n}} \right|<{{10}^{-4}}$ how can I use the ${{r}{n+1}}$ in my 1st equation which is$\hat{\lambda }=\frac{{\hat{r}}}{{\bar{x}}}$ ? – gensdimi Jun 04 '16 at 12:24
  • To be more certain we have from the method of moments that $\mu =\bar{x}=\frac{{\hat{r}}}{{\hat{\lambda }}}$ and ${{s}^{2}}=\frac{1}{n-1}\sum\limits_{i=1}^{50}{({{x}_{i}}-\bar{x}}{{)}^{2}}= \frac{{\hat{r}}}{{{{\hat{\lambda }}}^{2}}}$ . From this 2 equations we have ${{s}^{2}}=\frac{{\bar{x}}}{{\hat{\lambda }}} =>\hat{\lambda }=\frac{{\bar{x}}}{{{s}^{2}}}$and $\hat{r}=\hat{\lambda }\bar{x}=\frac{{{{\bar{x}}}^{2}}}{{{s}^{2}}}$. – gensdimi Jun 04 '16 at 12:45
  • OK, so you have an initial guess for $r$, namely $\frac{\overline{x}^2}{s^2}$, and an initial guess for $\lambda$, namely $\frac{\overline{x}}{s^2}$. If all you have is the sample mean and sample variance then this is the best you can do. If you have the data then you can try to numerically solve the system of two equations using these method of moments values as initial conditions. – Ian Jun 05 '16 at 12:24