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

# Re: st: How to name equations or test coeffs across regs

 From "Michael N. Mitchell" To statalist@hsphsun2.harvard.edu Subject Re: st: How to name equations or test coeffs across regs Date Mon, 27 Sep 2010 12:13:14 -0700

```Dear Emily

Here is an example using the -auto- dataset that I hope is helpful.

. sysuse auto
(1978 Automobile Data)

. sureg (price length weight) (mpg length weight)

Seemingly unrelated regression
----------------------------------------------------------------------
Equation          Obs  Parms        RMSE    "R-sq"       chi2        P
----------------------------------------------------------------------
price              74      2    2366.261    0.3476      39.42   0.0000
mpg                74      2     3.34377    0.6614     144.54   0.0000
----------------------------------------------------------------------

------------------------------------------------------------------------------
|      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
price        |
length |  -97.96031    38.3723    -2.55   0.011    -173.1686   -22.75198
weight |   4.699065   1.099354     4.27   0.000     2.544371    6.853759
_cons |   10386.54   4219.928     2.46   0.014     2115.635    18657.45
-------------+----------------------------------------------------------------
mpg          |
length |  -.0795935    .054224    -1.47   0.142    -.1858706    .0266836
weight |  -.0038515   .0015535    -2.48   0.013    -.0068963   -.0008067
_cons |   47.88487   5.963191     8.03   0.000     36.19723    59.57251
------------------------------------------------------------------------------

. test [price]length

( 1)  [price]length = 0

chi2(  1) =    6.52
Prob > chi2 =    0.0107

. test [mpg]length

( 1)  [mpg]length = 0

chi2(  1) =    2.15
Prob > chi2 =    0.1421

. test [price]length == [mpg]length

( 1)  [price]length - [mpg]length = 0

chi2(  1) =    6.50
Prob > chi2 =    0.0108

Best luck!

Michael N. Mitchell
Data Management Using Stata      - http://www.stata.com/bookstore/dmus.html
A Visual Guide to Stata Graphics - http://www.stata.com/bookstore/vgsg.html
Stata tidbit of the week         - http://www.MichaelNormanMitchell.com

On 2010-09-27 11.53 AM, Emily Rauscher wrote:
```
```
I am trying to use the test function to see whether a coefficient is equal in two different OLS regressions.  However, I cannot figure out how to name equations.

When I use the sureg command, as suggested on pp. 1914-5 of the version 11 user's manual, stata does not recognize the first word as an equation name and gives an error.

I feel I'm missing something very simple, but I have searched the manual and tried everything I can find.
Any suggestions - for either naming equations or a better way to test the equality of coefficients in different regressions - would be hugely appreciated.
Many thanks,
Emily

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