# st: Re: xtreg and stepwise

 From "Rodrigo A. Alfaro" To Subject st: Re: xtreg and stepwise Date Thu, 20 Jul 2006 16:49:13 -0400

```Valerie

You can use the regular regression but you need to adjust the degree of
freedom of the error variance. The adjustment is q=(N-K-1)/(N-K-n),
where N is the total sample, K the regressor and n the cross-sectional
size. As you can see the adjustment changes for every iteration of -sw-

Note that q = 1 + (n-1)/(N-K-n). In case that n is large (usually this is
the case for most of panel data) such that K/n and 1/n and very small
I think that you can approximate q by 1 + 1/(T-1).

Then you can use -xtdata, fe- and -sw reg - (with iweight or in short
iw) to deal with your problem.

Below is an example where:
T1 is a regression with -xtreg-,
T2 is a wrong regression (without adjustment),
T3 has a fixed adjustment (valid for balanced panel-data) and
T4 has a more accurate adjustment which is the one I recommend you.

I hope this helps you.
Rodrigo.

*** Illustration ***
qui {
webuse nlswork, clear
bysort idcode: egen double ti=count( idcode)
g w=(ti-1)/ti
sum year
local w= 1/(1+1/(r(max)-r(min)))
qui xtreg ln_w age ttl_exp tenure, fe i( idcode)
est store T1
preserve
xtdata ln_w age ttl_exp tenure w, fe clear
reg ln_w age ttl_exp tenure
est store T2
reg ln_w age ttl_exp tenure [iw=`w']
est store T3
reg ln_w age ttl_exp tenure [iw=w]
est store T4
restore
}
est table T*, se p
*** End Illustration ***

----- Original Message -----
From: "Valérie Orozco" <Valerie.Orozco@toulouse.inra.fr>
To: <statalist@hsphsun2.harvard.edu>
Sent: Thursday, July 20, 2006 6:09 AM
Subject: st: xtreg and stepwise

I'm using "xtreg" for time-series regression with fixed effects. I have
a lot of variables and I am wondering if it is possible to do a stepwise
regression to keep the most significant ones...Unfortunately, the
command "sw" does not work with "xtreg". Does someone have any idea?

Thank you.

valérie

--

***********************
Valérie Orozco
INRA ESR Toulouse - FRANCE
ESR INRA - BP52627 - 31326 Castanet Tolosan Cedex
orozco@toulouse.inra.fr
05-61-28-50-97
***********************

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