All nonzero links have been replaced by weights proportional to the inverses of
the Euclidean distances between the points.
Now it is time to compute the MEM spatial variables. This can be done by
function scores.listw() of the package adespatial. We will do it on the
inverse distance matrix created above. The MEM will then be tested for spatial
correlation (Moran’s I).
# Computation of MEM variables (from an object of class listw)
mite.invdist.MEM <- scores.listw(mite.invdist.lw)
summary(mite.invdist.MEM)
attributes(mite.invdist.MEM)$values
barplot(attributes(mite.invdist.MEM)$values)
# Store all MEM vectors in new object
mite.invdist.MEM.vec <- as.matrix(mite.invdist.MEM)
# Test of Moran's I of each eigenvector
mite.MEM.Moran
# MEM with significant spatial correlation
which(mite.MEM.Moran$pvalue <= 0.05)
length(which(mite.MEM.Moran$pvalue <= 0.05))
MEM 1, 2, 3, 4, 5 and 6 have significant spatial correlation.
# MEM with positive spatial correlation
MEM.Moran.pos -1/(nrow(mite.invdist.MEM.vec)-1))
mite.invdist.MEM.pos <- mite.invdist.MEM.vec[ ,MEM.Moran.pos]
# MEM with positive *and significant* spatial correlation
mite.invdist.MEM.pos.sig
To show that the MEM variables are directly related to Moran’s I, let us draw a
scatterplot of the MEM eigenvalues and their corresponding Moran’s I:
346
7 Spatial Analysis of Ecological Data
the Euclidean distances between the points.
Now it is time to compute the MEM spatial variables. This can be done by
function scores.listw() of the package adespatial. We will do it on the
inverse distance matrix created above. The MEM will then be tested for spatial
correlation (Moran’s I).
# Computation of MEM variables (from an object of class listw)
mite.invdist.MEM <- scores.listw(mite.invdist.lw)
summary(mite.invdist.MEM)
attributes(mite.invdist.MEM)$values
barplot(attributes(mite.invdist.MEM)$values)
# Store all MEM vectors in new object
mite.invdist.MEM.vec <- as.matrix(mite.invdist.MEM)
# Test of Moran's I of each eigenvector
mite.MEM.Moran
which(mite.MEM.Moran$pvalue <= 0.05)
length(which(mite.MEM.Moran$pvalue <= 0.05))
MEM 1, 2, 3, 4, 5 and 6 have significant spatial correlation.
# MEM with positive spatial correlation
MEM.Moran.pos
mite.invdist.MEM.pos <- mite.invdist.MEM.vec[ ,MEM.Moran.pos]
# MEM with positive *and significant* spatial correlation
mite.invdist.MEM.pos.sig
scatterplot of the MEM eigenvalues and their corresponding Moran’s I:
346
7 Spatial Analysis of Ecological Data
