Moran’s I in Netlogo

It’s crazy go nuts week here in graduate student land, as final projects and final exams go off like mortar rounds all around us. Duck and cover! “Graduate student”. Oxymoron.

Yesterday I submitted my term project for my data analysis class: an implementation of Moran’s I statistic for measuring clustering in spatial data, built in the NetLogo agent-based modeling environment.

Moran’s I is a bit dated now I suppose, especially if you ask an up-to-date geostatistician, but everybody still uses it because it’s what everybody knows. And who has up to date geostatisticians hanging around to ask these questions of? If you’ve got a NetLogo model and you want a basic measure of spatial autocorrelation of the results, feel free to use and abuse the code. I managed to port it into my NetLogo accent formation model.

Be warned: it’s not 100% statistically valid or validated. I would be careful about reporting strong claims of “statistically significant clustering” until you’ve either improved on it or carefully characterized the results in your own model. But I think it’s reasonable as an ad hoc measure of clustering to parachute into whatever needs one.

Before I had this thing running, the measure of autocorrelation I was using in my accent model was to crank out a semivariogram for all the point pairs, add up the average value-distance for all the pairs on the “near” half of the variogram, add up the average for the “far” half, and compare the ratio of the “near” and “far” averages. Ouch. I called it the “near-far index”. In fact, let’s call it “Stimson’s near-far index”. Don’t use it for God’s sake. When presenting my Moran’s I improvement, I kind of had to describe the Stimson’s statistic it was replacing. Pierre Goovaerts was in the room. I felt his friendly Belgian eyes burning into my back with incredulity. Ouch.

leave a comment