Statalist The Stata Listserver


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: Fixing an -ml model- syntax problem


From   "Arne Risa Hole" <arnehole@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: Fixing an -ml model- syntax problem
Date   Tue, 20 Feb 2007 17:45:11 +0000

Hi Clive,

The following seems to work:

webuse union, clear
capture program drop gplogit
program define gplogit
 version 6
 args lnf theta delta
 qui replace `lnf' = $ML_y1*`theta'*(1+`delta') - ///
 ln(1+exp(`theta'*(1+`delta')))
end
 ml model lf gplogit (union = age black grade south) ///
 (delta: black,nocons)
ml maximize

Note that changing the "qui replace `lnf'..." line to:

qui replace `lnf' = $ML_y1*`theta'*(exp(`delta')) - ///
ln(1+exp(`theta'*(exp(`delta'))))

forces the estimated scale parameter/ error variance to be positive,
which is a good thing. This is a similar parameterisation to that used
in Richard Williams' -oglm- routine.

Hope this helps.

Arne

On 20/02/07, Clive Nicholas <crazeeclive@yahoo.co.uk> wrote:
For fun, I thought I'd test out an old piece of Stata code I found in Allison (1999: 203-4) that fires up a logit model which takes into account unequal residual variation across groups. I'm sure it's just a minor thing, but I'm having problems running his Stata 6 routine, which utilizes -ml- code:

webuse union, clear
program define gplogit
   version 6
   args lnf theta delta
   qui replace `lnf' =
    $ML_y1*`theta'*(1+`delta')
    ln(1+exp(`theta'*(1+`delta')))
end
   ml model lf gplogit (union = age black grade south) ///
   (delta: black,nocons)
ml maximize

Using Glenn Hoetker's -complogit- routine shows there is residual variation and actions the above model. Unfortunately, all I get with this code is

invalid syntax
r(198);

which is rather puzzling, as I can't see a lot wrong. Can anyone solve this puzzle?

Clive Nicholas

Reference

Allison PD (1999) "Comparing Logit and Probit Coefficients Across Groups", SOCIOLOGICAL METHODS AND RESEARCH (28)2: 186-208.





___________________________________________________________
All New Yahoo! Mail – Tired of unwanted email come-ons? Let our SpamGuard protect you. http://uk.docs.yahoo.com/nowyoucan.html

*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/

*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   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   |   What's new   |   Site index