Hello all, Allin & Jack !
You really saved my day ! Let me sum up the situation.
I tested both scripts, they run perfectly !
In fact the msortby command is not documented yet, this is why i had trouble
to translate the find_nn command of James Lesage.
Now I can compute the right neighborhood matrices from a whole sample and
subsamples of interest. This is really neat because once they are created we
can compute spatial autocorrelation coefficients directly using matrix
commands or via regression with bootstrap of p-values :the moran scatterplots
of Luc Anselin, which have the interest of providing real confidence
intervals.
My tests show small differences in results from GEODA and the GRETL scripts I
use now. This is all good news and I will rest on your input to propose a few
scripts and/or functions to compute tests for spatial autocorrelation I will
submit to the community. I hope to write a short note and propose my scripts
soon so that users can grasp the basics of those tests.
Returning to the matter of neighbors, and programming, there are far smarter
algorithms than the brute force hack I work on, but think it better to propose
the simple scripts first before turning on the real smart ones which consist
in exploring the neighborhood graph with special functions and pointers. More
of this when the work will be more advanced.
First i will propose the Moran spatial autocorrelation test as a function
using two types of neighborhood structures: contiguity (common border) and
nearest neighbors with choice in the number of neighbors on two kind of grids
too: either square (checkboard) or hexagonal.
Well, thanx very much Allin and Jack !
more about that soon !
cheers
F.
--
Franck Nadaud
Economiste
CIRED
UMR 8568 CNRS - EHESS
45 bis avenue de la Belle Gabrielle
94736 Nogent-sur-Marne Cedex
TEL 33-1-43-94-73-94
FAX: 33-1-43-94-73-70
MOB: 06-07-39-92-75
France