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]
Re: st: using ML for hurdle model, invalid syntax error
From
Maarten buis <[email protected]>
To
[email protected]
Subject
Re: st: using ML for hurdle model, invalid syntax error
Date
Fri, 22 Oct 2010 08:45:26 +0100 (BST)
--- On Thu, 21/10/10, Leny Mathew wrote:
> I'm trying to use the ml function to estimate a hurdle
> model. <snip>
> The code is below:
>
> ml model lf hurdle_gam (cnew= time tsq) (time tsq) if T
> <=3 & final==0, robust cluster(ID)
> ml check
<snip>
> args lnf beta1 beta2 lnphi
<snip>
> gen double `phi' = exp(`lnphi')
> =
> gen double __00000B = exp()
> invalid syntax
-ml- calls your evaluator (-hurdle_cam-) with first the name
of the variable in which to store the log-likelihood, than the
linear predictor of your first equation (-(cnew= time tsq)-),
than the linear predictor of the second equation (-(time tsq)-),
and since you did not specify a third equation in your -ml model-
statement, there will be no third equation. So, even though you
specified a third equation called lnphi in the -args- command,
that local macro will be empty, so -exp(`lnphi')- will be
evaluated as -exp()-, which gives your error. To solve this you
need to specify the third equation in your -ml model statement.
If you only want it to be a constant you can do that as follows:
ml model lf hurdle_gam (cnew= time tsq) (time tsq) /lnphi ///
if T <=3 & final==0, robust cluster(ID)
Hope this helps,
Maarten
--------------------------
Maarten L. Buis
Institut fuer Soziologie
Universitaet Tuebingen
Wilhelmstrasse 36
72074 Tuebingen
Germany
http://www.maartenbuis.nl
--------------------------
*
* 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/