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

# st: Comparing OLS regression coefficients across groups

 From TWC <[email protected]> To [email protected] Subject st: Comparing OLS regression coefficients across groups Date Thu, 28 Jun 2012 10:31:47 +0800

```Greetings to all,

I need to compare regression coefficients across 2 groups to determine
whether the effect for one group is significantly different from the

a. Run a regression over all groups combined, adding the appropriate
interaction terms which would indicate the difference and its
significance.

b. Similar to (a), but do not require the rvariance of the residual to
be the same for both groups.  From
http://www.stata.com/support/faqs/statistics/pooling-data-and-chow-tests/

c. (suest) - Run regressions separately per group, storing each result
separately then using suest and lincom to calculate the difference in
coefficients.

Two questions:

1.  The above methods produce different standard errors for the
interaction term (or equivalent).  I gather that this is due to the
differences in assumptions on the variance of the residual and sample
size, but I am not sure exactly how.  And in cases (like the example
below) where the significance hovers at the threshold, which std err /
P-value is the appropriate values to be reported?

Method a: Std err = .0017846, P>|t| = 0.015
Method b: Std err = .0025643, P>|t| = 0.087
Method c: Std err = .0017067, P>|z| = 0.009   (test reports Prob >
chi2(1) = 0.0091)

2. In the example below, the standard error for _b[weight] for
Domestic cars also differ.  While it is significant in all methods,
which std err should be reported?

Method a: Std err = .0006622, P>|t| = 0.000
Method b: Std err = .0004633, P>|t| = 0.000
Method c: Std err = .0004654, P>|t| = 0.000   (suest reports std
err = .0005334, P>|z| = 0.000)

Much thanks!
Tian

Truncated log below:

. sysuse auto

/************ Method a *********************/

. regress mpg i.foreign##c.weight

----------------------------------------------------------------------------------
mpg |      Coef.   Std. Err.      t    P>|t|     [95%
Conf. Interval]
-----------------+----------------------------------------------------------------
weight |  -.0059751   .0006622    -9.02   0.000    -.0072958
-.0046544
|
foreign#c.weight |
1  |  -.0044509   .0017846    -2.49   0.015    -.0080101
-.0008916
----------------------------------------------------------------------------------

. test 1.foreign#c.weight

( 1)  1.foreign#c.weight = 0

F(  1,    70) =    6.22
Prob > F =    0.0150

/************ Method b *********************/

. gen g1 = (foreign==0)
. gen g2 = (foreign==1)
. gen g2weight = g2*weight
. regress mpg weight g2 g2weight
. predict r, resid
. sum r if g1
. gen w = r(Var) * (r(N)-1)/(r(N)-3) if g1
. sum r if g2
. replace w = r(Var)*(r(N)-1)/(r(N)-3) if g2
. regress mpg weight g2 g2weight [aw=1/w]

------------------------------------------------------------------------------
mpg |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
weight |  -.0059751   .0004633   -12.90   0.000    -.0068992    -.005051

g2weight |  -.0044509   .0025643    -1.74   0.087    -.0095653    .0006636
------------------------------------------------------------------------------

. test g2weight

( 1)  g2weight = 0

F(  1,    70) =    3.01
Prob > F =    0.0870

/************ Method c *********************/

. regress mpg weight if foreign
. estimates store Foreign
. regress mpg weight if !foreign

------------------------------------------------------------------------------
mpg |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
weight |  -.0059751   .0004654   -12.84   0.000    -.0069098   -.0050403
------------------------------------------------------------------------------

. estimates store Domestic
. suest Domestic Foreign

Simultaneous results for Domestic, Foreign

--------------------------------------------------------------------------------
|               Robust
|      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
---------------+----------------------------------------------------------------
Domestic_mean  |
weight |  -.0059751   .0005334   -11.20   0.000    -.0070205   -.0049297
---------------+----------------------------------------------------------------

. lincom [Foreign_mean]weight - [Domestic_mean]weight

( 1)  - [Domestic_mean]weight + [Foreign_mean]weight = 0

------------------------------------------------------------------------------
|      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
(1) |  -.0044509   .0017067    -2.61   0.009    -.0077959   -.0011059
------------------------------------------------------------------------------
*
*   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/
```