Skip to content

Code for fitting time-series models that account for shark life-history traits (Brown and Roff 2019)

License

Notifications You must be signed in to change notification settings

cbrown5/shark-pop-trends

Repository files navigation

Code for "Life-history traits inform population trends when assessing the conservation status of a declining tiger shark population"

Citation: Brown CJ, Roff G. Life-history traits inform population trends when assessing the conservation status of a declining tiger shark population. Biological Conservation. 2019 Nov 1;239:108230. (pre-print on biorxiv)

The paper fits Bayesian generalized additive models (using a random walk) and shows how we can relate the variance of the random walk (which controls its 'wiggiliness') to shark life-history traits.

This repo includes code for the simulation study described in the above paper, core functions for fitting Bayesian GAMMs to the shark population data and a script that fits the models.

Unfortunately we do not have a license to provide the data here, more details on the data are in the paper. The simulation-study script is stand-alone, and will run without any data (it generates it's own).

Overview of the method

Key scripts

sharks-functions.R

Has functions to fit the GAMMs to spatio-temporal population data.

simulation-study.R

Simulates data and fits models to it. This will run without any additional data files

sharks-effects-of-priors-V4-AR1.R

Fits the AR1 model described in the paper. The model fitting is actually done within a function (see sharks-functions.R). This script loops over different subsets of the data to explore how data quantity affects fits and trend estimates.

sharks-GAM-trends-v2.R

Fits the GAMMs described in the paper. Similar to above, but not Bayesian.

plot-gam-results-v2.R

Makes the plots for the GAM fits.

About

Code for fitting time-series models that account for shark life-history traits (Brown and Roff 2019)

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages