# Re: st: constrained least squares, multiple equations

 From Richard Williams To statalist@hsphsun2.harvard.edu Subject Re: st: constrained least squares, multiple equations Date Thu, 04 Mar 2004 13:53:46 -0500

```At 11:39 PM 3/3/2004 -0600, olena-stavrunova@uiowa.edu wrote:
```
Dear Statalist,
I have the model: Y1=X1*b1, Y2=X2*b1. I want to estimate these two equations
by least squares subject to constraint that b1=b2 , that is I want to estimate
the equation: [Y1 = [X1 *b
Y2] X2]
Please, let me know how to do this in Stata.
Thank you!
Olena
I just tried the following, and it SEEMED to work ok. Nonetheless, it would be nice if someone confirmed that this was the way to go. (Are you sure you want to use OLS, as opposed to reg3's default, which is 3 stage least squares? Read the help for -reg3-)

. reg3 (income educ) (jobexp black), ols

Multivariate regression
----------------------------------------------------------------------
Equation Obs Parms RMSE "R-sq" F-Stat P
----------------------------------------------------------------------
income 500 1 5.243321 0.6593 963.54 0.0000
jobexp 500 1 4.931661 0.0526 27.66 0.0000
----------------------------------------------------------------------

------------------------------------------------------------------------------
| Coef. Std. Err. t P>|t| [95% Conf. Interval]
-------------+----------------------------------------------------------------
income |
educ | 1.830332 .0589651 31.04 0.000 1.714622 1.946042
_cons | 3.702833 .8106362 4.57 0.000 2.112082 5.293584
-------------+----------------------------------------------------------------
jobexp |
black | -2.9 .5513765 -5.26 0.000 -3.981993 -1.818007
_cons | 14.1 .2465831 57.18 0.000 13.61612 14.58388
------------------------------------------------------------------------------

. test educ = black, coef

( 1) [income]educ - [jobexp]black = 0

F( 1, 996) = 72.77
Prob > F = 0.0000

Constrained coefficients

------------------------------------------------------------------------------
| Coef. Std. Err. z P>|z| [95% Conf. Interval]
-------------+----------------------------------------------------------------
income |
educ | 1.776845 .0586308 30.31 0.000 1.661931 1.891759
_cons | 4.40672 .8064257 5.46 0.000 2.826154 5.987285
-------------+----------------------------------------------------------------
jobexp |
black | 1.776845 .0586308 30.31 0.000 1.661931 1.891759
_cons | 13.16463 .2208621 59.61 0.000 12.73175 13.59751
------------------------------------------------------------------------------

*
* For searches and help try:
* http://www.stata.com/support/faqs/res/findit.html
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/