Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


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

st: Quai Maximum likelihood and multipul imputation


From   yoel ben or <[email protected]>
To   [email protected]
Subject   st: Quai Maximum likelihood and multipul imputation
Date   Mon, 21 Jan 2013 20:16:05 +0200

Dear Stata users,

I use Stata 11. The Data which i am working on has multiple imputation
Data. I wrote a program using -Ml model-  which maximize a
quasi-maximum equation.

I am having two problems:

1. I added a -display- option to see some of the calculations , and when
you run the program it seems like the program is using only the first
observation in the data while maximizing the equation.  when displaying the
calculation (p1, p2, p3) is always equal to (0, 0, 0) - the first
observation in the data.  you can see the program i wrote bellow.

2. Because the data is imputed I tried to use the -mi estimate, cmdok: -,
but I keep getting an error.

If I put the -mi estimate, cmdok:-  before  -ml maximize-   I get the error:

"you must issue -ml model- first

an error occurred when mi estimate executed ml on m=2"

If I put  -mi estimate, cmdok:- before -ml model-  I get the error:

"macro e(cmd) is not set

matrix e(b) is not set

matrix e(V) is not set"

I will be more then grateful if you can explain to me what am I doing wrong?
Best,
Yoel Ben-Or

The Program:

program yoel

args lnf theta1 sigma

tempvar g1 g2 g3

local p1 $ML_y1

local p2 $ML_y2

local p3 $ML_y3

scalar  bb=ln(50000+(50000^2+1)^0.5)

scalar  cc=ln(150000+(150000^2+1)^0.5)

generate double `g1'=normal((bb-`theta1')/`sigma')-normal((0-`theta1')/`sigma')

generate double `g2'=normal((cc-`theta1')/`sigma')-normal((bb-`theta1')/`sigma')

generate double `g3'=1-normal((cc-`theta1')/`sigma')

display as result `sigma',`theta1', "(",`g1', `g2' ,`g3',")",
"(",`p1',`p2', `p3',")"

quietly replace
`lnf'=`p1'*ln(`g1')+(1-`p1')*ln(1-`g1')+`p2'*ln(`g2')+(1-`p2')*ln(1-`g2')+`p3'*ln(`g3')+(1-`p3')*ln(1-`g3')

end

ml model lf yoel (p1 p2 p3 = $xlist)  /sigma

ml search

ml maximize
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index