Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

residuals.mgram

Residuals of a Mantel correlogram


Description

Extracts residuals from an S3 object of class mgram (only relevant for objects created by pmgram{}).

Usage

## S3 method for class 'mgram'
residuals(object, ...)

Arguments

object

an object of class mgram

...

additional arguments

Value

vector of residuals.

Author(s)

Sarah Goslee

See Also

Examples

#### Partial pmgram example

# generate a simple surface
# with complex nonlinear spatial pattern

x <- matrix(1:10, nrow=10, ncol=10, byrow=FALSE)
y <- matrix(1:10, nrow=10, ncol=10, byrow=TRUE)

# create z1 and z2 as functions of x, y
# and scale them to [0, 1]
z1 <- x + 3*y
z2 <- y - cos(x)

z1 <- (z1 - min(z1)) / (max(z1) - min(z1))
z2 <- (z2 - min(z2)) / (max(z2) - min(z2))

z12 <- (z1 + z2*2)/3

# analyze the pattern of z across space
z1 <- as.vector(z1)
z2 <- as.vector(z2)
z12 <- as.vector(z12)
z1.d <- dist(z1)
z2.d <- dist(z2)
z12.d <- dist(z12)

space <- cbind(as.vector(x), as.vector(y))
space.d <- dist(space)

# take partial correlogram of z12 given z1
z.z1 <- pmgram(z12.d, space.d, z2.d, nperm=0, resids=TRUE)
summary(residuals(z.z1))

ecodist

Dissimilarity-Based Functions for Ecological Analysis

v2.0.7
GPL (>= 2)
Authors
Sarah Goslee [aut, cre], Dean Urban [aut]
Initial release
2020-08-26

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.