Statalist


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

st: RE: ML for a simple estimation


From   "Nick Cox" <n.j.cox@durham.ac.uk>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: RE: ML for a simple estimation
Date   Mon, 2 Feb 2009 19:14:05 -0000

Your program -maxlik- indicates that there are four arguments, i.e. four
things are fed to it. If you supply fewer arguments than that, a syntax
error is likely. 

. set trace on 

And see what happens line by line. 

More importantly, I suggest studying published worked examples more
closely. 

Nick 
n.j.cox@durham.ac.uk 

Vincenzo

I'm very new to ML command. I'm trying to estimate a model using MLE.  
As you can see in my program (in reality this is a simplified  
version), I defined the parameters to be estimated in the args string  
(these are L0 L1 and d).
The other letters in the loglikelihood represent variable.
When I run the program I have an r(198) for invalid sintax.
Maybe the way the program works is not clear to me..

Any suggestion about how to fix the problem i welcome

program define maxlik
  args lnf L0 L1 d

quietly replace `lnf' = (2-d0b-d0f)*ln(`L0')+ln((`L1')/(`d')) if  
$ML_y1==0
quietly replace `lnf' = 1+ln((`L0')/(`d')) if $ML_y1==1

end

   ml model lf maxlik (x=d0b d0f)
   ml maximize


*
*   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   |   What's new   |   Site index