Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: My first Maximum Likelihood


From   "Renzo Comolli" <renzo.comolli@yale.edu>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: My first Maximum Likelihood
Date   Tue, 22 Oct 2002 13:23:55 -0400

Dear all,

I tried to program a maximum likelihood following the reference manual
under ml. Here below you can see what I came up with but I am very
confused (and it does not work, I see it could not possibly). I know
there is a book on ML in stata but we don't have it (I ordered it right
now).

My ultimate goal: use (log of) income as a dependant variable in the GSS
dataset and assume it is normally distributed (income in the GSS is
recorded in categories). I told you my ultimate goal in case anybody
kindly has any reference or any idea he/she wants to tell me about it.

My goal for today is to program this very simplified likelihood:
 My log likelihood "on paper" is
37*ln(norm((1000-x(i)'beta)/sigma))+30*ln(1-norm((1000-x(i)'
beta)/sigma)))
 Where x(i) is the usual i-th row of the matrix of the regressors, and
norm is the cumulative normal
 
As said I am very confused, what I came up with is:
 
 program define mylikelihood
 	args lnf theta1 theta2
 	replace
`lnf'=37*ln(norm((1000-`theta1')/`theta2')+30*ln(1-norm((1000-`theta1')/
`theta2'))
 end
 
 
 ml model lf mylikelihood (Rincome= LB marital educ race xnorcsiz)
 ml check 
 ml search 
 ml maximize
 ml clear
 

 Any idea? Suggestions?
 Thank you very much in advance!
 
 Renzo Comolli

*
*   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