matlab sac,空间计量模型SAC模型matlab代码,sac_panel_FE

dengjhui 发表于 2019-3-6 13:02 14da60478423929e4d475f99c9d17824.gif

请问知道怎么用吗?就是如何加载自己的数据跟其他模型一样。

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);

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值