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

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   Mon, 21 Jul 2003 14:37:05 +0900

Jayesh Kumar wrote:

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

As I want to test whether the Fixed Effect, is at all needed verses OLS?
I am using firm level data to analyze firm's performance.

My equation is something like:

Y_it= (X1_it + X2_it + X3_it + ...+ X9_it) + (Z1_it + Z2_it + Z3_it +Z4_it) + 
u_it

where X's and Z's both are firm specific variables.

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


Use the same approach as for the ealier illustration: -test- X's Z's together.  
You can also use likelihood-ratio tests, dropping both sets of the predictors 
at once from the model that contains them.  I've illustrated both below by 
slightly modifying the previous illustration do-file to recast the between-
subjects predictors, ind1 and ind2, to within-subjects predictors, x1d through 
x9d and z1d through z4d.

For the illustration, I'm assuming that Jayesh is referring to a panel dataset 
(modeled with two error terms, u_i and e_it) of 2000 companies evaluated at 
each of 15 intervals with two sets (X1 through X9 and Z1 through Z4) of time-
varying covariates.  For brevity here, the initial model isn't the default one 
that is typical for a blind or naive model-building exercise or hypothesis-
testing exercise, that is, fully saturated with two- and three-way interactions 
of covariates and time.

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
reshape long dep, i(rid) j(tim)
forvalues i = 1/9 {
    generate byte x`i'd = uniform() >= 0.5
}
forvalues i = 1/4 {
    generate byte z`i'd = uniform() >= 0.5
}
*
xi: xtreg dep x*d z*d i.tim, i(rid) fe
*
* Testing each alone
*
test x1d x2d x3d x4d x5d x6d x7d x8d x9d
test z1d z2d z3d z4d
*
* Testing both together
*
test x1d x2d x3d x4d x5d x6d x7d x8d x9d, notest
test z1d z2d z3d z4d, accumulate
*
* Likelihood-ratio tests (using -xtreg , mle-)
*
xi: xtreg dep x*d z*d i.tim, i(rid) mle nolog
estimates store A
xi: xtreg dep x*d i.tim, i(rid) mle nolog
estimates store B
xi: xtreg dep z*d i.tim, i(rid) mle nolog
estimates store C
xi: xtreg dep i.tim, i(rid) mle nolog
estimates store D
* Testing Z's
lrtest A B, stats
* Testing X's
lrtest A C, stats
* Testing both
lrtest A D, stats
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/



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