悬赏 10 个论坛币 未解决
matlab做LMerr和LMlag检验时,“lmlag_panel"函数不识别,在”jpl7 “文件夹中也未见次函数定义,求大神指教!!
代码如下:
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,meanty,meantx]=demean(y,x,N,T,model);
results=ols(ywith,xwith);
vnames=strvcat('lny','lnAGr','lnPni','Pcl','lnEha','lnDlc'); % should be changed if x is changed
prt_reg(results,vnames);
sfe=meanny-meannx*results.beta; % including the constant term
yme = y - mean(y);
et=ones(T,1);
error=y-kron(et,sfe)-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);
logliksfe=-nobs/2*log(2*pi*sige)-1/(2*sige)*results.resid'*results.resid
LMsarsem_panel(results,W,ywith,xwith); % (Robust) LM tests
lm1=lmlag_panel(ywith,xwith,W);
prt_tests(lm1);
lm2=lmerror_panel(ywith,xwith,W);
prt_tests(lm2);
lm3=lmlag_robust_panel(ywith,xwith,W);
prt_tests(lm3);
lm4=lmerror_robust_panel(ywith,xwith,W);
prt_tests(lm4);