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
[email protected]
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/