T=30; % number of time periods
N=46; % number of regions
% row-normalize W
W=normw(W1); % function of LeSage
y=A(:,[3]); % column number in the data matrix that corresponds to the dependent variable
x=A(:,[4,6]); % column numbers in the data matrix that correspond to the independent variables
for t=1:T
t1=(t-1)*N+1;t2=t*N;
wx(t1:t2,:)=W*x(t1:t2,:);
end
xconstant=ones(N*T,1);
[nobs K]=size(x);
第53~65行的代码;是定义了一个具体的空间面板模型,并通过小效应数估计出(直接效应与间接效应),我这里所说的效应也许翻译得不对,记得一些论文上说的是“空间溢出效应”。具体看相关论文与手册。
---------------------
% No fixed effects + spatially lagged dependent variable
info.lflag=0; % required for exact results
info.model=0;
info.fe=0; % Do not print intercept and fixed effects; use info.fe=1 to turn on
% New routines to calculate effects estimates
results=sar_panel_FE(y,[xconstant x],W,T,info);
vnames=char('logcit','intercept','logp','logy');
% Print out coefficient estimates
prt_sp(results,vnames,1);
% Print out effects estimates
spat_model=0;
direct_indirect_effects_estimates(results,W,spat_model);
panel_effects_sar(results,vnames,W);
楼主,如果有时间望你不吝赐教。我在运行demopanelscompare时候,为什么matlab会出现Undefined function or method 'mtimes' for input arguments of type 'struct'呢?
此外,当我在运行sar程序是,会出现这个错误,但是在运行sem命令时,就不会有这个问题?这是为什么呢?
在写论文出现这个问题,求教楼主解释一下吧?