本文主要是介绍matlab sac,空间计量模型SAC模型matlab代码,sac_panel_FE,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
dengjhui 发表于 2019-3-6 13:02
请问知道怎么用吗?就是如何加载自己的数据跟其他模型一样。
A=xlsread('D:\matlab\toolbox\SpatEcon_ren\Files_SLX_paper\cigarette.xls');
W1=xlsread('D:\matlab\toolbox\SpatEcon_ren\Files_SLX_paper\Spat-Sym-US.xls');
%
T=9; % number of time periods
N=31; % number of regions
% row-normalize W
W=normw(W1); % function of LeSage
y=A(:,1); % column number in the data matrix that corresponds to the dependent variable
x=A(:,[2,3,4,5,6,7,8,9]); % 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); %size返回的是行和列
et=ones(T,1);
en=ones(N,1);
% All models include spatial and time period fixed effects
% SAC / SARAR / Clifford-Ord/ Kelejian-Prucha model
info.lflag=0; % required for exact results
info.model=3;
info.fe=0; % Do not print intercept and fixed effects; use info.fe=1 to turn on
info.bc=1;
results=sac_panel_FE(y,x,W,T,info);
vnames=strvcat('logcit','logp','logy');
prt_spnew(results,vnames,1);
% Print out effects estimates
spat_model=0;
direct_indirect_effects_estimates(results,W,spat_model);
这篇关于matlab sac,空间计量模型SAC模型matlab代码,sac_panel_FE的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!