再者由lesage编的matlab代码如下:
% Hausman test FE versus RE of model + spatial autocorrelation
hausman=(berrorfe-berrorre)'*inv(covberrorre-covberrorfe)*(berrorfe-berrorre);
dof=length(berrorfe);
probability=1-chis_prb(abs(hausman),dof);
% Note: probability > 0.05 implies rejection of random effects model in favor of fixed effects model
fprintf(1,'Hausman test-statistic, degrees of freedom and probability = %9.4f,%6d,%9.4f \n',hausman,dof,probability); 如果实证结果如下,那该选择随机还是固定。
Hausman test-statistic, degrees of freedom and probability = -36.0075, 11, 0.0002