|
出现同样的问题,解释变量选择两个的话就没有问题,多加一个解释变量就出现了问题,例如我的三个解释变量会出现:
代码:T=10;
N=16;
W=normw(W1);
y=A(:,3);
x=A(:,[4,6]);
xconstant=ones(N*T,1);
[nobs K]=size(x);
results=ols(y,[xconstant x]);
vnames=strvcat('y','intercept','x1','x2','x3');
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
% The (robust)LM tests developed by Elhorst
LMsarsem_panel(results,W,y,[xconstant x]); % (Robust) LM tests
结果出现了:
Wrong # of variable names in prt_reg -- check vnames argument
will use generic variable names
Ordinary Least-squares Estimates
R-squared = 0.2004
Rbar-squared = 0.1902
sigma^2 = 0.0017
Durbin-Watson = 0.4011
Nobs, Nvars = 160, 3
***************************************************************
Variable Coefficient t-statistic t-probability
variable 1 0.078386 16.458904 0.000000
variable 2 0.000038 4.919880 0.000002
variable 3 -0.000347 -4.332922 0.000026
loglikols =
286.1946
LM test no spatial lag, probability = 247.2800, 0.000
robust LM test no spatial lag, probability = 181.9879, 0.000
LM test no spatial error, probability = 169.5590, 0.000
robust LM test no spatial error, probability = 104.2669, 0.000
本文来自: 人大经济论坛 MATLAB等数学软件专版 版,详细出处参考: https://bbs.pinggu.org/forum.php?mod=viewthread&tid=1345696&page=2&from^^uid=8219544
|