Re: st: How to test for Fixed Effect after "areg"

 From Joseph Coveney <[email protected]> To Statalist <[email protected]> Subject Re: st: How to test for Fixed Effect after "areg" Date Sun, 20 Jul 2003 13:07:11 +0900

```Jayesh Kumar posted:

---------------------begin excerpt from posting---------------------------------

I am trying to fit a Fixed Effect Model, with two sets of controls (say x1 and
x2).
I want to test whether fixed effect is significant for both of the x's or any
one.

That is to say I want to do an F-test for significance of coefficients of
fixed effects for x1 and x2 seperately and jointly as well.

Since, my data set includes larg number of i(2000) and t(15), I am not
able to it through "reg".

Other option is to use "areg", but I am not able to figure out how to test
for the significance after areg. Is there any option to do a joint F-test
for the significance of fixed effect after areg?

-----------------------end excerpt from posting---------------------------------

I'm not sure whether I follow Jayesh's description, but if I understand it
correctly, then I recommend to use -xtreg , re- and not -areg- (-xtreg , fe-
would be the same).  If the independent variables x1 and x2 (sets of controls)
are between individuals, then both -areg- and -xtreg , fe- would drop both of
those independent variables.  -xtreg , re- would allow testing of them.  (-
xtreg , be- would be the same if the dataset is balanced, that is, no missing
data.)

Testing independent variables jointly is easy in Stata.  The command would be -
test x1 x2- after a suitable estimation command.

Take a look at the illustration below.  Gloss over all but the last three
commands; most of the do-file is just to create an illustrative fictional
dataset with i(2000) and t(15) and then to fit a model to the data.  In the
illustration, the two sets of controls are named ind1 and ind2, two independent
variables (covariates) with values 0 (control) and 1 (noncontrol).  After
fitting a suitable statistical model of the data, I use -test- on the
covariates individually, and then on them jointly.  If the dataset is a time
series with 15 relatively distantly spaced intervals, or if the model is
nonnormal, then -xtgee- or some other estimation command of the -xt- series
might be more suitable.

Joseph Coveney

------------------------begin illustration do-file------------------------------

clear
set seed 20030720
set obs 15
set more off
forvalues i = 1/15 {
generate float a`i' = 0.7
quietly replace a`i' = 1 in `i'
}
mkmat a*, matrix(A)
local means "100"
local sd "15"
local dep "dep1"
forvalues i = 2/15 {
local means = "`means'" + ", 100"
local sd = "`sd'" + ", 15"
local dep = "`dep'" + " dep`i'"
}
drawnorm "`dep'", n(2000) means("`means'") /*
*/ sd("`sd'") corr(A) clear
matrix drop A
generate int rid = _n
generate byte ind1 = uniform() > 0.5
generate byte ind2 = uniform() > 0.5
reshape long dep, i(rid) j(tim)
xi: xtreg dep ind1 ind2 i.tim, i(rid) re
*
* Testing each alone
*
test ind1
test ind2
*
* Testing both together
*
test ind1 ind2
exit

--------------------------end illustration do-file------------------------------

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