I am using Eviews 8. I am using pool object and unbalanced panel data w 19,240 firms over the sample period for 2000 ~2011, a total 46,658 obs. The pool object I idenify is YEAR. And I try to use Hausman test to see whether the fixed effect or random effect is appropriate or not. So, I set two eqs as following.
eq1: show p_1.ls(cx=f,p) Tobin? c {%fz} {%cz} {%zz} {%z1a}?
eq2: show p_2.ls(cx=r,p) Tobin? c {%fz} {%cz} {%zz} {%z1a}?
Eviews shows the error message to me said that "Random effects estimation requires number of cross sections>number of coefs for between estimator for estimate of RE innovation variance." while I run the eq2.
However, the equation is efficient if I revise the equation option to eq3.
eq3: show p_2.ls(cx=r,rancalc=wh,p) Tobin? c {%fz} {%cz} {%zz} {%z1a}?
The difference btw eq2 & eq3 is rancalc=wh!!!! I cann't understand why :(
Code: Select all
for !eqno=1 to {%model}
pool p_{!eqno}
for !YEAR=1 to {%p3}-1
p_{!eqno}.add {!YEAR}
next
p_{!eqno}.describe(m,c,i,p) Tobin?
next
%cz="MV? LevF? "
%fz="gdpg? DIS? "
%zz="Ind1b? Ind2b? Ind3b? Ind4b? Ind5b? Ind6b? Ind7b? Ind8b? Ind9b? Ind10b?"
show p_1.ls(cx=f,p) Tobin? c {%fz} {%cz} {%zz} {%z1a}?
show p_2.ls(cx=r,p) Tobin? c {%fz} {%cz} {%zz} {%z1a}?
table result
setcolwidth(result,1,20)
setcell(result,1,1,"Hausman test for fixed versus random effects")
setline(result,2)
!a=3
for !eqno=1 to 1
setcell(result,!a,1,"{!eqno}")
vector beta_f = p_{!eqno}.@coefs
matrix covar_f = p_{!eqno}.@cov
scalar nbeta_f = @obs(beta_f) - {%p5}
vector b_fixed = @subextract(beta_f,2,1,nbeta_f,1)
matrix cov_fixed = @subextract(covar_f,2,2,nbeta_f,nbeta_f)
!w=2
vector beta_r = p_!w.@coefs
matrix covar_r = p_!w.@cov
scalar nbeta_r = @obs(beta_r) - {%p5}
vector b_random = @subextract(beta_r,2,1,nbeta_r,1)
matrix cov_random = @subextract(covar_r,2,2,nbeta_r,nbeta_r)
matrix b_diff = b_fixed - b_random
matrix var_diff = cov_fixed - cov_random
matrix qform = @transpose(b_diff)*@inverse(var_diff)*b_diff
if qform(1,1)>=0 then
!df = @rows(b_diff)
setcell(result,!a+1,1,"chi-sqr(" + @str(!df) + ") = ")
setcell(result,!a+1,2,qform(1,1))
setcell(result,!a+2,1,"p-value = ")
setcell(result,!a+2,2,1-@cchisq(qform(1,1),!df))
else
setcell(result,!a+1,1," Test undefined: Quadratic form is negative" )
endif
!a=3+!a
next
SC
