EcoGenetics (version 1.2.1-5)

eco.cormantel: Mantel and partial Mantel correlograms, omnidirectional and directional

Description

This program computes a Mantel correlogram for the data M, or a partial Mantel correlogram for the data M conditioned on MC, with P-values or bootstrap confidence intervals.

Usage

eco.cormantel(M, XY, MC = NULL, int = NULL, smin = 0, smax = NULL,
  nclass = NULL, seqvec = NULL, size = NULL, bin = c("sturges", "FD"),
  nsim = 99, classM = c("dist", "simil"), method = c("pearson",
  "spearman", "kendall"), test = c("permutation", "bootstrap"),
  alternative = c("auto", "two.sided", "greater", "less"), adjust = "holm",
  sequential = TRUE, latlon = FALSE, angle = NULL, as.deg = TRUE, ...)

Arguments

M

Distance or similarity matrix.

XY

Data frame or matrix with individual's positions (projected coordinates).

MC

Distance or similarity matrix (optional).

int

Distance interval in the units of XY.

smin

Minimum class distance in the units of XY.

smax

Maximum class distance in the units of XY.

nclass

Number of classes.

seqvec

Vector with breaks in the units of XY.

size

Number of individuals per class.

bin

Rule for constructing intervals when a partition parameter (int, nclass or size) is not given. Default is Sturge's rule (Sturges, 1926). Other option is Freedman-Diaconis method (Freedman and Diaconis, 1981).

nsim

Number of Monte-Carlo simulations.

classM

Are M and MC distance or similarity matrices? Default option is classM = "dist" (distance). For similarity, classM = "simil". An incorrect option selected will generate an inverted plot.

method

Correlation method used for the construction of the statistic ("pearson", "spearman" or "kendall"). Kendall's tau computation is slow.

test

If test = "bootstrap", the program generates a bootstrap resampling and the associated confidence intervals. If test = "permutation" (default) a permutation test is made and the P-values are computed.

alternative

The alternative hypothesis. If "auto" is selected (default) the program determines the alternative hypothesis. Other options are: "two.sided", "greater" and "less".

adjust

Correction method of P-values for multiple tests, passed to p.adjust. Defalut is "holm".

sequential

Should be performed a Holm-Bonberroni (Legendre and Legendre, 2012) adjustment of P-values? Defalult TRUE.

latlon

Are the coordinates in decimal degrees format? Defalut FALSE. If TRUE, the coordinates must be in a matrix/data frame with the longitude in the first column and latitude in the second. The position is projected onto a plane in meters with the function geoXY.

angle

for computation of bearing correlogram (angle between 0 and 180). Default NULL (omnidirectional).

as.deg

in case of bearing correlograms for multiple angles, generate an output for each lag in function of the angle? Default TRUE.

...

Additional arguments passed to cor.

Value

The program returns an object of class "eco.correlog" with the following slots:

> OUT analysis output

> IN input data of the analysis

> BEAKS breaks

> CARDINAL number of elements in each class

> NAMES variables names

> METHOD analysis method

> DISTMETHOD method used in the construction of breaks

> TEST test method used (bootstrap, permutation)

> NSIM number of simulations

> PADJUST P-values adjust method for permutation tests

ACCESS TO THE SLOTS The content of the slots can be accessed with the corresponding accessors, using the generic notation of EcoGenetics (<ecoslot.> + <name of the slot> + <name of the object>). See help("EcoGenetics accessors") and the Examples section below.

References

Freedman D., and P. Diaconis. 1981. On the histogram as a density estimator: L 2 theory. Probability theory and related fields, 57: 453-476.

Legendre P., and L. Legendre. 2012. Numerical ecology. Third English edition. Elsevier Science, Amsterdam, Netherlands.

Oden N., and R. Sokal. 1986. Directional autocorrelation: an extension of spatial correlograms to two dimensions. Systematic Zoology, 35:608-617

Rosenberg, M. 2000. The bearing correlogram: a new method of analyzing directional spatial autocorrelation. Geographical Analysis, 32: 267-278.

Sokal R. 1986. Spatial data analysis and historical processes. In: E. Diday, Y. Escoufier, L. Lebart, J. Pages, Y. Schektman, and R. Tomassone, editors. Data analysis and informatics, IV. North-Holland, Amsterdam, The Netherlands, pp. 29-43.

Sturges H. 1926. The choice of a class interval. Journal of the American Statistical Association, 21: 65-66.

Examples

Run this code
# NOT RUN {
# }
# NOT RUN {
data(eco.test)
require(ggplot2)

###############################
## Omnidirectional correlogram
###############################

corm <- eco.cormantel(M = dist(eco[["P"]]), size=1000,smax=7, XY = eco[["XY"]],
nsim = 99)
eco.plotCorrelog(corm)

corm <- eco.cormantel(M = dist(eco[["P"]]), size=1000,smax=7, XY = eco[["XY"]],
nsim = 99, test = "bootstrap")
eco.plotCorrelog(corm)

#######################################################
## A directional approach based in bearing correlograms
#######################################################

corm_b <- eco.cormantel(M = dist(eco[["P"]]), size=1000,smax=7, XY = eco[["XY"]],
nsim = 99, angle = seq(0, 170, 10))

 # use eco.plotCorrelogB for this object
eco.plotCorrelogB(corm_b)

 # plot for the first distance class, 
 use a number between 1 and the number of classes to select the corresponding class
eco.plotCorrelogB(corm_b, interactivePlot = FALSE, var = 1) 

# partial Mantel correlogram
corm <- eco.cormantel(M = dist(eco[["P"]]), MC = dist(eco[["E"]]),
size=1000, smax=7, XY = eco[["XY"]], nsim = 99)
eco.plotCorrelog(corm)

# standard correlogram plots support the use of ggplot2 syntax
require(ggplot2)
mantelplot <- eco.plotCorrelog(corm, interactivePlot = FALSE)
mantelplot <- mantelplot + theme_bw() + theme(legend.position="none")
mantelplot


#-----------------------
# ACCESSORS USE EXAMPLE
#-----------------------

# the slots are accesed with the generic format 
# (ecoslot. + name of the slot + name of the object). 
# See help("EcoGenetics accessors")

ecoslot.OUT(corm)        # slot OUT
ecoslot.BREAKS(corm)     # slot BREAKS

# }
# NOT RUN {
# }

Run the code above in your browser using DataCamp Workspace