# How to compare two spatial point patterns?

If I have two point pattern distributions within the same geographic region, how would I go about visually and quantitatively comparing those two distributions?

Also assume I have many points within a smaller region, so simply displaying a pin map is uninformative.

Any examples or resources on calculations are always appreciated.

-

As always, it depends on your objectives and the nature of the data. For completely mapped data, a powerful tool is Ripley's L function, a close relative of Ripley's K function. Lots of software can compute this. ArcGIS might do it by now; I haven't checked. CrimeStat does it. So do GeoDa and R. An example of its use, with associated maps, appears in

Sinton, D. S. and W. Huber. Mapping polka and its ethnic heritage in the United States. Journal of Geography Vol. 106: 41-47. 2007

Here is a CrimeStat screenshot of the "L function" version of Ripley's K:

The blue curve documents a very non-random distribution of points, because it does not lie between the red and green bands surrounding zero, which is where the blue trace for the L-function of a random distribution should lie.

For sampled data, much depends on the nature of the sampling. A good resource for this, accessible to those with limited (but not entirely absent) background in math and stats, is Steven Thompson's textbook on Sampling.

It is generally the case that most statistical comparisons can be illustrated graphically and all graphical comparisons correspond to or suggest a statistical counterpart. Therefore any ideas you get from the statistical literature are likely to suggest useful ways to map or otherwise graphically compare the two datasets.

-
Thank you for the Dixon paper, it appears to be an excellent resource. I had never come across the distinction between spatial interaction and random labeling for multi-variate patterns. I will need to read up. – Andy W Dec 16 '10 at 19:06
+1 Good resources. So the old fishing truism that "90% of the fish are in 10% of the lake" really depends on the sampling method? – Kirk Kuykendall Dec 17 '10 at 14:51
@Kirk For many of us, 0% of the fish are in the 10% of the lake that we actually manage to reach! – whuber Dec 17 '10 at 22:35

A quadrat analysis would be great for this. It's a GIS approach able to highlight and compare the spatial patterns of different point data layers.

An outline of a quadrat analysis that quantifies the spatial relationships between multiple point data layers can be found at http://www.nccu.edu/academics/sc/artsandsciences/geospatialscience/_documents/se_daag_poster.pdf.

-
(1) The link is a 404 (which is why we ask answers to include summaries of all links). (2) How precisely would a quadrat analysis compare two point distributions? – whuber Sep 12 '13 at 16:25
(1) The link might work now. (2) A quadrat analysis divides a given area into equal-sized units, sized appropriately. It then uses probability analysis to determine the actual frequency of points within each quadrat versus an expected value for each frequency. Using the point density command and the zonal statistics as table tools in the spatial analyst extension for ArcMap, we can highlight areas within proximity of high-density point locations in addition to summarizing these point feature classes for regression analysis. – user21931 Sep 13 '13 at 1:17
You have described a procedure for univariate analysis of point distributions. It could be adapted (by assessing quadrat correlations) to comparing the degree of co-occurrence of the two processes, but suffers from two significant limitations. First, it does not study the relationships between the processes as a function of distance; second, by binning the points in quadrats it loses power. A loss of power means you might fail to identify important patterns or else it implies you need to collect more data to achieve the investigation objectives. – whuber Sep 13 '13 at 14:18
I've used this "procedure" for multivariate analysis of point distributions. While it does imply a loss of power, it also provides a way to visually and quantitatively compare two point pattern distributions at unique levels of aggregation ( a solution for the original question here). – user21931 Sep 14 '13 at 0:27
I hope that what you read on our site inspires you to consider alternative approaches in the future: they will expand your ability to make the most of your data and limited research resources. – whuber Sep 14 '13 at 1:06

Note: the following was edited following whuber's comment

You might want to adopt a Monte Carlo approach. Here's a simple example. Assume you want to determine if the distribution of crime events A is statistically similar to that of B, you could compare the statistic between A and B events to an empirical distribution of such measure for randomly reassigned ‘markers’ .

For instance, given a distribution of A (white) and B (blue),

you randomly reassign labels A and B to ALL points in the combined dataset. This is an example of a single simulation:

You repeat this many times (say 999 times), and for each simulation, you compute a statistic (average nearest neighbor statistic in this example) using the randomly labeled points. Snippets of code that follow are in R (requires the use of the spatstat library).

``````nn.sim = vector()
P.r = P
for(i in 1:999){
marks(P.r) = sample(P\$marks)  # Reassign labels at random, point locations don't change
nn.sim[i] = mean(nncross(split(P.r)\$A,split(P.r)\$B)\$dist)
}
``````

You can then compare the results graphically (red vertical line is the original statistic),

``````hist(nn.sim,breaks=30)
abline(v=mean(nncross(split(P)\$A,split(P)\$B)\$dist),col="red")
``````

or numerically.

``````# Compute empirical cumulative distribution
nn.sim.ecdf = ecdf(nn.sim)

# See how the original stat compares to the simulated distribution
nn.sim.ecdf(mean(nncross(split(P)\$A,split(P)\$B)\$dist))
``````

Note that the average nearest neighbor statistic may not be the best statistical measure for your problem. Stats such as the K-function could be more revealing (see whuber's answer).

The above could be easily implemented inside ArcGIS using Modelbuilder. In a loop, randomly reassigning attribute values to each point then compute a spatial statistic. You should be able to tally the results in a table.

-
You might want to consider a permutation test instead of the kernel density approach, Manny. The null hypothesis is that the blue and white labels are independent of the points. To test this, adopt a statistic appropriate for the neighborhood (such as mean nearest distance between blue and white dots, traveling along streets). Randomly reassign the colors to all dots, keeping the same amounts of blue and white, and recalculate the statistic. Repeat many times to estimate the null distribution of the statistic. Refer the actual value of the statistic to this distribution to get a p-value. – whuber Jan 31 '12 at 16:15
Thanks whuber. It never occurred to me to view this as a marked point problem. I updated my answer to reflect this approach. However, it's not clear to me why my original approach (i.e. using a kernel density grid to generate random points) resulted in a different outcome. In fact, it (my original solution) did not faithfully reflect the fact that both A and B came from a similar process. Is this because the kernel density approach does not take advantage of the detail provided to us by the point data? – MannyG Jan 31 '12 at 17:45
The kernel density has a small element of arbitrariness to it (associated with the choice of halfwidth). This can make a difference. It's also somewhat removed from what's really going on: there's an underlying process producing points; you see one realization of that process; you make a KDE of it; then you draw new realizations from that KDE. In effect you're just reproducing new configurations a lot like the single configuration you observe. In the permutation approach, the null hypothesis that both distributions are the same justifies permuting the markings: this is direct and powerful. – whuber Jan 31 '12 at 19:08
Thanks for the input, I will give a more full comment when I have more time. It would be good to note this R code (did you even mention it is R code in the answer?) and it utilizes functions in the `spatstat` package. – Andy W Jan 31 '12 at 20:42
+1, One of the nice things about utilizing permutation tests like this is 1) when constrained to the specificity of the geocoder (address or address ranges for crime data in most circumstances) evaluating point patterns compared to complete spatial randomness doesn't make too much sense. 2) Such permutation tests avoid problems with edge effects. Of course these are over-generalizations, but I think such a framework can be generalized to evaluating many different types of point pattern statistics. – Andy W Feb 5 '12 at 16:26

You can run a bivariate correlation analysis in many statistic softwares to determine the level of statistical correlation between the two variables and significance level . You could then back up your statistical findings by mapping one variable using a chloropleth scheme, and the other variable using graduated symbols. Once overlayed, you can then determine which areas display high/high, high/low and low/low spatial relationships. This presentation has some good examples.

You can also try some unique geovisualization softwares. I really like CommonGIS for this type of visualization. You can select a neighbourhood (your example) and all the usefull statistics and plots will be available to you right away. It makes analysis of multi variable maps quite effortless.

-
These are good ideas, but I notice the examples you refer to are successful because the attributes correspond to common sets of features. In the present question, the features have different locations and those locations are random variables (not fixed administrative units, for instance). These are important complications, because now we need to find some meaningful procedure to relate values at one location to those at other locations and we need to cope with the random character of the locations themselves. – whuber Jan 31 '12 at 16:41
Thanks for that clarification! I mis-read the OP and assumed it was for two independent variables that shared a location/geographic extent (as with DA/CT etc) – Michael Markieta Feb 1 '12 at 0:55

Supposing you have reviewed literature on Spatial Auto-correlation. ArcGIS has various point and click tools to do this for you via Toolbox scripts: Spatial Statistics Tools -->Analysing Patterns.

You could work backwards - Find a tool and review the algorithm implemented to see if it suites your scenario. I used Moran's Index sometime back while investigating the spatial relationship in the occurrence of soil minerals.

-

You might want to check out CrimeStat.

According to the website:

CrimeStat is a spatial statistics program for the analysis of crime incident locations, developed by Ned Levine & Associates, which was funded by grants from the National Institute of Justice (grants 1997-IJ-CX-0040, 1999-IJ-CX-0044, 2002-IJ-CX-0007, and 2005-IJ-CX-K037). The program is Windows-based and interfaces with most desktop GIS programs. The purpose is to provide supplemental statistical tools to aid law enforcement agencies and criminal justice researchers in their crime mapping efforts. CrimeStat is being used by many police departments around the world as well as by criminal justice and other researchers. The latest version is 3.3 (CrimeStat III).

-

A simple and fast approach could be to create heatmaps and a difference map of those two heatmaps. Related: How to build effective heat-maps?

-
Unfortunately, differencing two interpolated or smoothed maps tends to tell you much more about the interpolation or smoothing method than about the data :-(. If you must interpolate, take care to do it well (e.g., krige after performing EDA and variography) and just interpolate one of the datasets. You can compare actual data in one set to the interpolated values of the other, thereby eliminating half the error of comparing two interpolated maps. Note that interpolation is not valid for many kinds of data and smoothing is inappropriate for other kinds of data. – whuber Dec 16 '10 at 19:41
I agree that this method is not suitable for many kinds of input data. I think it can give a good first impression when analysing point density patterns. – underdark Dec 16 '10 at 20:27
I have no doubt you are correct when the interpolation is performed by an expert and interpreted judiciously. – whuber Dec 16 '10 at 22:23