matlab likelihood,Matlab做空间面板模型log-likelihood为NAN怎么办

初学者,程序完全照抄,求大神纠错

b65cd0ae32469d3a6e91bd76b225f564.gif,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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值