matlab软件moran值,MATLAB 的moran,LM值

哪位大师告诉我,以下四种模型中的哪个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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值