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

# st: 回复： st: Re: st: 回复： st: Re: st: 回复： st: error report with ml check

 From 健 张 To "statalist@hsphsun2.harvard.edu" Subject st: 回复： st: Re: st: 回复： st: Re: st: 回复： st: error report with ml check Date Tue, 20 Sep 2011 02:21:15 +0800 (CST)

```HI, Maarten
Thank you so much for your help! I am sorry for the misunderstanding that you wrote the code. I am also sorry for the messy code. It looks quite terrible. Dont know why so many As shown up by itself.

Best,
Jian

----- 原邮件 -----

On Fri, Sep 16, 2011 at 9:38 PM, å¥ å¼  <victerzj2@yahoo.com.cn> wrote:
> Hi, Maarten:
> Thank you for your reply. I have read the bipp_lf.ado. It is really quite different from what I wrote. Right now, I am just working on the simplest case, the linear restriction case.
>
> The code for the linear restriction case is like this:
> program define bipp_lf
> Â Â Â Â Â Â Â  version 6.0
> Â Â Â Â Â Â Â  local llÂ Â Â  "`1'"Â  /* Log l */
> Â Â Â Â Â Â Â  local xb1Â Â  "`2'"Â  /* x1*b1 */
> Â Â Â Â Â Â Â  local xb2Â Â  "`3'"Â  /* x2*b2 */
> Â Â Â Â Â Â Â  local kappa "`4'"Â  /* atanh(rho)Â Â  */
>
>
> Â Â Â Â Â Â Â  local rr = (exp(2*`kappa')-1) / (exp(2*`kappa')+1)
>
> Â Â Â Â Â Â Â  if `kappa' < -18 { local rr = -1 }
> Â Â Â Â Â Â Â  if `kappa' >Â  18 { local rr =Â  1 }
>
> Â Â Â Â Â Â Â  quietly {
> Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â  replace `ll' = binorm(`xb1',`xb2',`rr')
> Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â  replace `ll' = 1-`ll' if \$ML_y1 == 0
> Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â  replace `ll' = log(`ll')
> Â Â Â Â Â Â Â  }
> end
>
> I have several questions regarding the code:
> What does those "`1'" , "`2'" , "`3'" , "`4'"Â  stand for? I can understand the explaining part behind them. However, I dont see where you use those 1,2,3,4.

This is code by StataCorp not me, so I can only guess. this looks to
me like old code that precedes or chose not to use -args-. If you call
a program, than the first argument will be assigned to local `1', the
second to `2', etc. -args- will do the same as those lines.

Â > Why do you need to generate kappa? Why do you use the function
atanh(.) to generage kappa? For rr, did you parameterized kappa so
that the range can be (-infinity, infinity), which is as the technique
note on P56 of Maximum Likelihood Estimation in Stata, Gould, Pitblado
and Sribney, Stata Press: 3d ed., 2006?  If not, why do you generate
rr?

Again, I did not write this code, so I can still only guess. This
looks like it maximizes with respect to the Fisher's z transformed
correlation coefficient.

> Where do 18 and -18 come from?

My guess would be from either experience or simulations or both.

Hope this helps,
Maarten

--------------------------
Maarten L. Buis
Institut fuer Soziologie
Universitaet Tuebingen
Wilhelmstrasse 36
72074 Tuebingen
Germany

http://www.maartenbuis.nl
--------------------------

*
*   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?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/
```