# st: Cross-equation restrictions using -ml- command

 From "Randall Charles Juras" To statalist@hsphsun2.harvard.edu Subject st: Cross-equation restrictions using -ml- command Date Mon, 13 Oct 2008 11:32:02 -0400

Hi, I am trying to estimate a structurally-based likelihood function using Stata’s –ml- command. I am having trouble imposing a necessary cross-equation restriction. I assume that the data-generating process involves three latent variable equations, one of which is a function of the other two:
```y1* = Xb1 + e1
y2* = Xb2 + e2
```
y3* = y1* - y2* so that y1 ... y3 = 0,1. I also assume that the errors e1 and e2 follow a bivariate normal distribution, with mean zero and std. error sigma. For each observation in the data, I observe either y1 and y2, or y1 and y3 (but never all three). A sample of the relevant ml code might look like:
```program my_lf
args lnf x1 x2 x3 rho
```
quietly replace `lnf’ = ln(binormal( `x1’, `x2’, `rho’)) if (\$ML_y1 == 1 & \$ML_y2 == 1) quietly replace `lnf’ = ln(binormal( `x1’, `x3’, `rho’)) if (\$ML_y1 == 1 & \$ML_y3 == 1) (etc.) Setting any other issues aside, I obviously need to tell Stata that x3 is related to x1 and x2 – and at the same time I need to input \$ML_yn for all 3 equations (so I can’t input x1 and x2, and generate x3 as a function of those two). Any suggestions on how I can do that? Thanks for your consideration. Randy Juras
```
*
*   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/
```