Metrics of trajectory deviation with respect to a reference trajectory
Source:R/deviation_metrics.R
deviation_metrics.Rd
Set of metrics to analyze the deviation of disturbed trajectories from an ecological dynamic regime (EDR) considering a representative trajectory as the reference. These metrics include the resistance to the disturbance, amplitude, recovery, and net change.
Usage
resistance(
d,
trajectories,
states,
disturbed_trajectories,
disturbed_states,
predisturbed_states = disturbed_states - 1
)
amplitude(
d,
trajectories,
states,
disturbed_trajectories,
disturbed_states,
predisturbed_states = disturbed_states - 1,
reference,
index = c("absolute", "relative"),
method = "nearest_state"
)
recovery(
d,
trajectories,
states,
disturbed_trajectories,
disturbed_states,
reference,
index = c("absolute", "relative"),
method = "nearest_state"
)
net_change(
d,
trajectories,
states,
disturbed_trajectories,
disturbed_states,
predisturbed_states = disturbed_states - 1,
reference,
index = c("absolute", "relative"),
method = "nearest_state"
)
Arguments
- d
Either a symmetric matrix or an object of class
dist
containing the dissimilarities between each pair of states.- trajectories
Vector indicating the trajectory or site to which each state in
d
belongs.- states
Vector of integers indicating the order of the states in
d
for each trajectory.- disturbed_trajectories
Vector of the same class as
trajectories
indicating the identifier of the disturbed trajectories.- disturbed_states
Vector of integers included in
states
indicating the first state after the release of the disturbance for each value indisturbed_trajectories
.- predisturbed_states
Vector of integers included in
states
indicating the last undisturbed state of eachdisturbed_trajectories
. The previous states todisturbed_states
are considered by default.- reference
Object of class
RETRA
indicating the representative trajectory taken as the reference to compute the amplitude, recovery, and net_change of the disturbed trajectories (see Details).- index
Method to calculate amplitude, recovery, or net change (
"absolute"
,"relative"
; see Details).- method
Method to calculate the distance between the
disturbed_states
orpredisturbed_states
and thereference
trajectory. One of"nearest_state"
,"projection"
or"mixed"
(see Details).
Value
resistance()
returns a data frame of two columns indicating the resistance value (Rt
) for eachdisturbed_trajectory
.amplitude()
returns a data frame of three columns indicating the amplitude value (A_abs
;A_rel
) for eachdisturbed_trajectory
andreference
. Ifindex = c("absolute", "relative")
, both values are included in a data frame of four columns.recovery()
returns a data frame of four columns indicating the recovery value (Rc_abs
;Rc_rel
) for eachdisturbed_trajectory
, post-disturbance state (state
) andreference
. Ifindex = c("absolute", "relative")
, both values are included in a data frame of five columns.net_change
returns a data frame of four columns indicating the net change value (NC_abs
;NC_rel
) for eachdisturbed_trajectory
, post-disturbance state (state
), andreference
. Ifindex = c("absolute", "relative")
, both values are included in a data frame of five columns.
Details
Resistance (resistance()
)
Resistance captures the immediate impact of the disturbance as a function of the changes in the state variables (Sánchez-Pinillos et al., 2019).
\( Rt = 1 - d_{pre,dist} \)
Amplitude (amplitude()
)
Amplitude indicates the direction in which the system is displaced during the
disturbance in relation to the reference
(Sánchez-Pinillos et al., 2024).
Positive values indicate that the disturbance displaces the system towards the
boundaries of the dynamic regime. Negative values indicate that the disturbance
displaces the system towards the representative trajectory.
Two indices can be calculated:
If index = "absolute"
,
\( A = d_{dist,RT} - d_{pre,RT} \)
If index = "relative"
,
\( A = \frac{d_{dist,RT} - d_{pre,RT}}{d_{pre,dist}} \)
Recovery (recovery()
)
Recovery quantifies the ability of the system to evolve towards the reference
following the relief of the disturbance (if positive) or move in the direction
of the boundaries of the dynamic regime (if negative) (Sánchez-Pinillos et al.,
2024).
Two indices can be calculated:
If index = "absolute"
,
\( Rc = d_{dist,RT} - d_{post,RT} \)
If index = "relative"
,
\( Rc = \frac{d_{dist,RT} - d_{post,RT}}{d_{dist,post}} \)
Net change (net_change()
)
Net change quantifies the proximity of the system to the reference
relative to
the pre-disturbed state (Sánchez-Pinillos et al., 2024). Positive values indicate
that the system eventually evolves towards the boundaries of the dynamic regime.
Negative values indicate that the system eventually evolves towards the
reference
.
Two indices can be calculated:
If index = "absolute"
,
\( NC = d_{post,RT} - d_{pre,RT} \)
If index = "relative"
,
\( NC = \frac{d_{post,RT} - d_{pre,RT}}{d_{pre,post}} \)
In all cases:
\(d_{pre,RT}\) is the dissimilarity between the
predisturbed_states
and thereference
.\(d_{dist,RT}\) is the dissimilarity between the
disturbed_states
and thereference
.\(d_{post,RT}\) is the dissimilarity between the states after
disturbed_states
and thereference
.\(d_{pre,dist}\) is the dissimilarity contained in
d
between thepredisturbed_states
and thedisturbed_states
.\(d_{dist,post}\) is the dissimilarity contained in
d
between thedisturbed_states
and the post-disturbed states.\(d_{pre,post}\) is the dissimilarity contained in
d
between thepredisturbed_states
and the post-disturbed states.
\(d_{pre,RT}\), \(d_{dist,RT}\), and \(d_{post,RT}\) are calculated using
the function state_to_trajectory()
by three different methods:
If
method = "nearest_state"
, \(d_{pre,RT}\), \(d_{dist,RT}\), and \(d_{post,RT}\) are calculated as the dissimilarity between the pre-disturbance, disturbed, or post-disturbance states and their nearest state in thereference
.If
method = "projection"
, \(d_{pre,RT}\), \(d_{dist,RT}\), and \(d_{post,RT}\) are calculated as the dissimilarity between the pre-disturbance, disturbed, or post-disturbance states and their projection onto thereference
.If
method = "mixed"
, \(d_{pre,RT}\), \(d_{dist,RT}\), and \(d_{post,RT}\) are calculated in the same way thanmethod = "projection"
whenever the pre-disturbance, disturbed and post-disturbance states can be projected onto any segment of thereference
. Otherwise, \(d_{pre,RT}\), \(d_{dist,RT}\), and \(d_{post,RT}\) are calculated using the nearest state of thereference
.
References
Sánchez-Pinillos, M., Leduc, A., Ameztegui, A., Kneeshaw, D., Lloret, F., & Coll, L. (2019). Resistance, resilience or change: Post-disturbance dynamics of boreal forests after insect outbreaks. Ecosystems 22, 1886-1901 https://doi.org/10.1007/s10021-019-00378-6
Sánchez-Pinillos, M., Dakos, V., & Kéfi, S. (2024). Ecological dynamic regimes: A key concept for assessing ecological resilience. Biological Conservation 289, 110409 https://doi.org/10.1016/j.biocon.2023.110409
See also
retra_edr()
to identify representative trajectories in an ecological dynamic
regime.
define_retra()
to generate an object of classRETRA
.
state_to_trajectory()
to calculate the position of a state with respect to
a trajectory.
Examples
# Identify the representative trajectories of the EDR from undisturbed trajectories
RT <- retra_edr(d = EDR_data$EDR3$state_dissim,
trajectories = EDR_data$EDR3$abundance$traj,
states = as.integer(EDR_data$EDR3$abundance$state),
minSegs = 5)
# Abundance matrix including disturbed and undisturbed trajectories
abundance <- rbind(EDR_data$EDR3$abundance,
EDR_data$EDR3_disturbed$abundance, fill = TRUE)
# State dissimilarities (Bray-Curtis) for disturbed and undisturbed trajectories
d <- vegan::vegdist(abundance[, paste0("sp", 1:12)], method = "bray")
# Resistance
Rt <- resistance(d = d, trajectories = abundance$traj, states = abundance$state,
disturbed_trajectories = unique(abundance[!is.na(disturbed_states)]$traj),
disturbed_states = abundance[disturbed_states == 1]$state)
# Amplitude
A <- amplitude(d = d, trajectories = abundance$traj, states = abundance$state,
disturbed_trajectories = unique(abundance[!is.na(disturbed_states)]$traj),
disturbed_states = abundance[disturbed_states == 1]$state, reference = RT)
# Recovery
Rc <- recovery(d = d, trajectories = abundance$traj, states = abundance$state,
disturbed_trajectories = unique(abundance[!is.na(disturbed_states)]$traj),
disturbed_states = abundance[disturbed_states == 1]$state, reference = RT)
# Net change
NC <- net_change(d = d, trajectories = abundance$traj, states = abundance$state,
disturbed_trajectories = unique(abundance[!is.na(disturbed_states)]$traj),
disturbed_states = abundance[disturbed_states == 1]$state, reference = RT)