
%This example program estimates a model with lagged independent variables with Delaunay weights using the data from:
%Pace, R. Kelley, and Ronald Barry, Quick Computation of Regressions with a Spatially Autoregressive Dependent Variable,
%Geographical Analysis, Volume 29, Number 3, July 1997, p. 232-247. 
%Specifically, this routine fits a model Y=[X (spatially lagged X=DX) ]*parameters+intercept+error

%Written by Kelley Pace, 6/23/97


%The likelihood ratio tests for this routine are for the twice the change in the log-likelihood for deleting a variable
%and its associated spatial lag (except for the intercept variable)
%Since no lagged dependent variable is involved, alpha=0

load xsub;
load y;
load wwsdel;
wws=wwsdel;

tic;
[alphamax,loglik,emax,bmax,likratios,prhigher]=flagx1(xsub,y,wws);
toc

elapsed_time =

    0.1700


alphamax

alphamax =

     0


bmax

bmax =

   -0.7320
    0.2041
    0.4570
    0.0249
   -0.0571
    0.4356
   -0.0766
   -0.2919
    1.2006


%First loglik is for unrestricted, then the next 4 are for deleting an independent variable and its spatial lag, then the intercept.
loglik

loglik =

  1.0e+003 *

   -6.2240   -6.6712   -6.7528   -6.5069   -6.2750   -6.4204


[ likratios prhigher]

ans =

  1.0e+003 *

    0.8944         0
    1.0575         0
    0.5657         0
    0.1019         0
    0.3928         0




diary off;
