spatial.cor(x, neighbor, statistic="moran", sampling="nonfree", npermutes=0, weight.fun=NULL, cov.fun=NULL)
The choices are:
"moran" - the Moran (1950) measure of spatial association.
"geary" - the Geary (1954) index of spatial association.
"user" - a user specified measure of spatial association.
The statistic="user" option allows the user to define their own correlation measure. In this case, estimates of the variance cannot be computed, though it is still possible to compute a Monte Carlo estimate of the permutation distribution. When statistic="user", the arguments weight.fun and cov.fun must be specified.
As with many Monte Carlo simulations, npermutes=100 is often satisfactory for estimating p-values, though additional precision is obtained when more permutations are taken. More observations are commonly used when confidence intervals are to be computed. See, e.g., Good (1994, page 163), for a discussion.
The print method, print.spatial.cor, prints out the normal z statistic and its two-sided p-value for the null hypothesis of no spatial correlation when statistic is "moran" or "geary".
The Moran coefficient:
M == (n/A)*sum(w[i,j]*z[i]*z[j]) / sum(z[i]*z[i]).
Here the numerator sum is over i and j, while the denominator sum is over i, w[i,j] is the weight for the relationship between observations i and j (zero means no relationship), A is the sum of the weights w[i,j], and z[i]=x[i]-mean(x) is the centered variate obtained from x[i].
The Geary coefficient:
G == (n-1)/(2*A)*sum(d[i,j]*(x[i]-x[j])^2) / sum(z[i]*z[i]).
The measures (except those for statistic="user") are described in Cliff and Ord (1981, Chapter 1).
The Moran measure most resembles a Pearson correlation coefficient, and has mean -1/(n-1) when there is no association. Here n is the number of rows in x (or, for vectors, n is the length of x). The Geary measure has mean 1 in the null case.
In addition to these two measures, you can specify other measures of spatial association by providing an S-PLUS function to compute a weighting or scaling factor (the weight.fun function), with a second function to compute a covariance or association measure (the cov.fun function). These functions, whose arguments are obtained from the input arguments to spatial.cor, each return a single value, and the measure of association is computed as the product of these values. Routine call_S is used in computing the permutation distribution for user specified correlations. call_S is somewhat slower (and uses more memory) than the C code used in computing the permutation distribution for the built-in measures.
Permutation distributions are important when computing measures of spatial correlation because the null distribution of the association statistic varies with the spatial lattice size and shape. This variability makes it difficult to provide approximate theoretical distributions, making the distribution of the Monte Carlo estimates all the more valuable. Confidence intervals and tests can be computed from the permutation distribution as they would be from an exact distribution. For example, a two-sided 10 percent confidence is obtained as the 5-th and 95-th percentile from the permutation distribution. Notice, however, that different runs of the program with different random number seeds will lead to slightly different results. Use set.seed to set the random number seed.
Geary, R. C. (1954). The contiguity ratio and statistical mapping. The Incorporated Statistician. 5, 115-145.
Good, P. (1994). Permutation Tests. New York. Springer Verlag.
Moran, P. A. P. (1948). The interpretation of statistical maps. Journal of the Royal Statistical Society, Series B. 10, 243-251.
Moran, P. A. P. (1950). Notes on continuous stochastic phenomena. Biometrika. 37, 17-23.
sids.cor <- spatial.cor(sids$sid, neighbor=sids.neighbor, statistic="geary", sampling="free", npermutes=100) sids.cor