clear all;
A=wk1read('cigardemo.wk1',1,0);
W1=wk1read('Spat-Sym-US.wk1');
为什么这个wk1read又没有问题?可以读'cigardemo.wk1'
% Dataset downloaded from
www.wiley.co.uk/baltagi/
% Spatial weights matrix constructed by Elhorst
% -------------------------------------------------------------------------
% written by: J.Paul Elhorst 5/2008
% University of Groningen
% Faculty of Economics and Business
% 9700AV Groningen
% the Netherlands
%
j.p.elhorst@rug.nl
%
% REFERENCES:
% Elhorst J.P. (2008) Serial and spatial autocorrelation. Economics Letters
%
http://dx.doi.org/10.1016/j.econlet.2008.03.009
% -------------------------------------------------------------------------
% dimensions of the problem
T=6; % number of time periods
N=46; % number of regions
% row-normalize W
W=normw(W1); % function of LeSage
y=A(:,[3]); % column number in the data matrix that corresponds to the dependent variable
x=A(:,[4,5,6]); % column numbers in the data matrix that correspond to the independent variables
xconstant=ones(N*T,1);
% serial and spatial error correlation, including logpn variable
% one constraint on the paramaters active
vnames=strvcat('logcit','constant','logp','logpn','logy');
serialspatial(y,[xconstant x],W,N,T,vnames);
% serial and spatial error correlation, without logpn variable
% no constraint active, numerical problems with one of the t-values
x=A(:,[4,6]); % column numbers in the data matrix that correspond to the independent variables
vnames=strvcat('logcit','constant','logp','logy');
serialspatial(y,[xconstant x],W,N,T,vnames);
Optimization terminated: Search direction less than 2*options.TolX
and maximum constraint violation is less than options.TolCon.
Active inequalities (to within options.TolCon = 1e-006):
lower upper ineqlin ineqnonlin
3
model with both serial and spatial autocorrelation
Dependent Variable = logcit
R-squared = 0.9921
Rbar-squared = 0.9920
sigma^2 = 0.0021
log-likelihood = -380.51003
***************************************************************
Variable Coefficient Asymptot t-stat z-probability
constant 3.184573 12.127214 0.000000
logp -0.480758 -9.024798 0.000000
logpn 0.226449 3.151678 0.001623
logy 0.368082 6.157506 0.000000
ser.aut 0.963577 116.546888 0.000000
spat.aut. 0.036423 97.200039 0.000000
Optimization terminated: Search direction less than 2*options.TolX
and maximum constraint violation is less than options.TolCon.
Active inequalities (to within options.TolCon = 1e-006):
lower upper ineqlin ineqnonlin
3
model with both serial and spatial autocorrelation
Dependent Variable = logcit
R-squared = 0.9918
Rbar-squared = 0.9917
sigma^2 = 0.0021
log-likelihood = -375.63073
***************************************************************
Variable Coefficient Asymptot t-stat z-probability
constant 3.355565 12.831304 0.000000
logp -0.438336 -8.355384 0.000000
logy 0.322546 5.463177 0.000000
ser.aut 0.963577 110.933671 0.000000
spat.aut. 0.036423 94.006837 0.000000
>>