全部版块 我的主页
论坛 数据科学与人工智能 数据分析与数据科学 MATLAB等数学软件专版
7317 13
2014-09-08
初学者,程序完全照抄,求大神纠错,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
二维码

扫码加我 拉你入群

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

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

全部回复
2014-9-10 11:09:01
顶一下,求答案啊。。。。
二维码

扫码加我 拉你入群

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

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

2015-3-9 08:39:43
同问,请问楼主解决问题了么?
二维码

扫码加我 拉你入群

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

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

2015-4-10 09:21:40
同问,有谁解决了吗?
二维码

扫码加我 拉你入群

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

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

2016-5-4 20:49:50
同问,求解决的同学回答一下啊、、、、、
二维码

扫码加我 拉你入群

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

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

2016-7-19 21:01:41
有解决了吗?
二维码

扫码加我 拉你入群

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

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

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

说点什么

分享

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