全部版块 我的主页
论坛 数据科学与人工智能 数据分析与数据科学 MATLAB等数学软件专版
5204 8
2018-08-24
杜宾模型效应分解代码如下,
clear;
[A,name]=xlsread('alldata.xlsx');
W1=xlsread('weight.xlsx');
T=10; % number of time periods
N=31; % number of regions
% row-normalize W
w=normw(W1); % function of LeSage
y=A(:,[2]); % column number in the data matrix that corresponds to the dependent variable
x=A(:,[3,6,7,8]); % 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);
% ---------------------------------------------------------------------------------------

info.lflag=0; % required for exact results
info.model=1;
info.fe=0; % Do not print intercept and fixed effects; use info.fe=1 to turn on
results=sar_panel_FE(y,[x wx],w,T,info);
vnames=strvcat('y','csm','inc','price','urban','w*csm','w*inc','w*price','w*urban' );
prt_spnew(results,vnames,1)
% Print out effects estimates
spat_model=1;
direct_indirect_effects_estimates(results,w,spat_model);
panel_effects_sdm(results,vnames,w);
运行结果如下:
effect_separate_sdm

Pooled model with spatially lagged dependent variable and spatial fixed effects
Dependent Variable =          y      
R-squared          =    0.9408   
corr-squared       =    0.9238   
sigma^2            =    0.0300
Nobs,Nvar,#FE      =    310,     9,    39  
log-likelihood     =        75.723476
# of iterations    =      1   
min and max rho    =   -1.0000,   1.0000
total time in secs =    0.1730
time for optimiz   =    0.0060
time for lndet     =    0.0130
time for t-stats   =    0.0120
No lndet approximation used
***************************************************************
Variable        Coefficient  Asymptot t-stat    z-probability
csm               -0.132640        -4.087724         0.000044
inc                0.866986        13.211625         0.000000
price              2.067863         2.425411         0.015291
urban              1.479963        15.734717         0.000000
w*csm              0.121174         2.966329         0.003014
w*inc             -0.311179        -2.487223         0.012874
w*price           -0.965193        -0.468055         0.639745
w*urban           -0.950597        -5.605412         0.000000
W*dep.var.         0.398999         4.711590         0.000002

Undefined function 'direct_indirect_effects_estimates' for input arguments of type 'struct'.


Error in effect_separate_sdm (line 26)
direct_indirect_effects_estimates(results,w,spat_model);


请问有人可以帮忙解决吗?

二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

全部回复
2018-8-24 17:57:46
已解决。少两个包。一个是旧版的sar_panel_FE
一个是elhost model文件
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

2018-8-27 19:01:50
你好,我想问下运行sar-panel-fe这个m文件的时候,fieldnames那里可以运行得出来吗
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

2018-9-27 23:19:58
黄騰騰 发表于 2018-8-27 19:01
你好,我想问下运行sar-panel-fe这个m文件的时候,fieldnames那里可以运行得出来吗
这个我还不是很精  我空间计量就学了几天 可能你要问一下大佬了
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

2018-11-14 10:11:52
您好  ,可以说一下您那两个包在哪里下载的吗   万分感激
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

2018-11-19 18:52:38
因为有其他人已经传过,我的传不了,你找一下
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

点击查看更多内容…
栏目导航
热门文章
推荐文章

说点什么

分享

扫码加好友,拉您进群
各岗位、行业、专业交流群