# st: RE: re: comparing coefficients across by-groups

 From "Apostolos Ballas" To statalist@hsphsun2.harvard.edu Subject st: RE: re: comparing coefficients across by-groups Date Sun, 6 Feb 2005 09:02:37 +0200

```Thanks! This does the trick.

A. Ballas

-----Original Message-----
From: owner-statalist@hsphsun2.harvard.edu
[mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of Kit Baum
Sent: Saturday, February 05, 2005 9:28 PM
To: statalist@hsphsun2.harvard.edu
Subject: st: re: comparing coefficients across by-groups

On Feb 5, 2005, at 12:40 PM, Apostolos Ballas wrote:

> Is there a simple way to test equality of coefficients from regressions
> estimated over a number of sub-samples using the by command?
>
> To be more specific, lets say I estimate  >  > By group:regress y x1 x2
>  > How can I test (automatically) whether  >  >  b11=b12=b13=...
>
> Where bij refers to the coefficients of the ith independent estimated  >
in the  > jth sub-sample.

and Michael replied

Would it be econometrically equivalent to create dummy variables
for
them with x1 & x2, and test the joint significance of the set of
interactions with each x?  This approach could be made more compact with the
-xi- command.  (You'll likely want dummies on the intercept for the same
(n-1) sub-samples as well.)  HTH.

It would not be econometrically equivalent since the single regression,
fully interacted including the constant, is being estimated with a
constraint of a single sigma^2 across the groups. Unless that is a
tenable assumption, it will lead to biased standard errors. Since the
resulting heteroskedasticity is of known form, handling it with
-robust- is not the best idea.

I believe this is a proper application of _suest_ (not be be confused
with _sureg_). whelp suest. Rather than using _by_, you need to use
_forvalues_ or _foreach_ to iterate over the groups and run the
regressions and store estimates for each: e.g.

webuse grunfeld,clear
drop if company>4
estimates clear
qui forv i=1/4 {
regress invest mvalue kstock if company==`i'
estimates store co`i'
}
suest *
test [co1_mean]mvalue=[co2_mean]mvalue
test [co1_mean]mvalue=[co3_mean]mvalue,accum
test [co1_mean]mvalue=[co4_mean]mvalue,accum

ALBOSPGALW !!!

Kit Baum, Boston College Economics
http://ideas.repec.org/e/pba1.html

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

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