Statalist The Stata Listserver


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

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


From   "Sergiy Radyakin" <Radyakin@aoek.uni-hannover.de>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: Re: Fixing an -ml model- syntax problem
Date   Tue, 20 Feb 2007 18:55:50 +0100

Hi,

I guess you are missing the /// after `lnf'=


It will work as below (write it in one line):




. webuse union, clear
(NLS Women 14-24 in 1968)

. program define gplogit
1. version 6
2. args lnf theta delta
3. qui replace `lnf' = $ML_y1*`theta'*(1+`delta')-ln(1+exp(`theta'*(1+`delta')))
4. end

. ml model lf gplogit (union = age black grade south) (delta: black,nocons)

. ml maximize

initial: log likelihood = -18160.456
alternative: log likelihood = -15543.013
rescale: log likelihood = -14686.973
rescale eq: log likelihood = -14013.151
Iteration 0: log likelihood = -14013.151 (not concave)
Iteration 1: log likelihood = -13478.948 (not concave)
Iteration 2: log likelihood = -13390.031
Iteration 3: log likelihood = -13354.622
Iteration 4: log likelihood = -13271.993
Iteration 5: log likelihood = -13270.038
Iteration 6: log likelihood = -13267.285
Iteration 7: log likelihood = -13267.225
Iteration 8: log likelihood = -13267.224

Number of obs = 26200
Wald chi2(4) = 1073.40
Log likelihood = -13267.224 Prob > chi2 = 0.0000

------------------------------------------------------------------------------
union | Coef. Std. Err. z P>|z| [95% Conf. Interval]
-------------+----------------------------------------------------------------
eq1 |
age | .0119869 .0023941 5.01 0.000 .0072945 .0166793
black | .8475739 .0615269 13.78 0.000 .7269834 .9681643
grade | .07586 .0069451 10.92 0.000 .0622479 .0894721
south | -.9233356 .0435432 -21.21 0.000 -1.008679 -.8379924
_cons | -2.52238 .1121859 -22.48 000 -2.742261 -2.3025
-------------+----------------------------------------------------------------
delta |
black | -.0198168 .0680003 -0.29 0.771 -.1530949 .1134614
------------------------------------------------------------------------------

.
.
end of do-file


Regards, Sergiy











----- Original Message ----- From: "Clive Nicholas" <crazeeclive@yahoo.co.uk>
To: <statalist@hsphsun2.harvard.edu>
Sent: Tuesday, February 20, 2007 6:10 PM
Subject: st: Fixing an -ml model- syntax problem



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