panel1.ls(f) gdp?  old? 
matrix b_fixed=panel1.@coefs
matrix cov_fixed=panel1.@cov

panel1.ls(r) gdp?  old? 

vector beta=panel1.@coefs
matrix covar=panel1.@cov

vector b_gls=@subextract(beta,2,1)
matrix cov_gls=@subextract(covar,2,2)

vector b_diff=b_fixed-b_gls
vector var_diff=cov_fixed-cov_gls
matrix qform=@transpose(b_diff)*@inverse(var_diff)*b_diff

if qform(1,1)>=0 then
 table(4,2) result
setcolwidth(result,1,15)
setcell(result,1,1,"Houseman test")
setcell(result,2,1,"(fixed versus random effects)")
setline(result,3)
!df=@rows(b_diff)
setcell(result,4,1,"Chi-square("+@str(!df)+"d.f.)","r")
setcell(result,4,2,qform(1,1))
setcell(result,5,1,"p-value","r")
setcell(result,5,2,1-@cchisq(qform(1,1),!df))
show result
else
 statusline "Quadratic form is negative "

endif