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: 回复: st: error report with ml check


From   健 张 <[email protected]>
To   "[email protected]" <[email protected]>
Subject   st: 回复: st: error report with ml check
Date   Fri, 16 Sep 2011 04:18:35 +0800 (CST)

Hi, Fernando:
Thank you so much for your reply. The likelihood evaluator I wrote is like this:
program mybiprobit2_lf
 version 9.1
 args lnf xb zc rho
 quietly replace `lnf' = ln(binormal( `xb',`zc', `rho')) if $ML_y1 == 1
 quietly replace `lnf' = ln(binormal(-(`xb',`zc', `rho'))) if $ML_y1 == 0
end
This code is simply mimicing the code for probit case. The probit case is like this
program myprobit_lf
 version 9.1
 args lnf xb
 quietly replace `lnf' = ln(normal( `xb')) if $ML_y1 == 1
 quietly replace `lnf' = ln(normal(-`xb')) if $ML_y1 == 0
end

Therefore, I dont quite understand why the negative sign should be removed. Do you have any suggestion for writing the right code of the likelihood function when $ML_y1 == 0
 ?
Thank you so much!!


Best,
Jian





----- 原邮件 -----
发件人: Fernando Rios Avila <[email protected]>
收件人: [email protected]
抄送: 
发送日期: 2011年9月15日, 星期四, 上午 11:12
主题: Re: st: error report with ml check

Hi Jian,
First of all, these lines:
>          = quietly replace __00000C = ln(binormal(-(__00000D,__00000E, __00000F
>> ))) if treated == 0
> __00000D,__00000E,__00000F invalid name
stand for this others:
quietly replace `lnf' = ln(binormal(-(`xb',`zc', `rho'))) if $ML_y1
>> == 0

and from what I see you are not declaring your binormal function
correcty. if you look closely, you are using the negative sign where
its not suppouse to be, thuse creating the problem.

Fernando

On Thu, Sep 15, 2011 at 10:37 AM, 健 张 <[email protected]> wrote:
> Hi, all:
> I am trying to write my own code to do the maximize likelihood
> estimation of bivariate probit model. I know I can use the biprobit
> command to do it. However, due to the poor convergence problem, I want
> to write my own code for it. When I type "ml check" , I encounter such
> error report.
>
> Test 1:  Calling mybiprobit2_lf to check if it computes log pseudolikelihood
>          and
>          does not alter coefficient vector...
>          FAILED; mybiprobit2_lf returned error 198.
>
> Here is a trace of its execution:
> ------------------------------------------------------------------------------
> -> mybiprobit2_lf __00000C __00000D __00000E __00000F
>         - `begin'
>         = capture noisily version 11.2: mybiprobit2_lf __00000C __00000D __00000
>> E __00000F
>           --------------------------------------------- begin mybiprobit2_lf ---
>           - version 9.1
>           - args lnf xb zc rho
>           - quietly replace `lnf' = ln(binormal( `xb',`zc', `rho')) if $ML_y1 ==
>>  1
>           = quietly replace __00000C = ln(binormal( __00000D,__00000E, __00000F)
>> ) if treated == 1
>           - quietly replace `lnf' = ln(binormal(-(`xb',`zc', `rho'))) if $ML_y1
>> == 0
>           = quietly replace __00000C = ln(binormal(-(__00000D,__00000E, __00000F
>> ))) if treated == 0
> __00000D,__00000E,__00000F invalid name
>           ----------------------------------------------- end mybiprobit2_lf ---
>         - `end'
>         = set trace off
> ------------------------------------------------------------------------------
> Fix mybiprobit2_lf.
> r(198);
>
> Here, xb is for the first equation and zc is for the second equation.
> For my understanding, my likelihood evaluator for bivariate probit model
>  should be right. However, when the program pick up the value of the
> variable form the data, there is some problem. That is why I have the
> _000002 invalid name. But, I am not so sure what the __000002 stands for
>  and how I can correct the problem. Anyone knows what happens here?
> Thank you in advance!!
> .
> Jian
>
>
> *
> *   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/
>

*
*  For searches and help try:
*  http://www.stata.com/help.cgi?searchhttp://www.stata.com/support/statalist/faqhttp://www.ats.ucla.edu/stat/stata/


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


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