[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]
st: Re: MLE
Stata hardly ever does things one observation at a time. You mylogit
program will display the value of `a' for the first observation only each
time it is called because when you say
di "a=" `a'
Stata sees that `a' is a variable name and displays `a' because that is
how it deals with -display var-, it displays the value of var. If you
wanted a full listing of `a' then you should tell stata to -list `a'-.
The reason you see a varying number of values output each time is that ml
maximize needs to call your mylogit program multiple times in each iteration
to figure out the next step in the maximization process (to calculate
derivatives). You probably don't want to see a full listing of `a' for each
of these calls.
----- Original Message -----
Sent: Tuesday, June 07, 2005 12:38 PM
Subject: st: MLE
I'm wondering if anyone would be able to describe what the process is when
runs the ml maximize command. I am running Stata 8.2
In particular, in my MLE model, I have included a command to display the
contents of a temporary variable.
If Stata loops through my program one datapoint at a time, I would expect
seee the contents of this temporary variable for every datapoint in my
However, Stata doesn't seem to do this. In the "zero" iteration, it
variable 13 times. In the first iteration, it displays my variable 16
the second iteration, 9 times.
What is Stata doing to run this program? Thanks in advance.
Here is my simple MLE program.
capture program drop mylogit3
args todo b lnf
tempvar theta1 a c
mleval `theta1' = `b', eq(1)
quietly gen double `a' = exp(`theta1')/(1+exp(`theta1'))
quietly gen double `c' = 1/(1+exp(`theta1'))
di "a = " `a'
mlsum `lnf' = ln(`a'^($ML_y1) * `c'^(1-$ML_y1))
ml model d0 mylogit3 (indicator = w_rdsalperc)
* For searches and help try: