# Knowing if there is correlation between roads and observations in ArcMap?

I am using ArcMap 10.3.1.

I am trying to find out whether some observations have been made randomly throughout a landscape, or they are biased towards the location of roads and paths. I have a layer with the observations and a layer with the roads.

Any tip on how I may do this, other than through visual inspection?

• Welcome to gis.stackexchange! Please note that a good question on this site is expected to show some degree of research on your part, i.e. what you have tried and - if applicable - code so far. For more info, you can check our faq. – underdark Jan 23 '16 at 19:08
• This question I asked a while back may be of some relevance to you : gis.stackexchange.com/questions/162613/… - In my question I was looking at incidents that occurred on certain roads and wether or not they were significant. – ed.hank Jan 23 '16 at 20:12
• Histogram by distance to roads – FelixIP Jan 23 '16 at 20:46
• Do you have Spatial Analyst available? – jbchurchill Jan 24 '16 at 1:00
• jbchurchill; I do have spatial analyst available. Most of its tools seem to help for issues similar to mine, but not this one precisely. – Agar Jan 24 '16 at 18:42

Visual inspection of a suitably chosen graphic (but rarely the map!) can be an excellent choice.

Consider this (real-world) scene in which the light lines designate roads. It is approximately 13 kilometers wide and 8 kilometers high:

I have generated a sample of 477 points, here shown colored according to their distance to the nearest road:

Most of them tend to be close to roads, as this histogram of the 477 distances indicates.

However, by itself this tells us nothing: we need to compare the distances in the sample to all the distances in the sample area. To do this, I used Spatial Analyst to create a Euclidean Distance grid (with 10 meter cell sizes) covering the sample area. Here is its histogram (in gray) superimposed on the previous one. These histograms use density rather than actual counts so that the two datasets can be directly compared.

There are some differences--but they appear to be tiny and erratic. The sample has slightly more points at the shortest distances and slightly fewer points in the 200-400 meter, 700-800 meter, and 1400-2100 meter ranges. Does this reflect a real difference or is it just due to chance?

There are many ways to find out, such as a formal comparison of average distances, a chi-square test, a Kolmogorov-Smirnov test, a QQ plot, and a PP plot. I have looked at them all, but they are all inconclusive. The most powerful method I have found is derived from the QQ-plot.

Here's what to do. Corresponding to every distance d in the dataset is its empirical distribution given by the proportion of the data that have a distance of d or less. Call this proportion x. There is a corresponding proportion y in the reference dataset: it is the fraction of the total study area that is within a distance d of a road. The QQ plot graphs each y against each x for all the distances d that show up in the sample. If there is some way in which the sampling favors certain distances, it will show up as a discrepancy between each y and its corresponding x. If you want to see discrepancies, then plot them. The red dots in the next figure plot each y-x against x. I call this a "Residual QQ Plot."

Where the values are below zero, the sample exhibits more values at short distance than on average. The part of this plot from x=0 to about x=0.05, at the very left, suggests initially the sample may have too many values close to the roads. This tendency continues until x=0.25 or so, when the negative discrepancy becomes the greatest and the plot bottoms out. The advance of the red dots from y=-0.02 to y=0 at the very end, between x=0.9 and x=1.0, similarly suggests a slight dearth of values at the greatest distances.

Whether any of this is more than "noise" in the data is a good question. To address that, I generated 499 random samples of exactly the same size and drew their graphs in gray. You can see the envelope of all those graphs. Our sample's graph lies within that envelope--but only barely. Near the point (x,y) = (0.03, -0.02), it hits the very fringes. It's also near the fringes at (0.89, -0.025). Both of these are good hints that this sample very slightly favors points close to roads compared to points far from them.

For another example, I obtained a random sample of 500 points and then excluded the 22 points within 10 meters of any road. That would be visually difficult to detect, but here is the residual QQ plot:

The left hand end of the red graph makes it very clear that some of the shortest distances are missing--and its height, which eventually climbs to 0.04, suggests that the missing points are around 4% of the total (equal to 20). The gradual and steady trend back to 0 from left to right suggests there are no other identifiable discrepancies.

The beauty of this technique lies in its diagnostic capabilities: it shows you, forcibly, precisely how your sample varies from being uniformly random. As such it can be warmly recommended.

All the statistical plots, from the histograms onward, were generated in `R` after exporting the sample point distances and the Euclidean distance grid to an ASCII format. Their construction is straightforward.

Incidentally, the original sample was obtained with a probability sampling method in which some points in a truly uniform sample were rejected. The rejection probabilities increased from 0% next to the roads to around 40% furthest from the roads. Although a 40% change in rejection probability would seem to be a strong effect, it is difficult to detect (even in such a large sample) because the most-distant points comprise only a tiny fraction of the area.

You could run a spatial join to determine the distance to nearest roads, and test to see if the distribution of points is strongly related to proximity to roads. Or use point density at different distances to roads to measure the same. Another option would be to take a sample of your road segment, and generate randomly placed duplicates across the landscape and measure the distribution of points to each. This would indicate if the distribution relative to the actual road is due to random chance or if the road is a likely factor. I last used an arcview 3 extension to run this process, but I believe there is a tool in arcgis (or maybe part of the GME extension) that would do this.