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: RE: scale parameter form saved by glm


From   Nick Cox <[email protected]>
To   "'[email protected]'" <[email protected]>
Subject   st: RE: RE: scale parameter form saved by glm
Date   Thu, 24 Feb 2011 18:30:14 +0000

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

Nick 
[email protected] 

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 
[email protected] 

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/


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