R/PRE_FATE.speciesClustering_step2.R
PRE_FATE.speciesClustering_step2.RdThis script is designed to obtain functional groups by : 1)
selecting the number of clusters to be kept from an object obtained with
the PRE_FATE.speciesClustering_step1 function ; 2) refining
these groups by identifying determinant species in each of them.
PRE_FATE.speciesClustering_step2(
clust.dendrograms,
no.clusters,
mat.species.DIST
)a dendrogram, or a list of dendrograms (one
for each GROUP value).
Such an object can be obtained
with the PRE_FATE.speciesClustering_step1 function.
an integer, or a vector of integer
(one for each GROUP value), with the number of clusters to be kept
a dist object, or a list of
dist objects (one for each GROUP value), corresponding to the
distance between each pair of species.
Such an object can be obtained
with the PRE_FATE.speciesDistance function.
A list containing one vector, one data.frame
with the following columns, and two ggplot2 objects :
the names of all determinant species
(determinant and non-determinant species)
PFGID of the plant functional group
(GROUP + ID.cluster)
GROUPname of data subset
ID.clustercluster number
speciesname of species
ID.speciesspecies number in each PFG
sp.mean.distspecies mean distance to other species of the same PFG
allSp.mean\(mean(\text{sp.mean.dist})\) within the PFG
allSp.min\(mean(\text{sp.mean.dist}) - 1.64 * sd(\text{sp.mean.dist})\) within the PFG
allSp.max\(mean(\text{sp.mean.dist}) + 1.64 * sd(\text{sp.mean.dist})\) within the PFG
DETERMINANTTRUE if determinant species, FALSE
otherwise
ggplot2 object, representing the distribution
of mean distances between species for each functional group
list of ggplot2 objects, representing the
PFG within the functional space
One PRE_FATE_CLUSTERING_STEP_2_distantSpecies_PCO.pdf file is created
containing two types of graphics :
to visualize in each PFG the distribution of mean distance of each species to other species, and non-determinant species which are outside the distribution
to visualize in each PFG the distribution of species, with and without non-determinant species
This function allows to obtain a classification of dominant
species into Plant Functional Groups (PFG), and the determinant
species based on these PFG.
What is the difference between dominant and
determinant species ?
Dominant species are species representative of an
environment or a studied area, in terms of number of releves or
abundance values. They can be found with the
PRE_FATE.selectDominant function of this package. These
dominant species are used to build PFG with the
PRE_FATE.speciesClustering_step1 function.
Once PFG are built, determinant species are defined as
refined subsets of dominant species within each PFG.
The process is
detailed below :
each dominant species is assigned to a PFG
within each PFG :
for each species, compute its mean distance to the other
species within the PFG (sp.mean.dist)
calculate the mean value of all these mean distances
(allSp.mean)
calculate the deviation values around this mean value
(allSp.min and allSp.max)
determinant species are the ones that are included between those deviation values
## Load example data
Champsaur_PFG = .loadData('Champsaur_PFG', 'RData')
## Species dissimilarity distances (niche overlap + traits distance)
tab.dist = list("Phanerophyte" = Champsaur_PFG$sp.DIST.P$mat.ALL
, "Chamaephyte" = Champsaur_PFG$sp.DIST.C$mat.ALL
, "Herbaceous" = Champsaur_PFG$sp.DIST.H$mat.ALL)
str(tab.dist)
as.matrix(tab.dist[[1]])[1:5, 1:5]
## Build dendrograms ---------------------------------------------------------
sp.CLUST = PRE_FATE.speciesClustering_step1(mat.species.DIST = tab.dist)
names(sp.CLUST)
## Number of clusters per group
plot(sp.CLUST$plot.clustNo)
no.clusters = c(4, 3, 8) ## Phanerophyte, Chamaephyte, Herbaceous
## Find determinant species ------------------------------------------------------------------
sp.DETERM = PRE_FATE.speciesClustering_step2(clust.dendrograms = sp.CLUST$clust.dendrograms
, no.clusters = no.clusters
, mat.species.DIST = tab.dist)
names(sp.DETERM)
str(sp.DETERM$determ.sp)
str(sp.DETERM$determ.all)
plot(sp.DETERM$plot.distance)
plot(sp.DETERM$plot.PCO$Chamaephyte)
plot(sp.DETERM$plot.PCO$Herbaceous)
plot(sp.DETERM$plot.PCO$Phanerophyte)