# Analyze spatial correlation from a plot [closed]

I want to know how random variables at a certain geographic location are correlated spatially. Lets say I have a certain function z depending on the spatial locations of the points. If I plot this z values spatially, then from the plot how can I analyze their spatial correlation. How does the plot look like or supposed to look like

-
There is a large literature addressing this question. It offers methods depending on (a) the type of response $z$ (whether it represents a continuously varying function, a Census of results, a sample of results, some kind of statistical summary aggregated by spatial unit, etc.); (b) the spatial units represented by the function values: true points, tiny point-like regions, linear features or arcs, natural regions (like watersheds), artificial regions (like Census blocks), etc.; (c) the uniformity of size and location of the data; etc. Can you provide some of those details? –  whuber Mar 25 at 13:55

## closed as not a real question by whuber♦Apr 24 at 13:38

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.If this question can be reworded to fit the rules in the help center, please edit the question.

How I would approach this problem:

1. I would start with the data, and then for each point, count the number of neighbors within some range.
2. After doing this for both of the distributions, I would look at how the neighbor-count compares at the same points. I might plot an empirical CDF of the differences in counts.
3. I might have to adjust the "range" within which to look some in order to determine whether or not this approach had valuable results.
-
Could you please provide a reference or at least sketch the theoretical justification for this method? It looks ad hoc. –  whuber Mar 25 at 13:51
At some level, you can just look at the values plotted in space (by color, for example); if they appear to not be random, they will probably be correlated. A test for whether spatial correlation exists is the Moran's $I$ test statistic. Wikipedia has a pretty good description.
You will need to identify a spatial weights matrix. In R, the package spdep can help you with that. It also has a function to calculate Moran's $I$.