# st: RE: Standard Errors

 From "Maarten Buis" To Subject st: RE: Standard Errors Date Tue, 28 Nov 2006 12:02:54 +0100

```--- Yuksel wrote:
> I am running the same regression for 3 consecutive years
> (each year has a different number of observations) and
> taking the 3-year averages of OLS coefficients. How can
> I calculate standard errors for these averages?

Yuksel:
Apparently you think that the effect of your explanatory
variable is the same in each year, and a better estimate
of the size of that effect is the average of the effects
in individual years. An even better and easier way to get
such a combined estimate is to constrain the effect of
explanatory variable to be the same across years. This is
actually very simple to do, since all you have to do is
*not* add an interaction term with year.

Consider the example below and imagine that the three
values rep78 can take actually represent years. If you
compare the first four regression models you'll see that
estimating the models separately for different values of
rep78 is the same as entering all interaction effects
(well, almost the same: estimating the models separately
allows for different error variances for different values
of rep78, i.e. heteroscedasticity). If the interaction
effects allow the effects of mpg to differ across values
of rep78, than removing those interaction effects will
constrain the effects to be the same, this is the final
model in the example. So all you need to do is estimate a
regression with year dummies and your explanatory variables
and any controls you like, and the effect of the
explanatory variable is the effect of the explanatory
variable constrained to be the same across years.
HTH,
Maarten

*-------------- begin example ------------------
sysuse auto, clear
recode rep78 1/2=3

gen rep3 = rep78==3 if rep78<.
gen rep4 = rep78==4 if rep78<.
gen rep5 = rep78==5 if rep78<.

gen rep3Xmpg = rep3*mpg
gen rep4Xmpg = rep4*mpg
gen rep5Xmpg = rep5*mpg

reg price rep3 rep4 rep5 /*
*/ rep3Xmpg rep4Xmpg rep5Xmpg, nocons
reg price mpg if rep3==1
reg price mpg if rep4==1
reg price mpg if rep5==1

reg price rep3 rep4 rep5 mpg, nocons
*------------- end example -----------------

-----------------------------------------
Maarten L. Buis
Department of Social Research Methodology
Vrije Universiteit Amsterdam
Boelelaan 1081
1081 HV Amsterdam
The Netherlands

Buitenveldertselaan 3 (Metropolitan), room Z434

+31 20 5986715

http://home.fsw.vu.nl/m.buis/
-----------------------------------------

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