Learn R Programming

ncf (version 1.1-6)

mantel.correlog: Mantel (cross-)correlograms

Description

mantel.correlog is the function to calculate a Mantel (cross-)correlogram. The function requires two (or three) matrices.

Usage

mantel.correlog(dmat, zmat, wmat = NULL, increment, resamp = 1000, 
quiet = FALSE)

Arguments

dmat
a matrix representing distance.
zmat
a matrix representing similarity.
wmat
an optional third matrix of similarities to calculate a Mantel cross-correlograms.
increment
increment for the uniformly distributed distance classes.
resamp
the number of permutations under the null to assess level of significance.
quiet
if TRUE the counter is supressed during execution.

Value

  • An object of class "correlog" is returned, consisting of the following components:
  • correlationthe value for the moran (or Mantel) similarity.
  • mean.of.classthe actual average of the distances within each distance class.
  • nlokthe number of pairs within each distance class.
  • x.interceptthe interpolate x.intercept of Epperson (1993).
  • pthe permutation two-sided p-value for each distance-class.
  • corr0if a cross-correlogram is calculated, corr0 gives the empirical cross-correlation at distance zero.

Details

The function calculates Mantel (cross-)correlograms at discrete distance classes from two (or three) matrixes. The first is the matrix of distances and the second is a matrix of similarities. The optional third matrix is an additional similarity matrix to be used to calculate a Mantel cross-correlogram. Missing values are allowed -- values are assumed missing at random.

See Also

plot.correlog

Examples

Run this code
#first generate some sample data
    x <- expand.grid(1:20, 1:5)[,1]
    y <- expand.grid(1:20, 1:5)[,2]

#z data from an exponential random field
    z <- cbind(
        rmvn.spa(x=x, y=y, p=2, method="exp"),
        rmvn.spa(x=x, y=y, p=2, method="exp")
        )

#w data from a gaussian random field
    w <- cbind(
        rmvn.spa(x=x, y=y, p=2, method="gaus"),
        rmvn.spa(x=x, y=y, p=2, method="gaus")
        )


#Make distance and similarity matrices
zmat=cor(t(z))
wmat=cor(t(w))
dmat <- sqrt(outer(x,x, "-")^2+outer(y,y,"-")^2)

#Mantel correlogram 
fit1 <- mantel.correlog(dmat=dmat, zmat=zmat, increment=2, quiet=TRUE, resamp=0)
plot(fit1)

#Mantel cross-correlogram 
fit2 <- mantel.correlog(dmat=dmat, zmat=zmat, wmat =wmat, increment=2, quiet=TRUE, resamp=0)
plot(fit2)

Run the code above in your browser using DataLab