Introduction to Cyclical Ecological Trajectory Analysis

Nicolas Djeghri, Anthony Sturbois, Miquel De Cáceres

LEMAR, VivArmor Nature, EMF-CREAF

Outline

  1. Aims and rationale of CETA
  2. CETA-specific conceptual and geometric elements
  3. Characterizing and comparing CETA trajectories
  4. Cyclical shifts

M.C. Escher - Dragon, 1952

1. Introduction

About Cyclical Ecological Trajectory Analysis

Aims and domain of application

Cyclical Ecological Trajectory Analysis (CETA) is an extension of the ETA framework to analyze cyclical ecological dynamics (seasons, day/night cycles…).

Rationale and general approach

  • CETA proceeds by sub-setting trajectories presenting cyclical dynamics into sub-trajectories of interest (Cycles, and fixed date trajectories).

  • CETA trajectories can then be described and compared as is done for other, non-CETA, trajectories.

  • Cycles specific geometries sometimes necessitate using dedicated metrics.

  • CETA also allows computing Cyclical Shifts, a multidimensional equivalent of the notion of phenological advances and delays.

Software

CETA is readily implemented within the ecotraj package (from version 1.0.0)

Package call

library(ecotraj)

2. CETA-specific conceptual and geometric elements

Conceptual and geometric elements

The most important elements of CETA are:

Element Notation Description
Cyclical trajectory \(T\) A cyclical trajectory is a trajectory presenting (or expected to present) cyclical dynamics.
Time \(t\) The position of a given ecological observation in a linear temporal axis (i.e. ‘when’ the assessment act occurred).
Date \(đ\) The position of a given ecological observation in a cyclical (or recurrent) temporal axis (e.g. a day of the year).
Cycle duration \(DUR_C\) The ecological entity whose dynamics are of interest. It can be an individual, a population, a community or an entire ecosystem

Together these elements allow defining CETA-specific trajectories:

Trajectory Notation Description
Cycles \(C\) A Cycle is a special-case of trajectory section obtained from \(T\) of duration \(DUR_C\).
Fixed date trajectories \(fdT\) Fixed date trajectories are the trajectories joining the ecological state of the same date \(đ\) in a given cyclical trajectory.

Defining some toy CETA trajectories

Start by defining one cyclical trajectory with three cycles:

times <- 0:30 #The sampling times of the time series
DurC <- 10 #The duration of the cycles (i.e. the periodicity of the time series)
dates <- times%%DurC #The dates associated to each times
site <- rep(c("A"),length(times)) #The sites associated to each times (only one)
trend <- 0.05 #A trend that will be applied to the cycles to make it more interesting
noise <- 0.05 #A noise term to make things less perfect

#Make cyclical data
x <- sin((times*2*pi)/DurC)+trend*times+rnorm(length(times),mean=0,sd=noise)
y <- cos((times*2*pi)/DurC)+rnorm(length(times),mean=0,sd=noise)
mat <- cbind(x,y)

#Express it as a distance matrix
dmat <- dist(mat)

#Finally make it a trajectory object:
x <- defineTrajectories(dmat, sites = site, times = times)

Visualization of the cylical trajectory

trajectoryPCoA(x,lwd = 2,length = 0.2)

Extracting and visualizing the cycles…

Extraction of cycles…

cycle <- extractCycles(x,cycleDuration = DurC)

…and visualization

cyclePCoA(cycle,lwd = 2,length = 0.2)

…and the fixed date trajectories

Extraction of fixed date trajectories…

fdtraj <- extractFixedDateTrajectories(x,
                                       cycleDuration = DurC,
                                       namesFixedDate = paste0("Date_",1:10))

…and visualization

fixedDateTrajectoryPCoA(fdtraj,lwd = 2,length = 0.2)

Object structure

Note that the structure of the ecotraj/CETA objects is very similar to what you already know.

names(cycle)
[1] "d"        "metadata"
names(fdtraj)
[1] "d"        "metadata"

But cycles have some specificities

head(cycle$metadata)
  sites cycles surveys times dates internal
1     A   A_C1       1     0     0     TRUE
2     A   A_C1       2     1     1     TRUE
3     A   A_C1       3     2     2     TRUE
4     A   A_C1       4     3     3     TRUE
5     A   A_C1       5     4     4     TRUE
6     A   A_C1       6     5     5     TRUE
head(fdtraj$metadata)
  sites          fdT surveys times dates
1     A A_fdT_Date_1       1     0     0
2     A A_fdT_Date_2       1     1     1
3     A A_fdT_Date_3       1     2     2
4     A A_fdT_Date_4       1     3     3
5     A A_fdT_Date_5       1     4     4
6     A A_fdT_Date_6       1     5     5

We won’t get into the detail now but you can check the CETA vignette for more details.

3. Characterizing and comparing CETA trajectories

Metrics for cycles

Cycle have particular geometries (they loop back on themselves) implying that some classical ETA metrics are not adapted and must be changed.

Directionality is replaced by convexity expressed as: \(CONV(C) = 360/\Sigma \theta\) with \(\theta\) the turning angle at each ecological state of cycle \(C\).

Note that \(\theta\) can be defined by ecological states outside the cycle of interest. This is why the ecotraj implementation uses the cyclical trajectory instead of the cycles:

cycleConvexity(x,DurC)#Note: the function takes x instead of cycle as input
     A_C1      A_C2      A_C3 
       NA 0.9585403 0.9914203 

Note

The function for the first cycle returns \(NA\), this is expected but can you find why?

ecotraj has a function dedicated to obtain multiple summary metrics for cycles:

cycleMetrics(x,DurC)#Again, the function takes x instead of cycle as input
  cycle site  n t_start t_end   length mean_speed mean_angle convexity
1  A_C1    A 10       0    10 6.150576  0.6150576         NA        NA
2  A_C2    A 10      10    20 6.348184  0.6348184   34.50745 0.9585403
3  A_C3    A 10      20    30 6.367124  0.6367124   35.69113 0.9914203
  internal_ss internal_variance
1    8.204586         0.9116207
2    9.324102         1.0360113
3    8.904950         0.9894389

Metrics for fixed date trajectories

Fixed trajectories are regular trajectories and can be studied with classical ecotraj functions:

trajectoryMetrics(fdtraj)
      trajectory site n t_start t_end duration    length mean_speed mean_angle
1   A_fdT_Date_1    A 4       0    30       30 1.5558385 0.05186128  11.692912
2   A_fdT_Date_2    A 3       1    21       20 0.9579659 0.04789829   6.172182
3   A_fdT_Date_3    A 3       2    22       20 0.9922778 0.04961389   4.031171
4   A_fdT_Date_4    A 3       3    23       20 1.0919315 0.05459657   3.418890
5   A_fdT_Date_5    A 3       4    24       20 1.0432865 0.05216432   7.321610
6   A_fdT_Date_6    A 3       5    25       20 1.0035067 0.05017533   2.450457
7   A_fdT_Date_7    A 3       6    26       20 1.0813742 0.05406871   5.816687
8   A_fdT_Date_8    A 3       7    27       20 0.9572468 0.04786234   9.163470
9   A_fdT_Date_9    A 3       8    28       20 1.0574979 0.05287490   7.410582
10 A_fdT_Date_10    A 3       9    29       20 1.1255629 0.05627814  22.491767
   directionality internal_ss internal_variance
1       0.9168891   1.2749043         0.4249681
2       0.9657101   0.4593012         0.2296506
3       0.9776046   0.5023756         0.2511878
4       0.9810062   0.6018079         0.3009040
5       0.9593244   0.5427662         0.2713831
6       0.9863863   0.5040020         0.2520010
7       0.9676851   0.5900056         0.2950028
8       0.9490918   0.4585892         0.2292946
9       0.9588301   0.5615709         0.2807855
10      0.8750457   0.6182712         0.3091356

4. Cyclical shifts

Computing cyclical shifts

A last, and perhaps important aspect of CETA are cyclical shifts. They can be understood as multidimensional analogues of the phenological concept of advances and delays.

The function cycleShifts will compute by default all possible cyclical shifts in a given cyclical trajectory:

cycleShifts(x,DurC)#Note that, again, we give x as input.
   sites dateCS timeCS timeRef timeScale cyclicalShift
1      A      0     20      10        10   -0.08747012
2      A      1     21      11        10    0.02880539
3      A      2     22      12        10   -0.10060345
4      A      3     23      13        10    0.05399082
5      A      4     24      14        10    0.00000000
6      A      5     15       5        10    0.02622582
7      A      5     25       5        20    0.00000000
8      A      5     25      15        10   -0.00144740
9      A      6     16       6        10    0.01129986
10     A      7     17       7        10    0.09172627
11     A      8     18       8        10   -0.02003257
12     A      9     19       9        10    0.18721474

Summary of the CETA workflow

M.C. Escher - Dragon, 1952