UCLA Academic Technology Services HomeServicesClassesContactJobs
Search

Stata Code Fragment: 
Comparing Regression Coefficients Across Groups using Suest

The FAQ at http://www.ats.ucla.edu/stat/stata/faq/compreg3.htm shows how you can compare regression coefficients across three groups using xi and by forming interactions.  This can also be done using suest as shown below.

use http://www.ats.ucla.edu/stat/stata/faq/compreg3

regress weight height if age==1

      Source |       SS       df       MS              Number of obs =      10
-------------+------------------------------           F(  1,     8) =    0.24
       Model |   42.657257     1   42.657257           Prob > F      =  0.6396
    Residual |  1440.94274     8  180.117843           R-squared     =  0.0288
-------------+------------------------------           Adj R-squared = -0.0927
       Total |      1483.6     9  164.844444           Root MSE      =  13.421

------------------------------------------------------------------------------
      weight |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
      height |  -.3768309   .7743341    -0.49   0.640    -2.162449    1.408787
       _cons |   170.1664   49.43018     3.44   0.009     56.18024    284.1526
------------------------------------------------------------------------------

est store age1

regress weight height if age==2

      Source |       SS       df       MS              Number of obs =      10
-------------+------------------------------           F(  1,     8) =  359.81
       Model |  1319.56112     1  1319.56112           Prob > F      =  0.0000
    Residual |  29.3388815     8  3.66736019           R-squared     =  0.9782
-------------+------------------------------           Adj R-squared =  0.9755
       Total |      1348.9     9  149.877778           Root MSE      =   1.915

------------------------------------------------------------------------------
      weight |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
      height |   2.095872    .110491    18.97   0.000      1.84108    2.350665
       _cons |   -2.39747   7.053272    -0.34   0.743    -18.66234     13.8674
------------------------------------------------------------------------------

est store age2

regress weight height if age==3

      Source |       SS       df       MS              Number of obs =      10
-------------+------------------------------           F(  1,     8) =  669.93
       Model |  3882.53627     1  3882.53627           Prob > F      =  0.0000
    Residual |  46.3637317     8  5.79546646           R-squared     =  0.9882
-------------+------------------------------           Adj R-squared =  0.9867
       Total |      3928.9     9  436.544444           Root MSE      =  2.4074

------------------------------------------------------------------------------
      weight |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
      height |   3.189727   .1232367    25.88   0.000     2.905543    3.473912
       _cons |   5.601677   8.930197     0.63   0.548    -14.99139    26.19475
------------------------------------------------------------------------------

est store age3

suest age1 age2 age3

Simultaneous results for age1, age2, age3
                                                            Obs      =      30

------------------------------------------------------------------------------
             |               Robust
             |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
age1_mean    |
      height |  -.3768309    .496919    -0.76   0.448    -1.350774    .5971124
       _cons |   170.1664   31.30796     5.44   0.000      108.804    231.5289
-------------+----------------------------------------------------------------
age1_lnvar   |
       _cons |   5.193611   .3232765    16.07   0.000     4.560001    5.827222
-------------+----------------------------------------------------------------
age2_mean    |
      height |   2.095872   .0862164    24.31   0.000     1.926891    2.264853
       _cons |   -2.39747   5.668326    -0.42   0.672    -13.50719    8.712246
-------------+----------------------------------------------------------------
age2_lnvar   |
       _cons |   1.299472   .2573396     5.05   0.000     .7950958    1.803848
-------------+----------------------------------------------------------------
age3_mean    |
      height |   3.189727   .1008442    31.63   0.000     2.992077    3.387378
       _cons |   5.601677   7.218938     0.78   0.438    -8.547181    19.75054
-------------+----------------------------------------------------------------
age3_lnvar   |
       _cons |   1.757076   .2637826     6.66   0.000     1.240072     2.27408
------------------------------------------------------------------------------

test [age1_mean]height=[age2_mean]height

 ( 1)  [age1_mean]height - [age2_mean]height = 0

           chi2(  1) =   24.04
         Prob > chi2 =    0.0000

test [age2_mean]height=[age3_mean]height, accum

 ( 1)  [age1_mean]height - [age2_mean]height = 0
 ( 2)  [age2_mean]height - [age3_mean]height = 0

           chi2(  2) =  102.25
         Prob > chi2 =    0.0000

How to cite this page

Report an error on this page

UCLA Researchers are invited to our Statistical Consulting Services
We recommend others to our list of Other Resources for Statistical Computing Help
These pages are Copyrighted (c) by UCLA Academic Technology Services


The content of this web site should not be construed as an endorsement of any particular web site, book, or software product by the University of California