EcoGenetics (version 1.2.1-6)

eco.mantel: Mantel and partial Mantel tests, with truncation option

Description

Mantel test or Partial Mantel test for distance matrices d1 and d2, or partial Mantel test for d1 and d2, conditioned on the matrix dc. The test can be performed for truncated distances (Legendre et al. 2015) or for a particular direction (Falsetti and Sokal, 1993) using a weights object generated with eco.bearing.

Usage

eco.mantel(
  d1,
  d2,
  dc = NULL,
  con = NULL,
  thres = NULL,
  truncMat = c("d2", "d1", "dc"),
  method = c("pearson", "spearman", "kendall"),
  nsim = 99,
  alternative = c("auto", "two.sided", "less", "greater"),
  plotit = TRUE,
  ...
)

Arguments

d1

Distance matrix.

d2

Distance matrix.

dc

Distance matrix (optional).

con

Binary eco.weight object used for truncation, or a weights object obtained with eco.bearing.

thres

Threshold distance used for truncation. Distances above the threshold are set as 4 times the threshold. If thres is null, and con is not null, the parameter set to the maximum distance observed in d2.

truncMat

Matrix used for truncation (default = d2)

method

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

nsim

Number of Monte-Carlo simulations.

alternative

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

plotit

Plot a histogram of the simulations?

...

Additional arguments passed to cor.

Value

An object of class "eco.gsa" with the following slots:

> METHOD method used in the analysis

> OBS observed value

> EXP expect value

> PVAL P-value

> ALTER alternative hypotesis

> NSIM number of simulations

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

Falsetti A., and Sokal R. 1993. Genetic structure of human populations in the British Isles. Annals of Human Biology 20: 215-229.

Legendre P. 2000. Comparison of permutation methods for the partial correlation and partial Mantel tests. Journal of Statistical Computation and Simulation, 67: 37-73.

Legendre P., and M. Fortin. 2010. Comparison of the Mantel test and alternative approaches for detecting complex multivariate relationships in the spatial analysis of genetic data. Molecular Ecology Resources, 10: 831-844.

Mantel N. 1967. The detection of disease clustering and a generalized regression approach. Cancer research, 27: 209-220.

Smouse P. Long and R. Sokal. 1986. Multiple regression and correlation extensions of the Mantel test of matrix correspondence. Systematic zoology, 627-632.

Examples

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

### Ordinary Mantel test ###
eco.mantel(d1 = dist(eco[["P"]]), d2 = dist(eco[["E"]]), nsim = 99)  

### Partial Mantel test ###
pm <- eco.mantel(d1 = dist(eco[["P"]]), d2 = dist(eco[["E"]]), 
dc = dist(eco[["XY"]]), nsim = 99)                               

### Truncated Mantel test ###
# checking threshold in a correlogram:
corm <- eco.cormantel(M = dist(eco[["P"]]), XY = eco[["XY"]], nsim = 99)
eco.plotCorrelog(corm)
# Correlation is around 0 when distance between points is > 5

# creating a weights object for truncation
con <- eco.weight(eco@XY, method="circle", d2=5)
# compute a truncated mantel test
eco.mantel(dist(eco[["P"]]), dist(eco[["XY"]]), con=con)

### Directional Mantel test ###
# analyzing with a Mantel test, in a direction of 35 degrees counterclockwise from E.
con2 <- eco.bearing(XY = eco[["XY"]], theta = 37)
eco.mantel(dist(eco[["P"]]), dist(eco[["XY"]]), con = con2)

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

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

ecoslot.OBS(pm)     # slot OBS (observed value)
ecoslot.PVAL(pm)    # slot PVAL (P-value) 

# }
# NOT RUN {
# }

Run the code above in your browser using DataCamp Workspace