Hao Ye 2019-11-14
This report documents applying the dynamic stability analysis to the rocky intertidal system reported on in (Benincà et al. 2015)
First, some setup for the environment:
library(portalDS)
library(dplyr)
library(ggplot2)
set.seed(42)
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>"
)
We use the interpolated data, as these methods also require regular sampling in time.
block <- readxl::read_excel(here::here("inst/extdata/pnas.1421968112.sd01.xlsx"),
sheet = 2,
col_types = c("text", "numeric", "numeric", "numeric", "numeric", "guess", "guess", "guess")) %>%
mutate(Date = as.Date(as.numeric(Date) - 366, origin = "0000-12-31")) %>%
select(1:5)
#> New names:
#> * `` -> ...6
#> * `` -> ...7
#> * `` -> ...8
names(block) <- c("date", "barnacles", "crustose_algae", "mussels", "bare_rock")
We do not go through the full analysis here. Instead, see the Maizuru Dynamic Stability vignette or (eventual methdos write-up).
results_file <- here::here("output/rocky_intertidal_ds_results.RDS")
results <- compute_dynamic_stability(block, results_file, id_var = "date")
str(results, max.level = 1)
#> List of 11
#> $ block :Classes 'tbl_df', 'tbl' and 'data.frame': 251 obs. of 5 variables:
#> $ simplex_results :Classes 'tbl_df', 'tbl' and 'data.frame': 4 obs. of 5 variables:
#> $ ccm_results :'data.frame': 32160 obs. of 9 variables:
#> $ ccm_links :Classes 'tbl_df', 'tbl' and 'data.frame': 6 obs. of 5 variables:
#> $ smap_coeffs :List of 4
#> $ smap_matrices :List of 251
#> $ eigenvalues :List of 251
#> $ eigenvectors :List of 251
#> $ svd_decomp :List of 3
#> $ volume_contraction: Named num [1:251] NA NA 1.74 1.72 1.71 ...
#> ..- attr(*, "names")= chr [1:251] "1987-10-23" "1987-11-22" "1987-12-22" "1988-01-21" ...
#> $ total_variance : Named num [1:251] NA NA 4.73 4.72 4.72 ...
#> ..- attr(*, "names")= chr [1:251] "1987-10-23" "1987-11-22" "1987-12-22" "1988-01-21" ...
plot_time_series(results$block, time_column = "date")
plot_eigenvalues(results$eigenvalues,
num_values = 3)
plot_eigenvectors(results$eigenvectors)
plot_svd_values(results$svd_decomp$d,
num_values = 3)
plot_svd_vectors(results$svd_decomp$u)
plot_volume_contraction(results$volume_contraction)
#> Warning: Removed 3 rows containing missing values (geom_path).
plot_total_variance(results$total_variance)
#> Warning: Removed 3 rows containing missing values (geom_path).
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.