楼主: 神の左手
7372 13

[问答] Matlab做空间面板模型log-likelihood为NAN怎么办 [推广有奖]

  • 0关注
  • 0粉丝

小学生

85%

还不是VIP/贵宾

-

威望
0
论坛币
3 个
通用积分
0
学术水平
0 点
热心指数
0 点
信用等级
0 点
经验
42 点
帖子
5
精华
0
在线时间
14 小时
注册时间
2013-2-24
最后登录
2017-2-27

楼主
神の左手 发表于 2014-9-8 18:15:13 |AI写论文

+2 论坛币
k人 参与回答

经管之家送您一份

应届毕业生专属福利!

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

经管之家联合CDA

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

感谢您参与论坛问题回答

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

+2 论坛币
初学者,程序完全照抄,求大神纠错,SAR固定效应是程序包弄的不知道哪里出了问题。。。
load 'pc.mat' pc;
load 'wl.mat' wl;
load 'pc1.mat' pc1;
T=6;
N=30;
W=normw(wl);
y=pc1(:,[1]);
x=pc(:,[1:7]);
xconstant=ones(N*T,1);
[nobs K]=size(x);
% ols estimation
results=ols(y,[xconstant,x]);
vnames=strvcat('gy','intercept','y0','pc','gpc','emp','edu','inv','fir');
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]);%LM tests
%双向固定效应模型
info.lflag=0;
info.model=3;
results=sar_panel_FE(y,x,W,T,info);
vnames=strvcat('gy','y0','pc','gpc','emp','edu','inv','fir');
prt_spnew(results,vnames,1);
%地区固定效应
info.lflag=0;
info.model=0;
results=sar_panel_FE(y,x,W,T,info);
vnames=strvcat('gy','y0','pc','gpc','emp','edu','inv','fir');
prt_spnew(results,vnames,1);


运行结果如下:
Ordinary Least-squares Estimates
Dependent Variable =        gy        
R-squared      =    0.7978
Rbar-squared   =    0.7896
sigma^2        =  388.7788
Durbin-Watson  =    1.3944
Nobs, Nvars    =    180,     8
***************************************************************
Variable       Coefficient      t-statistic    t-probability
intercept       246.416677        14.575915         0.000000
y0               20.637595         3.966290         0.000107
pc               22.662274         2.327235         0.021118
gpc             -11.417734        -1.514625         0.131703
emp             -11.945173        -1.633294         0.104236
edu              15.424211         2.189925         0.029876
inv             -21.340470        -2.401367         0.017400
fir              63.665202         7.820010         0.000000
Warning: Matrix is close to singular or badly scaled.
         Results may be inaccurate. RCOND = 3.177681e-017.
> In LMsarsem_panel at 38
  In space at 21
Warning: Matrix is close to singular or badly scaled.
         Results may be inaccurate. RCOND = 2.098193e-017.
> In LMsarsem_panel at 38
  In space at 21
Warning: Matrix is close to singular or badly scaled.
         Results may be inaccurate. RCOND = 7.983944e-019.
> In LMsarsem_panel at 38
  In space at 21
Warning: Matrix is close to singular or badly scaled.
         Results may be inaccurate. RCOND = 2.105254e-017.
> In LMsarsem_panel at 38
  In space at 21
Warning: Matrix is close to singular or badly scaled.
         Results may be inaccurate. RCOND = 4.869742e-017.
> In LMsarsem_panel at 38
  In space at 21
Warning: Matrix is close to singular or badly scaled.
         Results may be inaccurate. RCOND = 2.324269e-017.
> In LMsarsem_panel at 38
  In space at 21
LM test no spatial lag, probability          =   20.1094,   0.0000
robust LM test no spatial lag, probability   =   31.2385,   0.0000
LM test no spatial error, probability        =   70.2445,   0.0000
robust LM test no spatial error, probability =   81.3736,   0.0000
Warning: Matrix is close to singular or badly scaled.
         Results may be inaccurate. RCOND = 2.048182e-016.
> In sar_panel_FE at 352
  In space at 25
Pooled model with spatially lagged dependent variable, spatial and time period fixed effects
Dependent Variable =              gy  
R-squared          =    0.9731   
corr-squared       =    0.2338   
sigma^2            =   49.5059
Nobs,Nvar,#FE      =    180,     8,    13  
log-likelihood     =              NaN
# of iterations    =      1   
min and max rho    =   -1.0000,   1.0000
total time in secs =    0.2970
time for optimiz   =    0.0940
time for lndet     =    0.0310
No lndet approximation used
***************************************************************
Variable        Coefficient  Asymptot t-stat    z-probability
y0               -17.027376        -1.806973         0.070766
pc               -20.741611        -2.397489         0.016508
gpc              -20.375769        -3.560497         0.000370
emp               10.192561         1.056646         0.290673
edu               21.639652         2.493960         0.012633
inv         -5566589.110156        -1.016164         0.309551
fir          5566550.776313         1.016157         0.309555
W*dep.var.        -0.236068        -1.722842         0.084917

Pooled model with spatially lagged dependent variable, no fixed effects
Dependent Variable =              gy  
R-squared          =    0.4770   
corr-squared       =    0.5369   
sigma^2            =  961.1517
Nobs,Nvar,#FE      =    180,     8,     7  
log-likelihood     =              NaN
# of iterations    =      1   
min and max rho    =   -1.0000,   1.0000
total time in secs =    0.0630
time for optimiz   =    0.0160
time for lndet     =    0.0160
No lndet approximation used
***************************************************************
Variable        Coefficient  Asymptot t-stat    z-probability
y0                22.494983         2.719872         0.006531
pc                81.851928         5.572041         0.000000
gpc               26.294205         2.212825         0.026910
emp              -43.051587        -3.745458         0.000180
edu              -62.503393        -6.772293         0.000000
inv                8.056630         0.589667         0.555414
fir               32.305173         2.503307         0.012304
W*dep.var.        -0.236068        -1.893304         0.058318
二维码

扫码加我 拉你入群

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

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

关键词:Likelihood MATLAB 空间面板模型 atlab matla 空间 模型

沙发
神の左手 发表于 2014-9-10 11:09:01
顶一下,求答案啊。。。。

藤椅
◇水藍ē蕨ˇ 学生认证  发表于 2015-3-9 08:39:43
同问,请问楼主解决问题了么?

板凳
lifengprc 发表于 2015-4-10 09:21:40
同问,有谁解决了吗?

报纸
zchan1213 学生认证  发表于 2016-5-4 20:49:50
同问,求解决的同学回答一下啊、、、、、

地板
方嘉宇 发表于 2016-7-19 21:01:41
有解决了吗?

7
澜之 发表于 2016-9-1 15:54:34
我也遇到了同种情况。。。求问怎么解决呀

8
你好微观 发表于 2016-9-29 10:17:42
把权重矩阵改成N*N的,不要用NT*NT的

9
xiaowang200903 发表于 2016-12-28 16:00:54
权重矩阵改成N*N也是一样会出现log-likelihood=NAN,这个是数据问题吗?

10
angel_911218 发表于 2017-7-13 21:35:23
我也出现了这样的问题,楼主问题解决了吗

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

本版微信群
加好友,备注cda
拉您进交流群
GMT+8, 2025-12-23 07:36