Pada model Panel data kita ingin mengetahui apakah model tersebut fixed effect atau random effect. Model fixed effect mengasumsikan independen variabel berkorelasi dengan error-nya sedangkan random effect sebaliknya.
Ho : random effect
H1 : Fixed effect.
Contoh Program Hausman test.
--------------------------------------------------------------------------
' hausman test for fixed versus random effects
' revised for version 5.0 (5/25/2004)
'change path to program path
%path = @runpath
cd %path
' load workfile
load grunfeld '(Ctt: ganti dg nama workfile yang sedang dikerjakan)
' set sample
smpl @first 1947 '(Ctt: hilangkan)
' estimate fixed effects and store results
pool1.ls(cx=f) log(inv?) log(val?) log(cap?) '(Ctt: ganti dg varibel dept & indept yg dianalisis)
vector beta = pool1.@coefs
matrix covar = pool1.@cov
' keep only slope coefficients
vector b_fixed = @subextract(beta,1,1,2,1) '(jika 3 var dept ganti dg (beta,1,1,2,1,3,1) dst)
matrix cov_fixed = @subextract(covar,1,1,2,2) '(jika 3 var dept ganti dg (covar,1,1,2,2,3,3) dst)
' estimate random effects and store results
pool1.ls(cx=r) log(inv?) log(val?) log(cap?) '(Ctt: ganti dg varibel dept & indept yg dianalisis)
beta = pool1.@coefs
covar = pool1.@cov
' keep only slope coefficients
vector b_gls = @subextract(beta,2,1,3,1) '(jika 3 var dept ganti dg (beta,2,1,3,1,4,1) dst)
matrix cov_gls = @subextract(covar,2,2,3,3) '(jika 3 var dept ganti dg (covar,2,2,3,3,4,4) dst)
' compute Hausman test stat
matrix b_diff = b_fixed - b_gls
matrix var_diff = cov_fixed - cov_gls
matrix qform = @transpose(b_diff)*@inverse(var_diff)*b_diff
if qform(1,1)>=0 then
' set table to store results
table(4,2) result
setcolwidth(result,1,20)
setcell(result,1,1,"Hausman test for fixed versus random effects")
setline(result,2)
!df = @rows(b_diff)
setcell(result,3,1,"chi-sqr(" + @str(!df) + ") = ")
setcell(result,3,2,qform(1,1))
setcell(result,4,1,"p-value = ")
setcell(result,4,2,1-@cchisq(qform(1,1),!df))
setline(result,5)
show result
else
statusline "Quadratic form is negative"
endif
-------------------------------------------------------------------------------------
Rumit bukan? salah sedikit saja bisa error.
- Run dg Eviews model FE dan copy koefisien-nya (tanpa konstanta) dan paste di excel. dan copy juga matrix covarian-nya dan paste ke excel.
- Run dg Eviews model RE dan copy koefisien-nya (tanpa konstanta) dan paste di excel. dan juga copy juga matrix covarian-nya dan paste ke excel.
- Kurangkan koefisien- koefisien (FE-RE) demikian pula Covariannya (FE-RE).
- Hitung Statistik Uji Hausman (lihar rumus diatas): [transpose koef(FE-RE)] dikali [inverse covarian (FE-RE)] dikali [koef(FE-RE)].
- Bandingkan nilai tersebut dg tabel Chi-kuadrat. Jika nilai hitung > nilai tabel, maka tolak Ho dan terima H1.