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

tpweiss06/SparseInteractions

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 

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 stochastic Beverton-Holt models 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, a "Box" folder with scripts exploring different underlying model structures, a "Tau-CI" folder with model scripts exploring different fixed values of tau and credible interval levels to determine parameter inclusion in the final model, and a "VariableAlphaRanges" folder containing simulations and model fits for communities with different underlying competitive hierarchies.

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 are 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

Packages

No packages published