Hello,
I defined the following maximum likelihood program for bivariate probit model.
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
STATA gave me an error "unknown function 1-()" after
. quietly replace `lnf'=(ln(binorm(-`theta1',-`theta2',`TH'))-ln((1–(normprob(-‘theta2'))^131)^(1/48))) if $ML_y1==0 & $ML_y2==0
I read on a previous STATA list, William Gould of Stata Corp once stated "Never code 1-normprob(z). Code instead normprob(-z), which is far more accurate."
However, as you can see in the above code, I have 1-(normprob(z)^131) instead of 1-normprob(z).
It cannot be easily converted it into a form without using 1-() and I cannot think of any solution so far.
On the other hand, I see sometimes people use 1-normprob(z) in their program without encountering errors.
I read "Maximum Likelihood Estimation with Stata", but I haven't found a solution so far.
If anyone could suggest me a way to avoid the error, I would very much appreciate it.
Hitomi
I defined the following maximum likelihood program for bivariate probit model.
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
STATA gave me an error "unknown function 1-()" after
. quietly replace `lnf'=(ln(binorm(-`theta1',-`theta2',`TH'))-ln((1–(normprob(-‘theta2'))^131)^(1/48))) if $ML_y1==0 & $ML_y2==0
I read on a previous STATA list, William Gould of Stata Corp once stated "Never code 1-normprob(z). Code instead normprob(-z), which is far more accurate."
However, as you can see in the above code, I have 1-(normprob(z)^131) instead of 1-normprob(z).
It cannot be easily converted it into a form without using 1-() and I cannot think of any solution so far.
On the other hand, I see sometimes people use 1-normprob(z) in their program without encountering errors.
I read "Maximum Likelihood Estimation with Stata", but I haven't found a solution so far.
If anyone could suggest me a way to avoid the error, I would very much appreciate it.
Hitomi
Comment