This script is designed to create a distance matrix between species, based on co-occurrence of species.

PRE_FATE.speciesDistanceOverlap(mat.overlap.option, mat.overlap.object)

Arguments

mat.overlap.option

a string corresponding to the way to calculate the distance between species based on niche overlap (either PCA or raster, see Details)

mat.overlap.object

two options, depending on the value of mat.overlap.option :

  • (PCA option) a list with 2 elements :

    tab.dom.PA

    a matrix or data.frame with sites in rows and species in columns, containing either NA, 0 or 1 (see PRE_FATE.selectDominant)

    tab.env

    a matrix or data.frame with sites in rows and environmental variables in columns

  • (raster option) a data.frame with 2 columns :

    species

    the ID of each studied species

    raster

    path to raster file with species distribution

Value

A matrix containing overlap distances between each pair of species, calculated as 1 - Schoeners D.

Details

This function allows to obtain a distance matrix between species (1 - Schoeners D), based on niche overlap information :

  • If PCA option is selected, the degree of niche overlap will be computed using the ecospat.niche.overlap.

  • If raster option is selected, the degree of niche overlap will be computed using the niche.overlap.


See also

ecospat.niche.overlap, niche.overlap

Author

Maya Guéguen

Examples


## Load example data
Champsaur_PFG = .loadData('Champsaur_PFG', 'RData')

## Prepare sites x species table
## Add absences in community sites
sites = Champsaur_PFG$sp.observations
tab.dom.PA = Champsaur_PFG$tab.dom.PA
for (si in sites$sites[which(sites$TYPE == "COMMUNITY")])
{
  ind = which(rownames(tab.dom.PA) == si)
  tab.dom.PA[ind, which(is.na(tab.dom.PA[ind, ]))] = 0
}

## Prepare environmental table
tab.env = Champsaur_PFG$tab.env

## Calculate niche overlap distances -----------------------------------------
list.over = list(tab.dom.PA[, 1:10], tab.env)
DIST.overlap = PRE_FATE.speciesDistanceOverlap(mat.overlap.option = "PCA"
                                               , mat.overlap.object = list.over)
(DIST.overlap[1:5, 1:5])