Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


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

st: RE: scale parameter form saved by glm


From   Curtis Huffman Espinosa <chuffman@colmex.mx>
To   "statalist@hsphsun2.harvard.edu" <statalist@hsphsun2.harvard.edu>
Subject   st: RE: scale parameter form saved by glm
Date   Thu, 24 Feb 2011 18:52:31 +0000

Thank you for clarifying, and thank you very much for the tip. Youre absolutely right, gammafit is much better. Youve done a terrific job with it. Much appreciated, curtis

________________________________________
From: owner-statalist@hsphsun2.harvard.edu [owner-statalist@hsphsun2.harvard.edu] on behalf of Nick Cox [n.j.cox@durham.ac.uk]
Sent: Thursday, February 24, 2011 12:30 PM
To: 'statalist@hsphsun2.harvard.edu'
Subject: st: RE: RE: scale parameter form saved by glm

Oh, and -qgamma- and -pgamma- on SSC are dedicated plotting commands for univariate distribution fits.

Nick
n.j.cox@durham.ac.uk

Nick Cox

Given an interest in fitting gamma distributions [not functions!]:

I have a bias, apparent in a moment, but I'd say that -glm- is at best a slightly indirect way of doing it as, for very good reasons in its own terms, it treats one parameter as ancillary.

Its different parameterisation is at best a secondary source of awkwardness.

-gammafit- from SSC (Cox and Jenkins) is a dedicated tool with the small but non-zero advantage that it uses a parameterisation that is often more convenient.

. clear

. set obs 1000
obs was 0, now 1000

. gen y = rgamma(1,10)

. su y

    Variable |       Obs        Mean    Std. Dev.       Min        Max
-------------+--------------------------------------------------------
           y |      1000    10.03288    10.11876   .0194768   72.50683

. gammafit y

initial:       log likelihood =     -<inf>  (could not be evaluated)
feasible:      log likelihood = -21154.755
rescale:       log likelihood = -4665.8929
rescale eq:    log likelihood = -3554.3868
Iteration 0:   log likelihood = -3554.3868
Iteration 1:   log likelihood = -3414.8659
Iteration 2:   log likelihood = -3326.3478
Iteration 3:   log likelihood = -3314.4855
Iteration 4:   log likelihood = -3305.9761
Iteration 5:   log likelihood =  -3305.864
Iteration 6:   log likelihood = -3305.8635
Iteration 7:   log likelihood = -3305.8635

ML fit of two-parameter gamma distribution        Number of obs   =       1000
                                                  Wald chi2(0)    =          .
Log likelihood = -3305.8635                       Prob > chi2     =          .

------------------------------------------------------------------------------
           y |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
alpha        |
       _cons |   .9965541   .0392293    25.40   0.000     .9196661    1.073442
-------------+----------------------------------------------------------------
beta         |
       _cons |   10.06757   .5086919    19.79   0.000     9.070552    11.06459
------------------------------------------------------------------------------

Nick
n.j.cox@durham.ac.uk

Curtis Huffman Espinosa

I've been using the -glm- command to fit a gamma function, being my main interest the parameters of the fitted distribution. The thing is that I'm not sure which form of the scale parameter is saved in e(phi), whether this is exactly the same b (or 1/b) requested by the -gammaden()- function or not seem a total mystery just by looking at the ado-file.

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/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/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index