T = 6; N = 217;
W = normw(w1);
y = data(:,[6]);
x = data(:,[7,8,9,10,11,12,13,14,15]);
[nobs K] = size(x);
for t=1:T
t1=(t-1)*N+1;t2=t*N;
wx(t1:t2,:)=W*x(t1:t2,:);
end
info.lflag = 0;
info.model = 3; %双固定效应
info.fe = 0;
results = sar_panel_FE(y,[x wx],W,T,info);
disp('Spatial Durbin model can be simplified to spatial lag model (LR Test)')
resultssar = sar_panel_FE(y,x,W,T,info);
LR_spatial_lag = -2*(resultssar.lik-results.lik);
prob_spatial_lag = 1-chis_cdf (LR_spatial_lag,K) ;
fprintf('LR test for spatial lag = %.4f\n',LR_spatial_lag)
fprintf('Probability = %.4f\n',prob_spatial_lag)
fprintf('\n')
代码如下,结果显示NaN,怎么解决呀 求助!!


雷达卡



京公网安备 11010802022788号







