全部版块 我的主页
论坛 数据科学与人工智能 数据分析与数据科学 MATLAB等数学软件专版
5594 13
2016-01-15
悬赏 20 个论坛币 已解决
哪位大师告诉我,以下四种模型中的哪个moran I 和 LM 值来判断是否存在空间相关性,和选择SAR ,SEM 模型?每个模型结果后面的这些是什么意思?谢谢
LM test no spatial lag, probability          =   88.9056,   0.0000
robust LM test no spatial lag, probability   =    6.1404,   0.0132
LM test no spatial error, probability        =   89.2450,   0.0000
robust LM test no spatial error, probability =    6.4799,   0.0109
Moran I-test for spatial correlation in residuals


使用Moran'I 和LM进行空间自相关检验,程序如下:
clear all;
%sp.mat 中数据已取对数
format long
format compact
load sp.mat;

% dimensions of the problem
T=13; % number of time periods
N=29; % number of regions
% row-normalize W
W=normw(w1); % function of LeSage
y=sp(:,[1]); % column number in the data matrix that corresponds to the dependent variable
x=sp(:,[2:8]); % column numbers in the data matrix that correspond to the independent variables
xconstant=ones(N*T,1);
[nobs K]=size(x);
% ----------------------------------------------------------------------------------------
% ols estimation (一般面板模型)
results=ols(y,[xconstant x]);
vnames=char('EF','C','UR','TR','DA','PCG','RD','OD','GOV');
prt_reg(results,vnames,1);
sige=results.sige*((nobs-K)/nobs);
loglikols=-nobs/2*log(2*pi*sige)-1/(2*sige)*results.resid'*results.resid
LMsarsem_panel(results,W,y,[xconstant x]); % (Robust) LM tests
%moran 检验
I=eye(T);W1=kron(I,W);
res=moran(y,[xconstant x],W1);
prt(res);


% ----------------------------------------------------------------------------------------
% spatial fixed effects + (robust) LM tests for spatial lag and spatial error model(空间固定效应模型)
% fixed effects, within estimator
% demeaning of the y and x variables
model=1;
[ywith,xwith,meanny,meannx,~,meantx]=demean(y,x,N,T,model);
results=ols(ywith,xwith);
vnames=char('EF','UR','TR','DA','PCG','RD','OD','GOV'); % should be changed if x is changed
prt_reg(results,vnames);
FE=meanny-meannx*results.beta; % including the constant term
yme = y - mean(y);
ee=ones(T,1);
error=y-kron(ee,FE)-x*results.beta;
rsqr1 = error'*error;
rsqr2 = yme'*yme;
FE_rsqr2 = 1.0 - rsqr1/rsqr2 % r-squared including fixed effects
sige=results.sige*((nobs-K)/nobs);
loglikfe=-nobs/2*log(2*pi*sige)-1/(2*sige)*results.resid'*results.resid
LMsarsem_panel(results,W,ywith,xwith); % (Robust) LM tests

%moran检验

res=moran(ywith,xwith,W1);
prt(res);
% ----------------------------------------------------------------------------------------
% time period fixed effects + (robust) LM tests for spatial lag and spatial error model(时间固定效应模型)
% fixed effects, within estimator
% demeaning of the y and x variables
model=2;
[ywith,xwith,meanny,meannx,meanty,meantx]=demean(y,x,N,T,model);
results=ols(ywith,xwith);
vnames=char('EF','UR','TR','DA','PCG','RD','OD','GOV'); % should be changed if x is changed
prt_reg(results,vnames);
sige=results.sige*((nobs-K)/nobs);
loglikfe=-nobs/2*log(2*pi*sige)-1/(2*sige)*results.resid'*results.resid
LMsarsem_panel(results,W,ywith,xwith); % (Robust) LM tests

%moran检验
res=moran(ywith,xwith,W1);
prt(res);

% ----------------------------------------------------------------------------------------
% spatial and time period fixed effects + (robust) LM tests for spatial lag and spatial error model(时空固定效应模型)
% fixed effects, within estimator
% demeaning of the y and x variables
model=3;
[ywith,xwith,meanny,meannx,meanty,meantx]=demean(y,x,N,T,model);
results=ols(ywith,xwith);
vnames=char('EF','UR','TR','DA','PCG','RD','OD','GOV'); % should be changed if x is changed
prt_reg(results,vnames);
sige=results.sige*((nobs-K)/nobs);
loglikfe=-nobs/2*log(2*pi*sige)-1/(2*sige)*results.resid'*results.resid
LMsarsem_panel(results,W,ywith,xwith); % (Robust) LM tests

%moran检验
res=moran(ywith,xwith,W1);
prt(res);
运行结果如下:
一般面板模型
Ordinary Least-squares Estimates
Dependent Variable =              EF  
R-squared      =    0.4144
Rbar-squared   =    0.4033
sigma^2        =    0.2539
Durbin-Watson  =    1.3333
Nobs, Nvars    =    377,     8
***************************************************************
Variable      Coefficient      t-statistic    t-probability
C               -7.222133        -6.480526         0.000000
UR               0.457273         2.138987         0.033093
TR              -1.120515        -4.889903         0.000002
DA               0.074376         1.416657         0.157427
PCG              0.181680         1.788213         0.074562
RD              -0.210588        -3.486601         0.000548
OD              -0.168533        -3.904503         0.000112
GOV              2.375192         7.312403         0.000000
loglikols =
    -2.725336719885613e+02
LM test no spatial lag, probability          =  284.6915,   0.0000
robust LM test no spatial lag, probability   =   64.1514,   0.0000
LM test no spatial error, probability        =  221.0690,   0.0000
robust LM test no spatial error, probability =    0.5289,   0.4671
Moran I-test for spatial correlation in residuals
Moran I                    0.53544331
Moran I-statistic         15.22260869
Marginal Probability       0.00000000
mean                      -0.00748302
standard deviation         0.03566579
空间固定效应模型
Ordinary Least-squares Estimates
Dependent Variable =              EF  
R-squared      =    0.8557
Rbar-squared   =    0.8534
sigma^2        =    0.0097
Durbin-Watson  =    1.2812
Nobs, Nvars    =    377,     7
***************************************************************
Variable      Coefficient      t-statistic    t-probability
UR               0.391384         4.639076         0.000005
TR              -0.151636        -1.910552         0.056835
DA              -0.143382        -4.447815         0.000011
PCG              0.489207        13.864206         0.000000
RD               0.036898         1.089596         0.276600
OD              -0.028787        -1.305522         0.192527
GOV              0.000780         0.006636         0.994709
FE_rsqr2 =
   0.977679091049534
loglikfe =
     3.433207036098033e+02
LM test no spatial lag, probability          =   88.9056,   0.0000
robust LM test no spatial lag, probability   =    6.1404,   0.0132
LM test no spatial error, probability        =   89.2450,   0.0000
robust LM test no spatial error, probability =    6.4799,   0.0109
Moran I-test for spatial correlation in residuals
Moran I                    0.34020575
Moran I-statistic          9.68198649
Marginal Probability       0.00000000
mean                      -0.00476057
standard deviation         0.03562971
时间固定效应模型
Ordinary Least-squares Estimates
Dependent Variable =              EF  
R-squared      =    0.3790
Rbar-squared   =    0.3690
sigma^2        =    0.2334
Durbin-Watson  =    1.6949
Nobs, Nvars    =    377,     7
***************************************************************
Variable      Coefficient      t-statistic    t-probability
UR              -0.098575        -0.421150         0.673890
TR              -1.265596        -5.621611         0.000000
DA               0.068341         1.351996         0.177202
PCG              0.681905         4.886032         0.000002
RD              -0.158074        -2.675861         0.007785
OD              -0.313482        -6.258943         0.000000
GOV              3.080287         8.901788         0.000000
loglikfe =
    -2.571671427739816e+02
LM test no spatial lag, probability          =  239.1127,   0.0000
robust LM test no spatial lag, probability   =  160.5577,   0.0000
LM test no spatial error, probability        =  104.4534,   0.0000
robust LM test no spatial error, probability =   25.8984,   0.0000
Moran I-test for spatial correlation in residuals
Moran I                    0.36805337
Moran I-statistic         10.32135589
Marginal Probability       0.00000000
mean                      -0.00271308
standard deviation         0.03592226
时空固定效应模型
Ordinary Least-squares Estimates
Dependent Variable =              EF  
R-squared      =    0.3354
Rbar-squared   =    0.3246
sigma^2        =    0.0069
Durbin-Watson  =    1.7296
Nobs, Nvars    =    377,     7
***************************************************************
Variable      Coefficient      t-statistic    t-probability
UR               0.274998         3.725420         0.000225
TR              -0.246133        -3.290118         0.001098
DA              -0.143872        -5.193851         0.000000
PCG              0.429168         5.984491         0.000000
RD               0.091584         3.010201         0.002790
OD              -0.170716        -7.142274         0.000000
GOV              0.178417         1.681508         0.093508
loglikfe =
     4.068840511380279e+02
LM test no spatial lag, probability          =   28.4240,   0.0000
robust LM test no spatial lag, probability   =   31.6752,   0.0000
LM test no spatial error, probability        =    9.7720,   0.0018
robust LM test no spatial error, probability =   13.0233,   0.0003
Moran I-test for spatial correlation in residuals
Moran I                    0.11257500
Moran I-statistic          3.12990565
Marginal Probability       0.00174862
mean                      -0.00004290
standard deviation         0.03598125

最佳答案

wangbbs 查看完整内容

给你推荐一本书,大牛Elhorst写的《Matlab Software for Spatial Panels》,看你运行的程序就是他写的,这相当于程序的说明书。仔细看看你就明白了。我的帖子里有这本书的电子版。 局部Moran I值表达的是否存在空间聚集或空间扩散,要看其所处的象限 LM和robust LM是用来判断空间面板模型是否比普通面板模型更好的解释变量 至于选择SAR,SEM,SDM要通过LR检验来判断
二维码

扫码加我 拉你入群

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

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

全部回复
2016-1-15 17:04:23
给你推荐一本书,大牛Elhorst写的《Matlab Software for Spatial Panels》,看你运行的程序就是他写的,这相当于程序的说明书。仔细看看你就明白了。我的帖子里有这本书的电子版。

局部Moran I值表达的是否存在空间聚集或空间扩散,要看其所处的象限
LM和robust LM是用来判断空间面板模型是否比普通面板模型更好的解释变量
至于选择SAR,SEM,SDM要通过LR检验来判断
二维码

扫码加我 拉你入群

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

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

2016-1-15 17:15:27
请高手帮个忙,在线等待ing 谢谢
二维码

扫码加我 拉你入群

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

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

2016-1-16 23:28:53
wangbbs 发表于 2016-1-15 17:04
给你推荐一本书,大牛Elhorst写的《Matlab Software for Spatial Panels》,看你运行的程序就是他写的,这相 ...
谢谢,那以上模型中的MORAN I 表示什么?
二维码

扫码加我 拉你入群

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

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

2016-1-17 00:27:22
MORAN I 是一个指数,表示空间关系的强弱,通常分成全局moran 和 局部moran,要使用这个指数还需要配合Z指数。你最好百度下相关的文章。论坛里也有文章介绍。
二维码

扫码加我 拉你入群

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

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

2016-1-17 13:07:57
wangbbs 发表于 2016-1-17 00:27
MORAN I 是一个指数,表示空间关系的强弱,通常分成全局moran 和 局部moran,要使用这个指数还需要配合Z指数 ...
嗯,谢谢你
二维码

扫码加我 拉你入群

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

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

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

说点什么

分享

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