最近空间计量学的太辛苦了,跑demo程序出现了无数bug,解决了一个又来一个了!向大家请教下!
在运行demopanelscompare中,这次出错的试panel_effects_sar,报错如下:
??? Error: File: panel_effects_sar.m Line: 30 Column: 3
Expression or statement is incorrect--possibly unbalanced (, {, or [.
Error in ==> demopanelscompare at 65
panel_effects_sar(results,vnames,W);
检视panel_effects_sar:报错程序为红色字体。
function panel_effects_sar(results,vnames,W)
% PURPOSE: computes and prints direct, indirect and total effects estimates
% for Elhorst SAR spatial panel models using the LeSage and Pace code
%---------------------------------------------------
% USAGE: panel_effects_sar(results,vnames,W)
% Where: results = a structure returned by a spatial panel regression
% vnames = a structure of variable names
% W = spatial weights matrix used to estimate model
ndraw=1000;
uiter=50;
maxorderu=100;
nobs = results.N;
[~, nvar] = size(results.xwith);
rv=randn(nobs,uiter);
tracew=zeros(maxorderu,1);
wjjju=rv;
for jjj=1:maxorderu
wjjju=W*wjjju;
tracew(jjj)=mean(mean(rv.*wjjju));