

%This example program estimates a model with a spatially lagged dependent variable 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. 
%This routine fits a model Y=[X intercept]*parameters+alpha*spatially lagged Y+error

%Written by Kelley Pace, 6/23/97



%This example uses Delaunay weights

load xsub;
load y;
load wwsdel;
wws=wwsdel;
load detvalzdel;
detvalz=detvalzdel;


tic;

[alphamax,loglik,emax,bmax,likratios,prhigher]=fpar1(xsub,y,detvalz,wws);

toc;

elapsed_time =

    0.1600


alphamax

alphamax =

    0.5500




[bmax likratios prhigher]

ans =

  1.0e+003 *

   -0.0006    1.0429         0
    0.0002    0.2731         0
    0.0004    0.6540         0
   -0.0000    0.0000    0.0009
    0.0006    0.2422         0


%This plots the profile log-likelihood curves for the overall model and each delete-1 subset
plot(detvalz(:,1),loglik)
title('Profile Likelihoods by Variable (plus unrestricted)');
xlabel('Alpha');
ylabel('Log-Likelihood ');


diary off;
