Last updated: 2025-05-25

Checks: 7 0

Knit directory: SaniVult/

This reproducible R Markdown analysis was created with workflowr (version 1.7.1). The Checks tab describes the reproducibility checks that were applied when the results were created. The Past versions tab lists the development history.


Great! Since the R Markdown file has been committed to the Git repository, you know the exact version of the code that produced these results.

Great job! The global environment was empty. Objects defined in the global environment can affect the analysis in your R Markdown file in unknown ways. For reproduciblity it’s best to always run the code in an empty environment.

The command set.seed(666) was run prior to running the code in the R Markdown file. Setting a seed ensures that any results that rely on randomness, e.g. subsampling or permutations, are reproducible.

Great job! Recording the operating system, R version, and package versions is critical for reproducibility.

Nice! There were no cached chunks for this analysis, so you can be confident that you successfully produced the results during this run.

Great job! Using relative paths to the files within your workflowr project makes it easier to run your code on other machines.

Great! You are using Git for version control. Tracking code development and connecting the code version to the results is critical for reproducibility.

The results in this page were generated with repository version b94bdec. See the Past versions tab to see a history of the changes made to the R Markdown and HTML files.

Note that you need to be careful to ensure that all relevant files for the analysis have been committed to Git prior to generating the results (you can use wflow_publish or wflow_git_commit). workflowr only checks the R Markdown file, but you know if there are other scripts or data files that it depends on. Below is the status of the Git repository when the results were generated:


Ignored files:
    Ignored:    .Rhistory
    Ignored:    .Rproj.user/
    Ignored:    ms/Almaraz et al. 2022 Ecol. Appl.pdf
    Ignored:    pipeline.R

Unstaged changes:
    Modified:   analysis/_site.yml

Note that any generated files, e.g. HTML, png, CSS, etc., are not included in this status report because it is ok for generated content to have uncommitted changes.


These are the previous versions of the repository in which changes were made to the R Markdown (analysis/Reproduce.Rmd) and HTML (docs/Reproduce.html) files. If you’ve configured a remote Git repository (see ?wflow_git_remote), click on the hyperlinks in the table below to view the files as they were in that past version.

File Version Author Date Message
html b94bdec Pablo Almaraz 2025-05-25 Build site.
html 9611ea2 Pablo Almaraz 2025-05-25 Build site.
html d24607c Pablo Almaraz 2025-05-25 Build site.
html 01e2d83 Pablo Almaraz 2025-05-25 Build site.
html 9ea8b52 Pablo Almaraz 2025-05-25 Build site.
html 3a8bc70 Pablo Almaraz 2025-05-25 Add favicon RELab
html 2c5f3ab Pablo Almaraz 2025-05-25 Build site.
html d9a4b8e Pablo Almaraz 2025-05-25 Build site.
html 9c32eb5 Pablo Almaraz 2025-05-25 Build site.
Rmd a6c7740 Pablo Almaraz 2025-05-25 Update my new project

Introduction

Please look the README file for further details on reproducing the results of this project. Note that the following chunks are supposed to run sequentially.

Load libraries

Check that the pacman package is installed. Alternatively, note that you can use the checkpoint package to build an environment identical to the date of completion of the present project. Look at the Session information tab below. After pacman is installed, the p_load function will check that the selected packages are installed. If they are, it will load them; if not, it will first install them and then load them.

# if (!require(checkpoint)) install.packages('checkpoint')
# checkpoint::checkpoint("2021-11-18")

if (!require(pacman)) install.packages('pacman')
Cargando paquete requerido: pacman
pacman::p_load(tidyverse,runjags,coda,ggmcmc,xtable,data.table,viridis,ggsci,patchwork,mvtnorm,truncnorm,grateful)

Load utilities and functions

source("code/utilities.R")

Conduct the analyes

This will run the analyses in an order temporal sequence.

# All periods ####

for(TimePeriod in c("PreBSE","BSE","PostBSE")){

  # Loada data: ####
  load_data(TimePeriod)

  # Find the equilibrium population and the variance of state variables: ####
  find_equilibrium_population(TimePeriod,
                              adapt = 10000,
                              burnin = 100000,
                              sample = 1000,
                              thin = 100)

  # Fit the SSSSDDDM: ####
  fit_S4D3M(TimePeriod,
               n.chains = 3,
               adapt = 10000,
               burnin = 500000,
               sample = 1000,
               thin = 500,
               mcmc_diagnostics_plots = TRUE,
               PPC_simulations = TRUE,
               N_PPC_Fits = 100,
               burnin_ppc = 100000,
               sample_ppc = 1000,
               thin_ppc = 100)

  }

Produce the figures

The call to this function will produce all the figures in the paper

Figures()

Compile the manuscript

Once the analyses are completed and the figures produced, this shell call to the Makefile will compile and open the manuscript and related supplementary material:

make compile

sessionInfo()
R version 4.5.0 (2025-04-11)
Platform: x86_64-pc-linux-gnu
Running under: Ubuntu 24.04.2 LTS

Matrix products: default
BLAS:   /usr/lib/x86_64-linux-gnu/openblas-pthread/libblas.so.3 
LAPACK: /usr/lib/x86_64-linux-gnu/openblas-pthread/libopenblasp-r0.3.26.so;  LAPACK version 3.12.0

locale:
 [1] LC_CTYPE=es_ES.UTF-8       LC_NUMERIC=C              
 [3] LC_TIME=es_ES.UTF-8        LC_COLLATE=es_ES.UTF-8    
 [5] LC_MONETARY=es_ES.UTF-8    LC_MESSAGES=es_ES.UTF-8   
 [7] LC_PAPER=es_ES.UTF-8       LC_NAME=C                 
 [9] LC_ADDRESS=C               LC_TELEPHONE=C            
[11] LC_MEASUREMENT=es_ES.UTF-8 LC_IDENTIFICATION=C       

time zone: Europe/Madrid
tzcode source: system (glibc)

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
 [1] grateful_0.2.12   truncnorm_1.0-9   mvtnorm_1.3-3     patchwork_1.3.0  
 [5] ggsci_3.2.0       viridis_0.6.5     viridisLite_0.4.2 data.table_1.17.2
 [9] xtable_1.8-4      ggmcmc_1.5.1.1    coda_0.19-4.1     runjags_2.2.2-5  
[13] lubridate_1.9.4   forcats_1.0.0     stringr_1.5.1     dplyr_1.1.4      
[17] purrr_1.0.4       readr_2.1.5       tidyr_1.3.1       tibble_3.2.1     
[21] ggplot2_3.5.2     tidyverse_2.0.0   pacman_0.5.1      workflowr_1.7.1  

loaded via a namespace (and not attached):
 [1] gtable_0.3.6       xfun_0.52          bslib_0.9.0        processx_3.8.6    
 [5] GGally_2.2.1       lattice_0.22-7     callr_3.7.6        tzdb_0.5.0        
 [9] vctrs_0.6.5        tools_4.5.0        ps_1.9.1           generics_0.1.4    
[13] parallel_4.5.0     pkgconfig_2.0.3    RColorBrewer_1.1-3 lifecycle_1.0.4   
[17] compiler_4.5.0     farver_2.1.2       git2r_0.36.2       getPass_0.2-4     
[21] httpuv_1.6.16      htmltools_0.5.8.1  sass_0.4.10        yaml_2.3.10       
[25] later_1.4.2        pillar_1.10.2      jquerylib_0.1.4    whisker_0.4.1     
[29] cachem_1.1.0       ggstats_0.9.0      tidyselect_1.2.1   digest_0.6.37     
[33] stringi_1.8.4      rprojroot_2.0.4    fastmap_1.2.0      grid_4.5.0        
[37] cli_3.6.5          magrittr_2.0.3     dichromat_2.0-0.1  withr_3.0.2       
[41] scales_1.4.0       promises_1.3.2     timechange_0.3.0   rmarkdown_2.29.1  
[45] httr_1.4.7         gridExtra_2.3      hms_1.1.3          evaluate_1.0.3    
[49] knitr_1.50         rlang_1.1.6        Rcpp_1.0.14        glue_1.8.0        
[53] rstudioapi_0.17.1  jsonlite_2.0.0     R6_2.6.1           plyr_1.8.9        
[57] fs_1.6.6