
%This example program estimates a mixed model 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 (spatially lagged X=DX) intercept]*parameters+alpha*spatially lagged Y+error
%This model has several names in the literature such as mixed regressive spatially autoregressive models

%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]=fmix1(xsub,y,detvalz,wws);
toc

elapsed_time =

    0.2000


alphamax

alphamax =

    0.6700


bmax

bmax =

   -0.7292
    0.1797
    0.4572
    0.0447
    0.4679
    0.0383
   -0.3291
   -0.1404
    0.4097


[ likratios prhigher]

ans =

  904.7527         0
  209.8549         0
  753.5635         0
   24.9853    0.0000
   66.9655    0.0000


%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;
