请问大牛们:在使用Matlab:错误使用 mprint (line 231) Wrong # rnames in mprint,怎么解决?
程序如下:
T=12;
N=10;
W=normw(W1);
y=A(:,[23]);
x=A(:,[17:22]);
for t=1:T
t1=(t-1)*N+1;t2=t*N;
wx(t1:t2,:)=W*x(t1:t2,:);
end
xconstant=ones(N*T,1);
[nobs, K]=size(x);
info.lflag=0;
info.model=1;
info.fe=0;
results=sar_panel_FE(y,x,W,T,info);
vnames=strvcat('logE’,’intercept’,’logshx’,’logPOP’,’logGDP’,’logSGDP','loginvest','logEgdp');
prt_spnew(results,vnames,1)
spat_model=0;
direct_indirect_effects_estimates(results,W,spat_model);
panel_effects_sar(results,vnames,W);
运行结果为:
Wrong # of variable names in prt_reg -- check vnames argument
will use generic variable names
Ordinary Least-squares Estimates
R-squared = 0.9229
Rbar-squared = 0.9188
sigma^2 = 0.0593
Durbin-Watson = 1.7247
Nobs, Nvars = 120, 7
***************************************************************
Variable Coefficient t-statistic t-probability
variable 1 12.955394 29.899434 0.000000
variable 2 0.107677 1.534543 0.127691
variable 3 0.046165 0.482356 0.630486
variable 4 1.296638 8.521197 0.000000
variable 5 -0.946691 -17.107434 0.000000
variable 6 -0.080238 -1.576146 0.117788
variable 7 -0.039277 -0.294729 0.768742
T =
12
LM test no spatial lag, probability = 24.9098, 0.000
robust LM test no spatial lag, probability = 39.4198, 0.000
LM test no spatial error, probability = 0.0070, 0.933
robust LM test no spatial error, probability = 14.5170, 0.000
>> bbw10-sfe
尝试将 SCRIPT bbw10 作为函数执行:
E:\bbw10.m
>> A=xlsread('E:\desktop\\bbw');
W1=xlsread('E:\desktop\\bbww1');
T=12;
N=10;
W=normw(W1);
y=A(:,[23]);
x=A(:,[17:22]);
>> for t=1:T
t1=(t-1)*N+1;t2=t*N;
wx(t1:t2,:)=W*x(t1:t2,:);
end
>> xconstant=ones(N*T,1);
[nobs, K]=size(x);
info.lflag=0;
info.model=1;
info.fe=0;
results=sar_panel_FE(y,x,W,T,info);
>> vnames=strvcat('logE’,’intercept’,’logshx’,’logPOP’,’logGDP’,’logSGDP','loginvest','logEgdp');
prt_spnew(results,vnames,1)
spat_model=0;
direct_indirect_effects_estimates(results,W,spat_model);
panel_effects_sar(results,vnames,W);
Wrong # of variable names in prt_sp -- check vnames argument
will use generic variable names
Pooled model with spatially lagged dependent variable and spatial fixed effects
R-squared = 0.9929
corr-squared = 0.7403
sigma^2 = 0.0056
Nobs,Nvar,#FE = 120, 7, 16
log-likelihood = 144.43011
# of iterations = 1
min and max rho = -1.1258, 1.0000
total time in secs = 1.3630
time for optimiz = 0.1790
time for lndet = 0.0470
time for eigs = 0.5650
time for t-stats = 0.0920
No lndet approximation used
***************************************************************
Variable Coefficient Asymptot t-stat z-probability
variable 1 0.016704 0.529562 0.596416
variable 2 -0.138047 -1.172315 0.241071
variable 3 21.031091 2.190213 0.028509
variable 4 -20.789949 -2.162468 0.030582
variable 5 0.020312 0.708341 0.478733
variable 6 -0.100153 -1.216628 0.223746
W*dep.var. 0.262199 2.579782 0.009886
direct t-stat indirect t-stat total t-stat
ans =
0.0167 0.5085 0.0052 0.4227 0.0220 0.4975
-0.1394 -1.1663 -0.0493 -0.9503 -0.1888 -1.1492
21.4270 2.1695 7.4555 1.4275 28.8825 2.0812
-21.1807 -2.1423 -7.3734 -1.4166 -28.5541 -2.0556
0.0208 0.7214 0.0068 0.5976 0.0277 0.7072
-0.1021 -1.2320 -0.0354 -0.9666 -0.1376 -1.1981
错误使用 mprint (line 231)
Wrong # rnames in mprint
出错 panel_effects_sar (line 188)
mprint(printout,ini);