Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down at the end of May, and its replacement, statalist.org is already up and running.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: RE: gamma family - alpha and theta parameters - xtgee


From   "Feiveson, Alan H. (JSC-SK311)" <alan.h.feiveson@nasa.gov>
To   "statalist@hsphsun2.harvard.edu" <statalist@hsphsun2.harvard.edu>
Subject   st: RE: gamma family - alpha and theta parameters - xtgee
Date   Wed, 29 May 2013 09:24:16 -0500

In partial response to Guillermo's question, I simulated some gamma data and tried - glm- to see what the "scale" parameter in Stata is an estimate of:



rgamma(a, b) Description:  returns gamma(a,b) random variates, where a is the gamma shape parameter and b is the scale parameter.



. gen y = rgamma(2,.01)

. summ y

    Variable |       Obs        Mean    Std. Dev.       Min        Max
-------------+--------------------------------------------------------
           y |     10000    .0199965     .014057   .0003844   .1184808

. glm y,fam(gamma) link(iden) nolog

Generalized linear models                          No. of obs      =     10000
Optimization     : ML                              Residual df     =      9999
                                                   Scale parameter =  .4941738
Deviance         =  5407.647596                    (1/df) Deviance =  .5408188
Pearson          =  4941.243902                    (1/df) Pearson  =  .4941738

Variance function: V(u) = u^2                      [Gamma]
Link function    : g(u) = u                        [Identity]

                                                   AIC             = -5.824201
Log likelihood   =  29122.00461                    BIC             = -86686.55

------------------------------------------------------------------------------
             |                 OIM
           y |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
       _cons |   .0199965   .0001406   142.25   0.000     .0197209     .020272
------------------------------------------------------------------------------


Note that the "scale" parameter value of .4941738 is not 0.01 (the value of "b") but appears to be an estimate of 1/a = 0.5.

Note that this does not depend on the value of "b":

. replace y = rgamma(2,34567)
(10000 real changes made)

. glm y,fam(gamma) link(iden) nolog

Generalized linear models                          No. of obs      =     10000
Optimization     : ML                              Residual df     =      9999
                                                   Scale parameter =  .4963884
Deviance         =  5469.254185                    (1/df) Deviance =  .5469801
Pearson          =  4963.387852                    (1/df) Pearson  =  .4963884

Variance function: V(u) = u^2                      [Gamma]
Link function    : g(u) = u                        [Identity]

                                                   AIC             =  24.32117
Log likelihood   = -121604.8625                    BIC             = -86624.94

------------------------------------------------------------------------------
             |                 OIM
           y |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
       _cons |   70297.13   495.2803   141.93   0.000      69326.4    71267.86
------------------------------------------------------------------------------

However if I change the value of "a" (for any "b"):
. replace y  = rgamma(10,1232)
(10000 real changes made)

. glm y,fam(gamma) link(iden) nolog

Generalized linear models                          No. of obs      =     10000
Optimization     : ML                              Residual df     =      9999
                                                   Scale parameter =  .1023587
Deviance         =  1038.561081                    (1/df) Deviance =  .1038665
Pearson          =  1023.484523                    (1/df) Pearson  =  .1023587

Variance function: V(u) = u^2                      [Gamma]
Link function    : g(u) = u                        [Identity]

                                                   AIC             =  20.85373
Log likelihood   = -104267.6349                    BIC             = -91055.63

------------------------------------------------------------------------------
             |                 OIM
           y |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
       _cons |   12416.28   39.72747   312.54   0.000     12338.41    12494.14
------------------------------------------------------------------------------

The "scale" parameter estimate is now close to 0.1, which is 1/"a".


One more test:

. replace y = rgamma(2.5,.765)
(10000 real changes made)

. glm y,fam(gamma) link(iden) nolog

Generalized linear models                          No. of obs      =     10000
Optimization     : ML                              Residual df     =      9999
                                                   Scale parameter =  .4056914
Deviance         =   4317.23078                    (1/df) Deviance =  .4317663
Pearson          =  4056.508667                    (1/df) Pearson  =  .4056914

Variance function: V(u) = u^2                      [Gamma]
Link function    : g(u) = u                        [Identity]

                                                   AIC             =  3.291668
Log likelihood   = -16457.33854                    BIC             = -87776.96

------------------------------------------------------------------------------
             |                 OIM
           y |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
       _cons |   1.907386    .012149   157.00   0.000     1.883575    1.931198
------------------------------------------------------------------------------

Again, the "scale" parameter estimate is close to 1/"a" = 0.4.


Bottom line: With a gamma family, the "scale" parameter in -glm- (and also in -xtgee-) is an estimate of 1/"a", and does not appear to depend on the value of the "real" scale parameter "b".



Al Feiveson


-----Original Message-----
From: owner-statalist@hsphsun2.harvard.edu [mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of Guillermo A. Sandoval (UofT)
Sent: Tuesday, May 28, 2013 6:37 PM
To: statalist@hsphsun2.harvard.edu
Subject: st: gamma family - alpha and theta parameters - xtgee

Dear
I am using xtgee with gamma distribution. I understand that for gamma distribution, one needs to define the parameters alpha and theta, which define the shape of the distribution function. Please see http://en.wikipedia.org/wiki/Gamma_distribution. My variable is continuous (mortality rates in hospitals) and distributes pretty much like the one in wekipedia that says k=1 and theta=2. 

In xtgee, it looks like one cannot define these parameters. I guess my question is, is this necessary (if yes, how)? or xtgee  actually estimates them and I don't really need to worry about that?

Thanks in advance

Guillermo

----
Guillermo A. Sandoval
PhD Candidate in Health Services Research

Institute of Health Policy, Management and Evaluation University of Toronto


*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index