%SIM_STATS simulates randomly distributed points and autocorrelated
%data for a given rho value and compares the four stats, I,rho,r and
%d on the basis of this data.

clear('N','k','rho','W','L','Z','perm')

rho = .3 ;

N = 50 ;

k = 500 ;

%Simulate Data

DAT = sar_nn_sim(rho,N,k) ;

L = DAT{1};

W = DAT{2} ;

Z = DAT{3} ;

%Run Random Permutation tests

perm = 99 ;

S = zeros(k,4) ;

for i = 1:k ;

   OUT = ran_perm(Z(:,i),W,perm) ;
   
   S(i,:) = OUT(:,2)' ;  %record the four prob values
   
end

   
   
