trajectoryplots {ecotraj}R Documentation

Trajectory plots

Description

Set of plotting functions for Ecological Trajectory Analysis:

Usage

trajectoryPCoA(
  d,
  sites,
  surveys = NULL,
  selection = NULL,
  traj.colors = NULL,
  axes = c(1, 2),
  survey.labels = FALSE,
  ...
)

trajectoryPlot(
  x,
  sites,
  surveys = NULL,
  selection = NULL,
  traj.colors = NULL,
  axes = c(1, 2),
  survey.labels = FALSE,
  ...
)

Arguments

d

A symmetric matrix or an object of class dist containing the distance values between pairs of ecosystem states (see details).

sites

A vector indicating the site corresponding to each ecosystem state.

surveys

A vector indicating the survey corresponding to each ecosystem state (only necessary when surveys are not in order).

selection

A character vector of sites, a numeric vector of site indices or logical vector of the same length as sites, indicating a subset of site trajectories to be selected.

traj.colors

A vector of colors (one per site). If selection != NULL the length of the color vector should be equal to the number of sites selected.

axes

The pair of principal coordinates to be plotted.

survey.labels

A boolean flag to indicate whether surveys should be plotted as text next to arrow endpoints

...

Additional parameters for function arrows.

x

A data.frame or matrix where rows are ecosystem states and columns are coordinates in an arbitrary space

Details

Details of calculations are given in De Cáceres et al (2019). The input distance matrix d should ideally be metric. That is, all subsets of distance triplets should fulfill the triangle inequality (see function is.metric). All CTA functions that require metricity include a parameter 'add', which by default is TRUE, meaning that whenever the triangle inequality is broken the minimum constant required to fulfill it is added to the three distances. If such local (an hence, inconsistent across triplets) corrections are not desired, users should find another way modify d to achieve metricity, such as PCoA, metric MDS or non-metric MDS (see CTA vignette). If parameter 'add' is set to FALSE and problems of triangle inequality exist, CTA functions may provide missing values in some cases where they should not.

The resemblance between trajectories is done by adapting concepts and procedures used for the analysis of trajectories in space (i.e. movement data) (Besse et al. 2016).

Value

Function trajectoryPCoA returns the result of calling cmdscale.

Author(s)

Miquel De Cáceres, CREAF

Anthony Sturbois, Vivarmor nature, Réserve Naturelle nationale de la Baie de Saint-Brieuc

References

Besse, P., Guillouet, B., Loubes, J.-M. & François, R. (2016). Review and perspective for distance based trajectory clustering. IEEE Trans. Intell. Transp. Syst., 17, 3306–3317.

De Cáceres M, Coll L, Legendre P, Allen RB, Wiser SK, Fortin MJ, Condit R & Hubbell S. (2019). Trajectory analysis in community ecology. Ecological Monographs 89, e01350.

Anderson (2017). Permutational Multivariate Analysis of Variance (PERMANOVA). Wiley StatsRef: Statistics Reference Online. 1-15. Article ID: stat07841.

See Also

trajectorymetrics, trajectoryutils, cmdscale

Examples

#Description of sites and surveys
sites = c(1,1,1,2,2,2)
surveys=c(1,2,3,1,2,3)
  
#Raw data table
xy<-matrix(0, nrow=6, ncol=2)
xy[2,2]<-1
xy[3,2]<-2
xy[4:6,1] <- 0.5
xy[4:6,2] <- xy[1:3,2]
xy[6,1]<-1
  
#Draw trajectories
trajectoryPlot(xy, sites, surveys, 
               traj.colors = c("black","red"), lwd = 2)

  
#Should give the same results if surveys are not in order 
#(here we switch surveys for site 2)
temp = xy[5,]
xy[5,] = xy[6,]
xy[6,] = temp
surveys[5] = 3
surveys[6] = 2
  
trajectoryPlot(xy, sites, surveys, 
               traj.colors = c("black","red"), lwd = 2)   
 

[Package ecotraj version 0.1.1 Index]