Skip to content

Use techniques developed for sparse linear modeling in a Bayesian framework to fit community ecology models to high diversity data

Notifications You must be signed in to change notification settings

NWTlter/SparseInteractions

 
 

Repository files navigation

SparseInteractions

This repository contains the R and stan scripts necessary to recreate the analyses presented in the manuscript "Disentangling key species interactions in diverse and heterogeneous communities: A Bayesian sparse modeling approach". It is organized into two folders. "BH_simulations" holds all the scripts and simulated .csv files necessary for testing the models using data simulated according to a stochastic Beverton-Holt model of community dynamics. "Empirical" holds the data and scripts necessary to recreate the analyses on Waitzia acuminata and Arctotheca calendula from the Bendering and Perenjori nature reserves in southwest Australia. The "BH_simulations" folder is further subdivided into a "Main" folder with the scripts used for the analysis in the main paper, and "Box" with scripts for variations, including constant or environmentally varying alpha (species interactions) parameters and monotonic or optimum functions defining lambda (intrinsic growth rate).

Most R scripts in the repository save output and load input generated from previous scripts. This is necessary as some of the Bayesian models take long enough to run that performing all model fits and subsequent analyses in a single script is untenable. To minimize problems encountered when running these scripts on different local computers, we use the "here" package to navigate within the file structure used in the repository. If attempting to run the analyses presented in this repository, we therefore recommend cloning the entire repository to maintain its file structure.

If, however, users are simply interested in modifying the sparse modeling approach we present for their own data, we do not recommend cloning the entire repository as it has many files necessary for our simulations and analysis that will not be relevant to users wishing to apply the model to different data. Instead, we suggest users copy the ModelFits.R, BH_FH_Preliminary.stan, and BH_Final.stan files from the empirical folder to modify for their needs. These three files are all that is necessary to implement a version of the sparse modeling approach, though they will need to be modified for use with other data or underlying model structures (e.g. Ricker or Lotka-Volterra instead of Beverton-Holt). As we intend for these files to be the primary ones used in modifying our approach for other datasets, these are also the most heavily commented versions of the model fitting files. Other model fitting files like those used for the simulations are more sparsely commented rather than repeating the same information as presented in the manuscript and for the empirical files.

About

Use techniques developed for sparse linear modeling in a Bayesian framework to fit community ecology models to high diversity data

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • R 90.1%
  • Stan 8.3%
  • Shell 1.6%