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 on April 23, and its replacement, statalist.org is already up and running.


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

st: using ML for hurdle model, invalid syntax error


From   Leny Mathew <lenymathewc@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   st: using ML for hurdle model, invalid syntax error
Date   Thu, 21 Oct 2010 17:18:50 -0400

Hello All,

I'm trying to use the ml function to estimate a hurdle model. Instead
of the Poisson or the negative binomial, I'm using the gamma
distribution for the second part of the model. I've written this based
on the article on the stata journal, 3, No.2, PP 178-184.
 stata is returning an invalid syntax error to ml check. The code is below:


ml model lf hurdle_gam (cnew= time tsq) (time tsq) if T <=3 &
final==0, robust cluster(ID)
ml check


Test 1:  Calling hurdle_gam to check if it computes log pseudolikelihood and
         does not alter coefficient vector...
         FAILED; hurdle_gam returned error 198.

Here is a trace of its execution:
------------------------------------------------------------------------------
-> hurdle_gam __000007 __000005 __000006
              - `begin'
              = capture noisily version 10.1: hurdle_gam __000007
__000005 __000006

--------------------------------------------------------------------------------------------------------------
begin hurdle_gam ---
                - version 10.1
                - args lnf beta1 beta2 lnphi
                - tempvar T E C phi pi
                - quietly {
                - gen double `pi' = exp(`beta1')
                = gen double __00000C = exp(__000005)
                - gen double `E' = exp(`beta2')
                = gen double __000009 = exp(__000006)
                - gen double `phi' = exp(`lnphi')
                = gen double __00000B = exp()
invalid syntax
                  gen double `T' = 1/`phi'
                  gen double `C' =
`T'*ln($ML_y1/`phi')-ln($ML_y1)-lngamma(1/`phi')
                  replace `lnf' = cond($ML_y1==0, -`pi',
log(1-exp(-`pi'))+`T'*($ML_y1*(-1/`E')-`beta2')+`C')
                  }

----------------------------------------------------------------------------------------------------------------
end hurdle_gam ---
              - `end'
              = set trace off
------------------------------------------------------------------------------
Fix hurdle_gam.
r(198);


I can see that when trying to do "gen double `phi'=exp(`lnphi'), the
temporary variable returns exp(), but I'm not sure how to fix that.
Any comments on this is greatly appreciated.

Thanks,

Leny
*
*   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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index