Introduction

This document demonstrates the dynamic stability analysis, using the Maizuru Bay fish community as an example dataset (Ushio et al. 2018).

First, we load the packages that we are going to use, and set the seed (for the random number generation associated with creating surrogate data):

library(portalDS)
library(dplyr)
library(ggplot2)

set.seed(42)

The Data

First, we load in the data and take a look at the time series for the fish populations.

Dynamic Stability Calculations

Perform the dynamic stability analysis for the maizuru system. The steps involved in the full analysis are:

1a. Run simplex projection on each time series to identify the optimal embedding dimension 1b. Generate surrogate time series (here, using the twin-surrogate method)

  1. Run ccm on each pairwise interaction, including the surrogate data, and using the embedding dimension identified previously. Since this takes a while to run, we’ve commented out the actual code, and instead load a pre-generated results file.
  1. identify the significant interactions by comparing the CCM results for the real time series against the comparable calculations for the surrogate data
  1. run S-map models for each time series, using the appropriate number of lags, and including the important interacting variables (we rescale the time series to each have mean = 0, variance = 1)
  1. extract out the s-map coefficients from the models and assemble matrices for the system
  1. perform eigen-decomposition on the s-map coefficient matrices

Figures

Interaction Network

First, we look at the interaction network. plot_network has a default layout and palette, but we can specify both. Here, we re-use the viridis color scheme used to plot the time series.

maizuru_network <- plot_network(ccm_links, palette = maizuru_palette)

Note that the output of plot_network is a list. The plot element is the ggraph object, which we can plot:

print(maizuru_network$plot)

The remaining components allow us to plot a subset of the network, while keeping the same layout of nodes and the associated colors.

Eigenvalues

Dynamic stability (Ushio et al. 2018) is defined as the time-varying property that is the largest (absolute value) eigenvalue. With the results of our analysis, we can plot this as a time series, applying the same x-axis transformation as for the population time series earlier:

Note that plot_eigenvalues has a number of additional parameters, which allow us to plot multiple eigenvalues simultaneously, or identify when the dominant eigenvalue is complex (red points):

Eigenvectors

Just as with the eigenvalues, we can plot the dominant eigenvector(s) as it changes in time. Note that there are only 13 dimensions here, because we drop the 2 species that share no links with the others.

References

Ushio, Masayuki, Chih-hao Hsieh, Reiji Masuda, Ethan R Deyle, Hao Ye, Chun-Wei Chang, George Sugihara, and Michio Kondoh. 2018. “Fluctuating Interaction Network and Time-Varying Stability of a Natural Fish Community.” Nature 554 (7692): 360–63. https://doi.org/10.1038/nature25504.