楼主: 你好微观
2517 4

[问答] 运行空间面板elhorst代码出现NAN [推广有奖]

  • 0关注
  • 0粉丝

本科生

5%

还不是VIP/贵宾

-

威望
0
论坛币
25 个
通用积分
0.0002
学术水平
0 点
热心指数
0 点
信用等级
0 点
经验
1134 点
帖子
56
精华
0
在线时间
71 小时
注册时间
2014-11-8
最后登录
2021-10-26

+2 论坛币
k人 参与回答

经管之家送您一份

应届毕业生专属福利!

求职就业群
赵安豆老师微信:zhaoandou666

经管之家联合CDA

送您一个全额奖学金名额~ !

感谢您参与论坛问题回答

经管之家送您两个论坛币!

+2 论坛币
运行elhorst代码时出现结果:Pooled model with spatially lagged dependent variable and spatial fixed effects
Dependent Variable =           logcit
R-squared          =    0.8330   
corr-squared       =    0.8588   
sigma^2            =    0.0799
Nobs,Nvar,#FE      =     42,     8,    10  
log-likelihood     =              NaN
# of iterations    =      1   
min and max rho    =   -1.0000,   1.0000
total time in secs =    6.8350
time for optimiz   =    1.1700
time for lndet     =    2.6050
time for t-stats   =    0.1870
No lndet approximation used
***************************************************************
Variable        Coefficient  Asymptot t-stat    z-probability
logm              -1.574680        -4.062095         0.000049
logp              -1.257264        -1.288147         0.197695
logr               2.881825         2.314324         0.020650
logr2              0.030691         0.031202         0.975108
logs              -1.033890        -2.542877         0.010994
logk              -4.320598        -2.633721         0.008445
logw              -0.056595        -0.377752         0.705615
W*dep.var.        -0.236068        -2.872343         0.004074

LR-test joint significance spatial fixed effects, degrees of freedom and probability =       NaN,     3,      NaN
Wrong # of variable names in prt_sp -- check vnames argument
will use generic variable names

Pooled model with spatially lagged dependent variable and spatial random effects
R-squared          =    0.8323   
corr-squared       =    0.8589   
sigma^2            =    0.0802
Nobs,Nvar          =     42,     9
log-likelihood     =              NaN
# of iterations    =      2   
min and max rho    =   -1.0000,   1.0000
total time in secs =    0.5460
time for optimiz   =    0.5150
time for lndet     =    0.0150
No lndet approximation used
***************************************************************
Variable        Coefficient  Asymptot t-stat    z-probability
variable 1        30.836063         1.557228         0.119416
variable 2        -1.561838        -4.028274         0.000056
variable 3        -1.267030        -1.297605         0.194423
variable 4         2.827473         2.294879         0.021740
variable 5         0.072121         0.073514         0.941397
variable 6        -1.022704        -2.531868         0.011346
variable 7        -4.278777        -2.625291         0.008657
variable 8        -0.056930        -0.379387         0.704401
W*dep.var.        -0.236068        -2.897152         0.003766
teta               0.996894         2.356657         0.018440

LR-test significance spatial random effects, degrees of freedom and probability =       NaN,     1,      NaN
Hausman test-statistic, degrees of freedom and probability =    0.2320,     8,   1.0000

Pooled model with spatial error autocorrelation and spatial fixed effects
Dependent Variable =           logcit
R-squared       =    0.7702   
corr-squared    =    0.7745   
sigma^2         =    0.0161   
log-likelihood  =        15.613561  
Nobs,Nvar,#FE   =     42,     7,    10  
# iterations    =     16     
min and max rho =   -0.9900,   0.9900
total time in secs =    0.3590
time for optimiz   =    0.2810
time for t-stats   =    0.0310
No lndet approximation used
***************************************************************
Variable       Coefficient  Asymptot t-stat    z-probability
logm             -0.426951        -1.508374         0.131459
logp             -0.460146        -0.913078         0.361201
logr              0.372846         0.805292         0.420651
logr2             0.635262         1.544534         0.122459
logs             -0.007702        -0.039654         0.968369
logk             -0.451945        -0.482995         0.629099
logw              0.102662         1.500221         0.133557
spat.aut.         0.748983        14.623228         0.000000

LR-test joint significance spatial fixed effects, degrees of freedom and probability =       NaN,     3,      NaN
Wrong # of variable names in prt_sp -- check vnames argument
will use generic variable names

Pooled model with spatial error autocorrelation and spatial random effects
R-squared          =    0.9666   
corr-squared       =    0.7737   
sigma^2            =    0.0160
Nobs,Nvar          =     42,     8
log-likelihood     =        15.383889
# of iterations    =      8   
min and max rho    =   -1.0000,   1.0000
total time in secs =    0.8420
time for optimiz   =    0.7490
time for eigs      =    0.0620
time for t-stats   =    0.0150
***************************************************************
Variable        Coefficient  Asymptot t-stat    z-probability
variable 1        -7.209513        -0.723618         0.469300
variable 2        -0.432158        -1.535145         0.124748
variable 3        -0.455101        -0.906348         0.364751
variable 4         0.378647         0.826546         0.408494
variable 5         0.625425         1.530895         0.125795
variable 6        -0.013158        -0.068090         0.945714
variable 7        -0.411996        -0.441376         0.658941
variable 8         0.105018         1.544999         0.122347
spat.aut.          0.755900        20.374834         0.000000
teta               0.000000         0.000005         0.999996

LR-test significance spatial random effects, degrees of freedom and probability =       NaN,     1,      NaN
Hausman test-statistic, degrees of freedom and probability =    0.0337,     8,   1.0000






代码是:
clear all;
A=xlsread('D:\A.xlsx')
W1=xlsread('D:\W1.xlsx')

% Dataset downloaded from www.wiley.co.uk/baltagi/
% Spatial weights matrix constructed by Elhorst
%
% written by: J.Paul Elhorst summer 2008
% University of Groningen
% Department of Economics
% 9700AV Groningen
% the Netherlands
% j.p.elhorst@rug.nl
%
% REFERENCE:
% Elhorst JP (2009) Spatial Panel Data Models. In Fischer MM, Getis A (Eds.)
% Handbook of Applied Spatial Analysis, Ch. C.2. Springer: Berlin Heidelberg New York.
%
% dimensions of the problem
T=14; % number of time periods
N=3; % 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]); % column numbers in the data matrix that correspond to the independent variables
xconstant=ones(N*T,1);
[nobs K]=size(x);
% ----------------------------------------------------------------------------------------
% spatial fixed effects + spatially lagged dependent variable
info.lflag=0; % required for exact results
info.model=1;
info.fe=0; % no print intercept and spatial fixed effects
results=sar_panel_FE(y,x,W,T,info);
vnames=strvcat('logcit','logm','logp','logr','logr2','logs','logk','logw');
prt(results,vnames,1);
blagfe=[results.beta;results.rho];
covblagfe=results.cov;
% LR-test for joint significance spatial fixed effects
logliklagfe=results.lik;
info.model=0;
results=sar_panel_FE(y,x,W,T,info);
logliklag=results.lik;
LR=-2*(logliklag-logliklagfe);
dof=N;
probability=1-chis_prb(LR,dof);
% Note: probability > 0.05 implies rejection of spatial fixed effects
fprintf(1,'LR-test joint significance spatial fixed effects, degrees of freedom and probability = %9.4f,%6d,%9.4f \n',LR,dof,probability);
% ----------------------------------------------------------------------------------------
% spatial random effects + spatially lagged dependent variable
clear info.model;
info.model=1;
results=sar_panel_RE(y,[xconstant x],W,T,info);
vnames=strvcat('logcit','logm','logp','logr','logr2','logs','logk','logw');
prt(results,vnames,1);
blagre=[results.beta(2:end);results.rho]; % exclude constant
covblagre=results.cov(2:end,2:end); % exclude constant
% LR-test for significance spatial random effects (note logliklag is already available)
logliklagre=results.lik;
LR=-2*(logliklag-logliklagre);
dof=1;
probability=1-chis_prb(LR,dof);
% Note: probability > 0.05 implies rejection of spatial fixed effects
fprintf(1,'LR-test significance spatial random effects, degrees of freedom and probability = %9.4f,%6d,%9.4f \n',LR,dof,probability);
% ----------------------------------------------------------------------------------------
% Hausman test FE versus RE of model + spatially lagged dependent variable
hausman=(blagfe-blagre)'*inv(covblagre-covblagfe)*(blagfe-blagre);
dof=length(blagfe);
probability=1-chis_prb(abs(hausman),dof);
% Note: probability > 0.05 implies rejection of random effects model in favor of fixed effects model
fprintf(1,'Hausman test-statistic, degrees of freedom and probability = %9.4f,%6d,%9.4f \n',hausman,dof,probability);
% ----------------------------------------------------------------------------------------
% spatial fixed effects + spatial autocorrelation
clear info.model;
info.lflag=0; % required for exact results
info.fe=0; % no print intercept and spatial fixed effects
info.model=1;
results=sem_panel_FE(y,x,W,T,info);
vnames=strvcat('logcit','logm','logp','logr','logr2','logs','logk','logw');
prt_spnew(results,vnames,1);
berrorfe=[results.beta;results.rho];
covberrorfe=results.cov;
% LR-test for joint significance spatial fixed effects
loglikerrorfe=results.lik;
info.model=0;
results=sar_panel_FE(y,x,W,T,info);
loglikerror=results.lik;
LR=-2*(loglikerror-loglikerrorfe);
dof=N;
probability=1-chis_prb(LR,dof);
% Note: probability > 0.05 implies rejection of spatial fixed effects
fprintf(1,'LR-test joint significance spatial fixed effects, degrees of freedom and probability = %9.4f,%6d,%9.4f \n',LR,dof,probability);
% ----------------------------------------------------------------------------------------
% spatial random effects + spatial autocorrelation
clear info.model;
results=sem_panel_RE(y,[xconstant x],W,T);
vnames=strvcat('logcit','logm','logp','logr','logr2','logs','logk','logw');
prt_spnew(results,vnames,1);
berrorre=[results.beta(2:end);results.rho]; % exclude constant
covberrorre=results.cov(2:end,2:end); % exclude constant
% LR-test for significance spatial random effects (note loglikerror is already available)
loglikerrorre=results.lik;
LR=-2*(loglikerror-loglikerrorre);
dof=1;
probability=1-chis_prb(LR,dof);
% Note: probability > 0.05 implies rejection of spatial fixed effects
fprintf(1,'LR-test significance spatial random effects, degrees of freedom and probability = %9.4f,%6d,%9.4f \n',LR,dof,probability);
% ----------------------------------------------------------------------------------------
% Hausman test FE versus RE of model + spatial autocorrelation
hausman=(berrorfe-berrorre)'*inv(covberrorre-covberrorfe)*(berrorfe-berrorre);
dof=length(berrorfe);
probability=1-chis_prb(abs(hausman),dof);
% Note: probability > 0.05 implies rejection of random effects model in favor of fixed effects model
fprintf(1,'Hausman test-statistic, degrees of freedom and probability = %9.4f,%6d,%9.4f \n',hausman,dof,probability);




求问大神,为什么LR检验的值都出现NAN?
二维码

扫码加我 拉你入群

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

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

关键词:Elhorst Horst 空间面板 ORS fixed effect 空间

沙发
学术是新手2 发表于 2016-11-18 09:44:31 |只看作者 |坛友微信交流群
请问楼主这个问题怎么解决的呢??

使用道具

藤椅
zhujishi 发表于 2016-12-21 19:42:55 |只看作者 |坛友微信交流群
楼主,最后解决了么?

使用道具

teta               0.996894         2.356657         0.018440
有大神知道这个值的含义吗?

使用道具

报纸
你好微观 发表于 2017-12-13 19:36:04 |只看作者 |坛友微信交流群
我记得最后也没解决,但是论文也通过了还拿了优秀,大家加油

使用道具

您需要登录后才可以回帖 登录 | 我要注册

本版微信群
加好友,备注cda
拉您进交流群

京ICP备16021002-2号 京B2-20170662号 京公网安备 11010802022788号 论坛法律顾问:王进律师 知识产权保护声明   免责及隐私声明

GMT+8, 2024-5-12 09:44