Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: re: comparing coefficients across by-groups

From   Kit Baum <>
Subject   st: re: comparing coefficients across by-groups
Date   Sat, 5 Feb 2005 14:27:36 -0500

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
(n-1) of your sub-samples (equivalently, I think, your groups),
interact 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


Kit Baum, Boston College Economics

* For searches and help try:

© Copyright 1996–2015 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index