# Detecting spatial autocorrelation with limited spatial information

I have some ecological data collected from n independent sites spanning a relatively large spatial scale (>10 degrees of latitude), and from each site, n replicate samples were collected but no associated spatial information (e.g. coordinates) recorded. So, assuming spatial dependence (if any) is only operating at a within-site scale:

Question: Is there any way to test for spatial autocorrelation among samples (i.e. at the replicate level) without their associated coordinates?

A user-friendly push in the right direction wrt this question would be very much appreciated.

UPDATE: After reading up on this question, perhaps a Moran's I test based on (1) a binary weights matrix indicating neighbouring (1's) and non-neighbouring (0's) site (A or B) replicates (1, 2, 3), for example:

   A1 A2 A3 B1 B2 B3
A1
A2  1
A3  1  1
B1  0  0  1
B2  0  0  0  1
B3  0  0  0  1  1


and (2) a distance- or dissimilarity-based matrix of the measured variable, for example:

    A1   A2   A3   B1   B2   B3
A1
A2  0.4
A3  0.5  0.4
B1  1.2  1.3  1.4
B2  1.4  1.3  1.2  0.4
B3  1.4  1.3  1.2  0.5  0.3


Does this seem right? If so, a worked example in R would be good, as I'm presently having coding issues (using package ecodist).

• So a point in another site (even if the sites are neighboring) wouldn't be expected to have any auto-correlation - only samples sharing the same site? Sep 2, 2015 at 11:42
• What quantitative location information do you actually have? (If you have no location information at all, how could you hope to learn anything about spatial autocorrelation?)
– whuber
Sep 2, 2015 at 15:20
• That's exactly right @AndyW Sep 2, 2015 at 19:44
• - only within site spatial autocorrelation is expected. If data were simply site averaged, this might 'mask' any spatial dependence at that scale, but for me its more accurate to analyse at the replicate level. Sep 2, 2015 at 19:51

With only the aggregate spatial locations, and no theoretical reasons to think there is cross site auto-correlation, you can make a binary adjacency spatial weights matrix for observations sharing the same site.

So if we have a set of data that is like

ID Site
1 1
2 1
3 2
4 2
5 3
6 3


The subsequent binary adjacency spatial weights matrix would be

  1 2 3 4 5 6
1 0 1 0 0 0 0
2 1 0 0 0 0 0
3 0 0 0 1 0 0
4 0 0 1 0 0 0
5 0 0 0 0 0 1
6 0 0 0 0 1 0


You can then do all the usual spatial tests, although you are basically stuck with this particular specification for the spatial weights. E.g. you can't identify the distance at which spatial auto-correlation takes place.

This ends up being very similar to ANOVA (and you will likely also be interested in multi-level modelling). Differences in group means is potentially the result of spatial autocorrelation, although it is confounded with site. Differences in variances between sites can also be the result of auto-correlation within the site.

See these two references for discussion of these effects:

Here is an example using the spdep library. They actually have a function to make the spatial weights matrix just for this occasion.

library(spdep)
set.seed(10)

#Making random data and 10 sites
x <- rnorm(1000)
site <- sample(1:10,1000,replace=TRUE)

#neighbor matrix
W <- nb2blocknb(ID=site)

#spatial autocorrelation
moran.test(x,nb2listw(W, style="W"))


If you don't want to use the spdep library, here is how the spatial weights adjacency matrix is made under the hood. Basically just take the distance matrix for your unique site identifier, and then set the two locations as adjacent if the distance is zero. Then set the diagonal of the spatial weights matrix to zero.

W_Cont <- as.matrix(dist(site))==0
diag(W_Cont) <- 0
W_Cont == nb2mat(W, style="B")