pmgram {ecodist}R Documentation

Partial Mantel correlogram

Description

This function calculates simple and partial multivariate correlograms.

Usage

pmgram(data, space, partial, breaks, nclass, stepsize, resids = FALSE, nperm = 1000)

Arguments

data lower-triangular dissimilarity matrix.
space lower-triangular matrix of geographic distances.
partial optional, lower-triangular dissimilarity matrix of ancillary data.
breaks locations of class breaks. If specified, overrides nclass and stepsize.
nclass number of distance classes. If not specified, Sturge's rule will be used to determine an appropriate number of classes.
stepsize width of each distance class. If not specified, nclass and the range of space.d will be used to calculate an appropriate default.
resids if resids=TRUE, will return the residuals for each distance class. Otherwise returns 0.
nperm number of permutations to use. If set to 0, the permutation test will be omitted.

Details

This function does four different analyses: If data has 1 column and partial is missing, calculates a multivariate correlogram for data.

If data has 2 columns and partial is missing, calculates Mantel r between the two columns for each distance class.

If data has 1 column and partial exists, does a multivariate correlogram for the residuals, taking residuals over whole extent.

If data has 2 columns and partial exists, does a partial multivariate correlogram, calculating partial for each distance class separately.

Value

Returns a object of class mgram, which is a list containing two objects: mgram is a matrix with one row for each distance class and 4 columns:

lag midpoint of the distance class.
ngroup number of distances in that class.
mantelr Mantel r value.
pval two-sided p-value.

resids is a vector of the residuals (if calcuated) and can be accessed with the residuals() method.

Author(s)

Sarah Goslee, Sarah.Goslee@ars.usda.gov

See Also

mgram, mantel

Examples


## Not run: 
# generate a simple surface
x <- matrix(1:10, nrow=10, ncol=10, byrow=FALSE)
y <- matrix(1:10, nrow=10, ncol=10, byrow=TRUE)
z1 <- x + 3*y
z2 <- 2*x - y

# look at patterns
par(mfrow=c(1,2))
image(z1)
image(z2)

# analyze the pattern of z across space
z1 <- as.vector(z1)
z2 <- as.vector(z2)
z1.d <- distance(z1, "eucl")
z2.d <- distance(z2, "eucl")

space <- cbind(as.vector(x), as.vector(y))
space.d <- distance(space, "eucl")

# take partial correlogram of z2 on the residuals of z1 ~ space.d
z.pmgram <- pmgram(z1.d, space.d, z2.d, nperm=0)
par(mfrow=c(1,1))
plot(z.pmgram, pval=0.1)
## End(Not run)


[Package ecodist version 1.2.2 Index]