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: Maximum Likelihood


From   Hitomi Amaya <[email protected]>
To   [email protected]
Subject   st: Maximum Likelihood
Date   Tue, 1 Apr 2014 11:52:39 -0700 (PDT)

Hello,

I defined the following maximum likelihood program for bivariate probit
model.
STATA gave me an error "unknown function 1-()".
I found William Gould of Stata corp mentioning:
"Never code 1-normprob(z).  Code instead normprob(-z), which is far more
accurate."
to Deborah who raised a similar question on this STATA list.

However, as you can see in my code below, I have 1-(normprob(z)^131) instead
of 1-normprob(z).
I cannot easily convert it into a form without using 1-(...).  

I read "Maximum Likelihood Estimation with Stata", but I couldn't find a
solution.
I would very much appreciate it if anyone could come up with a solution to
this problem.

There is my code (which is a modification of the code written by Antoine,
also found on the STATA list):

program define mybiprobt
args lnf theta1 theta2 theta3
tempvar TH
quietly gen double
`TH'=((exp(`theta3')-exp(-`theta3'))/(exp(`theta3')+exp(-`theta3')))
quietly replace
`lnf'=(ln(binorm(-`theta1',-`theta2',`TH'))-ln((1–(normprob(-‘theta2'))^131)^(1/48)))
if $ML_y1==0 & $ML_y2==0
quietly replace
`lnf'=(ln(binorm(-`theta1',`theta2',-`TH'))-ln((1–(normprob(-‘theta2'))^131)^(1/48)))
if $ML_y1==0 & $ML_y2==1
quietly replace
`lnf'=(ln(binorm(`theta1',-`theta2',-`TH'))-ln((1–(normprob(-‘theta2'))^131)^(1/48)))
if $ML_y1==1 & $ML_y2==0
quietly replace
`lnf'=(ln(normprob(`theta2')-binorm(-`theta1',`theta2',-`TH'))-ln((1–(normprob(-‘theta2'))^131)^(1/48)))
if $ML_y1==1 & $ML_y2==1
end

Thank you.
Hitomi Amaya




--
View this message in context: http://statalist.1588530.n2.nabble.com/Maximum-Likelihood-tp7580502.html
Sent from the Statalist mailing list archive at Nabble.com.

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