calcSynchMetrics: Calculate synchrony metrics

View source: R/calcSynchMetrics.R

calcSynchMetricsR Documentation

Calculate synchrony metrics

Description

This function calculates rolling window estimates of several metrics related to Thibaut and Connoly's (2013 Ecology Letters) analysis of aggregate variability, including the synchrony index (phi), mean temporal coefficient of variation among components (with weighting options), and mean pairwise correlation coefficients. It is dependent on the synchrony package. Contains multiple conditionals because computation can slows as the number of time series, time series length, or the number of trials increase.

Usage

calcSynchMetrics(
  synchList,
  windowSize = 10,
  synch = TRUE,
  compCV = TRUE,
  corr = FALSE,
  weight = TRUE
)

Arguments

synchList

The output list x_y_synchArrays.Rdata generated by recoverySimulator.R saved in the directory outputs/simData/.

windowSize

A numeric representing the size of the moving window.

synch

A logical (defaults to TRUE) specifying whether the synchrony metric phi should be calculated.

compCV

A logical (defaults to TRUE) specifying whether mean component CV should be calculated.

corr

A logical (defaults to FALSE) specifying whether mean pairwise correlation coefficients should be calculated (approximately equivalent to phi).

weight

A logical specifying whether compCV should be weighted by mean abundance of recruits.

Value

Returns a list containing three metrics (synchrony, component CV, and mean pairwise correlation coefficient) for four simulation output time series (recruits by brood year, log(R/S), SR model residuals, and spawner abundance). Each list element is a matrix with dimensions nYears x nTrials.

Examples

#relatively large number of trials so will take some time to run
calcSynchMetrics(synchList, windowSize = 10, synch = TRUE,
                 compCV = TRUE, corr = FALSE, weight = TRUE)


CamFreshwater/samSim documentation built on Sept. 25, 2023, 10:22 a.m.