The R script below tests whether a set of points on a plane is significantly clustered (as opposed to randomly distributed or, conversely, equally spaced), using the Clark-Evans R measure. From the R spatstat package manual "[Clark-Evans R] is the ratio of the observed mean nearest neighbour distance in the pattern to that expected for a Poisson point process of the same intensity. A value *R>1* suggests ordering, while *R<1* suggests clustering."

If you have points on a sphere you'll have to reproject - as far as I can tell there's no way to use spherical distance formulas. You'll also want to use a different measure to check for spatial clustering with respect to an attribute of the data points, for example Getis Ord G.

The spatstat package requires a window (essentially a polygon bounding box, and in this example a shapefile of the contiguous US is used. Because the edges of the data are a coastline (i.e. physically significant rather than an arbitrary data limit), I'm not using the edge-correct R in the results. The test gives a p-value, which tells you how significantly clustered/ordered your data is.

coords97<-read.csv("1997CoCoords.csv")

install.packages("deldir")

install.packages("maptools")

install.packages("spatstat_1.31-1.tar.gz", repos = NULL, type="source")

library(spatstat)

library(maptools)

x<-readShapeSpatial("nos80k.shp")

y<-as(x, "SpatialPolygons")

spatstat.options(checkpolygons=FALSE)

usawin<-as.owin(y)

spatstat.options(checkpolygons=TRUE)

points97<-ppp(coords97[,2],coords97[,3], window=usawin)

ce97<-clarkevans(points97)

ce97test<-clarkevans.test(points97, alternative="clustered")

- Heartbeat Choker
- 2014 elections party results maps
- Voter Turnout in the 2014 South African Elections
- Open Access to ICTD Research
- Let them eat cellphones?

- October (1)

- May (2)

- arduino (2)
- beforeiforget (4)
- digital methods (1)
- dissertation (1)
- django (2)
- gis (4)
- internet activism (1)
- mobiles and development (1)
- networkanalysis (1)
- R (2)
- research (1)
- sewing (1)
- ubuntu (2)

## Comments

## New Comment