VAST
Spatio-temporal analysis of univariate or multivariate data, e.g., standardizing data for multiple species or stages
Install / Use
/learn @James-Thorson-NOAA/VASTREADME
Description
VAST
- Is an R package for implementing a spatial delta-generalized linear mixed model (delta-GLMM) for multiple categories (species, size, or age classes) when standardizing survey or fishery-dependent data.
- Builds upon a previous R package
SpatialDeltaGLMM(public available here), and has unit-testing to automatically confirm thatVASTandSpatialDeltaGLMMgive identical results (to the 3rd decimal place for parameter estimates) for several varied real-world case-study examples - Has built in diagnostic functions and model-comparison tools
- Is intended to improve analysis speed, replicability, peer-review, and interpretation of index standardization methods
Background
- This tool is designed to estimate spatial variation in density using spatially referenced data, with the goal of habitat associations (correlations among species and with habitat) and estimating total abundance for a target species in one or more years.
- The model builds upon spatio-temporal delta-generalized linear mixed modelling techniques (Thorson Shelton Ward Skaug 2015 ICESJMS), which separately models the proportion of tows that catch at least one individual ("encounter probability") and catch rates for tows with at least one individual ("positive catch rates").
- Submodels for encounter probability and positive catch rates by default incorporate variation in density among years (as a fixed effect), and can incorporate variation among sampling vessels (as a random effect, Thorson and Ward 2014) which may be correlated among categories (Thorson Fonner Haltuch Ono Winker In press).
- Spatial and spatiotemporal variation are approximated as Gaussian Markov random fields (Thorson Skaug Kristensen Shelton Ward Harms Banante 2014 Ecology), which imply that correlations in spatial variation decay as a function of distance.
User resources for learning about VAST
There are eleven main resources for learning about VAST:
- Model structure: Please see the User Manual for a document listing model equations and relating them to the input/output used in R.
- Change documentation: Please see NEWS for a document listing major changes in each numbered release; this is useful to track development changes (interface improvements, bug fixes, issues regarding dependencies, etc.) over time.
- Guidance for user decisions: Please see Thorson-2019 for guidance regarding the 15 major decisions needed in every VAST model
- High-level wrapper functions: I have recently added high-level wrapper functions, which provide a gentle introduction to running
VAST - Examples: The wiki also includes example code to run VAST for many common use-cases, as listed in the right-hand-side toolbar at that link.
- R-help documentation: Please see the standard R-help documentation, e.g., by typing
?fit_modelor?make_datain the R-terminal after installing the package and loading it usinglibrary(VAST). - Publications: Please see the publications list to identify peer-reviewed publications regarding individual features. These publications include statistical theory and model testing.
- List-serv: Consider joining the FishStats listserve for 4-6 updates per year, including training classes.
- Slack channel: A slack channel was developed by J. Morano and colleagues to allow real-time, casual discussions among new and longtime users.
- Talks available online: We post recorded talks and seminars online
- Issue-tracker: Before posting new issues, users should explore the previous issues in the github issue tracker for VAST, SpatialDeltaGLMM, and FishStatsUtils, including a search for old and closed issues.
- Wiki: Users should read and are encouraged to actively contribute to the wiki, which is housed at the github for SpatialDeltaGLMM
If there are questions that arise after this, please look for a VAST Point-of-Contact at your institution and consider contacting them prior to posting an issue.
Database
Regions available in the example script:
and see FishViz.org for visualization of results for regions with a public API for their data.
Installation Instructions
This function depends on R version >=3.1.1 and a variety of other tools.
First, install the "devtools" package from CRAN
# Install and load devtools package
install.packages("devtools")
library("devtools")
Next, please install the VAST package from this GitHub repository using a function in the "devtools" package. This may require using the INSTALL_opts option depending upon your version of R:
# Install package
install_github("james-thorson/VAST@main", INSTALL_opts="--no-staged-install")
# Load package
library(VAST)
If you are having problems with installation, please consider installing dependencies individually, e.g. using:
# Install TMB from CRAN
install.packages("TMB")
# Install INLA using currently recommended method
install.packages("INLA", repos=c(getOption("repos"), INLA="https://inla.r-inla-download.org/R/stable"), dep=TRUE)
# Install FishStatsUtils from CRAN
install_github("james-thorson/FishStatsUtils@main", INSTALL_opts="--no-staged-install")
Finally, please confirm that VAST is installed by running a model, e.g., following the simple example here.
Known installation/usage issues
-
If using a NOAA laptop, sometimes the PATH for Rtools is not correctly specified during installation. In those cases, please follow instructions here
-
Some versions of R are having problems downloading dependencies from GitHub, see details here
-
People using R version 3.6.0 or MRAN 3.5.3 are having a problem with changing standards for package namespaces, see details here, which appears to be particularly a problem with loading INLA due to install issues with that package.
-
MacOS users have specific install issues and a discussion of potential fixes is here
-
MacOS users should be aware that significant speed-ups in model fitting can be accomplished by switching the library used for Basic Linear Algebra Subprograms (BLAS) from the default. There are a few BLAS alternatives available, though, the simplest seems to be using the vecLib library, part of Apple's Accelerate Framework and included in most recent R binaries. To switch the BLAS library, run the following lines in the terminal and then confirm the switch with a call to
sessionInfo()in R.
# Terminal commands to switch R BLAS library to increase speed
cd /Library/Frameworks/R.framework/Resources/lib
ln -sf /System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Versions/Current/libBLAS.dylib libRblas.dylib
- Windows has a speed-limit on the rate that users can access the GitHub API. You can get around this by installing each package locally from a ZIP file. You'll need to first download a ZIP file for GitHub repositories
TMBhelper(here), thenThorsonUtilities(here), thenFishStatsUtils(here), thenVAST(here) to your harddrive in a local directory while recording the directory name (which I will reference asdownload_dir), and then install these packages from each ZIP file in the same order. To install each package, please click "clone or download" -> "Download ZIP" ->devtools::install_local(path=download_dir, dependencies=FALSE)
References
Core functionality
- Thorson, J.T., Barnett, L.A.K., 2017. Comparing estimates of abundance trends and distribution shifts using single- and multispecies models of fishes and biogenic habitat. ICES J. Mar. Sci. 74, 1311–1321. https://doi.org/10.1093/icesjms/fsw193
- Thorson, J.T., 2019. Guidance for decisions using the Vector Autoregressive Spatio-Temporal (VAST) package in stock, ecosystem, habitat and climate assessments. Fish. Res. 210, 143–161. https://doi.org/10.1016/j.fishres.2018.10.013
