Mantel Tests Comparing Distance Matrices Spatial Autocorrelation • Spatial autocorrelation means that observations that are close to one another in space are more similar to one another than to other observations farther away – Nearby sites are closer in time – Nearby sites are closer in assemblage composition Mantel Test • Widely used in ecology to compare two distance matrices • Correlation is a measure of spatial autocorrelation (pearson, spearman, or kendall’s tau • Significance must be determined by permutations of the distance matrix Example • Snodgrass site – does the presence of decorated/prestige artifacts show spatial autocorrelation? • Load the data set and convert the variables to dichotomies • Compute distance matrices and plot 91*90/2 = 4095 distance pairs > pa <- sapply(Snodgrass[,8:39], function(x) as.numeric(as.logical(x))) > Snodgrass3 <- data.frame(Snodgrass[,1:7], pa, Snodgrass[,40:41]) > > > > > > > > library(vegan) S.dist <-dist(Snodgrass3[,c(26, 27, 29:38)], method="binary") A.dist <-dist(Snodgrass3$Area, method="euclidean") G.dist <-dist(Snodgrass3[,1:2], method="euclidean") plot(G.dist, S.dist, pch=".", cex=2) abline(lm(S.dist~G.dist), col="red", lwd=2) GS.man <- mantel(G.dist, S.dist) GS.man Mantel statistic based on Pearson's product-moment correlation Call: mantel(xdis = G.dist, ydis = S.dist) Mantel statistic r: 0.1271 Significance: 0.001 Empirical upper confidence limits of r: 90% 95% 97.5% 99% 0.0282 0.0364 0.0455 0.0551 Based on 999 permutations > str(GS.man) List of 6 $ call : language mantel(xdis = G.dist, ydis = S.dist) $ method : chr "Pearson's product-moment correlation" $ statistic : num 0.127 $ signif : num 0.001 $ perm : num [1:999] -0.01123 -0.00424 -0.003... $ permutations: num 999 - attr(*, "class")= chr "mantel" Mantel Correlogram • Correlation plotted by distance to see at what distances the correlation peaks S.correl <- mantel.correlog(S.dist, G.dist) plot(S.correl) print(S.correl) Mantel Correlogram Analysis Call: mantel.correlog(D.eco = S.dist, D.geo = G.dist) class.index n.dist 24.561714 278.000000 53.465764 666.000000 82.369815 848.000000 111.273865 908.000000 140.177916 1038.000000 169.081966 1010.000000 197.986017 914.000000 226.890067 876.000000 255.794118 640.000000 284.698168 462.000000 313.602219 318.000000 342.506269 174.000000 371.410320 56.000000 D.cl.1 D.cl.2 D.cl.3 D.cl.4 D.cl.5 D.cl.6 D.cl.7 D.cl.8 D.cl.9 D.cl.10 D.cl.11 D.cl.12 D.cl.13 --Signif. codes: Mantel.cor Pr(Mantel) Pr(corrected) 0.038772 0.004 0.004 ** 0.065959 0.001 0.002 ** 0.054817 0.002 0.004 ** 0.023341 0.070 0.070 . 0.027887 0.045 0.090 . -0.012919 0.221 0.221 -0.023078 0.073 0.210 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Partial Mantel Test • We can control for a third variable to see if that eliminates the spatial autocorrelation > GSA.man <- mantel.partial(G.dist, S.dist, A.dist) > GSA.man Partial Mantel statistic based on Pearson's product-moment correlation Call: mantel.partial(xdis = G.dist, ydis = S.dist, zdis = A.dist) Mantel statistic r: 0.1286 Significance: 0.001 Empirical upper confidence limits of r: 90% 95% 97.5% 99% 0.0270 0.0357 0.0439 0.0542 Based on 999 permutations