

%This example program uses the Delaunay triangularization routine in Matlab to arrive at a spatial weight matrix
%Written by Kelley Pace, 6/23/97

%This example program uses 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. 




load latlon;
xcoord=latlon(:,2);
ycoord=latlon(:,1);
%locations on the plane

%This plots the voronoi polygons - which are made effectively from Delaunay triangles 
%This step - can be eliminated. However, it provides a useful check on the x,y coordinates
voronoi(xcoord,ycoord);


%wswdel is a symmetric weight matrix
%wwsdel is a row-stochastic assymetric weight matrix formed from a symmetric adjacency matrix
%wmatdel is the diagonal weighting matrix used in making the above
tic;
[wswdel,wwsdel,wmatdel]=fdelw1(xcoord,ycoord);
toc;

elapsed_time =

    0.6510



%computes log-determinants over a grid of alpha
tic;
detvalz=fdetinterp1(wswdel);
toc;

elapsed_time =

    6.6290



detvalzdel=detvalz;
diary off;
