Skip to content

Commit

Permalink
Merge pull request #254 from James-Thorson-NOAA/development
Browse files Browse the repository at this point in the history
Development
  • Loading branch information
James-Thorson-NOAA authored Sep 22, 2020
2 parents e6db762 + b13958a commit 65d7b9a
Show file tree
Hide file tree
Showing 30 changed files with 8,228 additions and 409 deletions.
7 changes: 4 additions & 3 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
Package: VAST
Type: Package
Title: Vector-autoregressive spatio-temporal (VAST) model
Version: 3.5.5
Date: 2020-09-16
Version: 3.6.0
Date: 2020-09-22
Authors@R:
c(person(given = "James",
family = "Thorson",
Expand Down Expand Up @@ -37,7 +37,8 @@ Remotes:
License: GPL-3
LazyData: yes
BuildVignettes: yes
RoxygenNote: 6.1.1
Encoding: UTF-8
RoxygenNote: 7.1.1
URL: http://github.com/James-Thorson/VAST
BugReports: http://github.com/James-Thorson/VAST/issues
VignetteBuilder: R.rsp
15 changes: 13 additions & 2 deletions R/VAST.R
Original file line number Diff line number Diff line change
@@ -1,10 +1,21 @@
#' Vector autoregressive spatio-temporal model
#'
#' VAST is multivariate generalization of package `SpatialDeltaGLMM`, and can analyze data for multiple species, ages, size-classes, etc.
#' It can be used to implement many types of analysis including:
#' \itemize{
#' \item species distribution models with residual spatial and spatio-temporal variation, as well as covariates affecting density and catchability
#' \item joint species distribution models (both static and dynamic)
#' \item empirical orthogonal function (EOF) analysis,
#' \item vector autoregressive modelling,
#' \item spatial factor analysis,
#' \item standardization and biomass-expansion of spatially unbalanced samples
#' }
#' Features are built to be compatible among model types, e.g., by allowing catchability and density covariates to be included in EOF analysis.
#'
#' See \code{?fit_model} for a simple example of high-level wrapper functions for using VAST. Also see examples folder on github \url{http://github.com/james-thorson/VAST/tree/master/examples} for up-to-date examples using lower-level functions.
#' See \code{\link[FishStatsUtils]{fit_model}} for a simple example of high-level wrapper functions for using VAST.
#' Also see the wiki \url{https://github.com/James-Thorson-NOAA/VAST/wiki} for examples documenting many different use-cases and features.
#'
#' @seealso \code{?VAST} for general documentation, \code{?make_settings} for generic settings, \code{?fit_model} for model fitting, and \code{?plot_results} for generic plots
#' @seealso \code{\link[VAST]{VAST}} for general documentation, \code{\link[FishStatsUtils]{make_settings}} for generic settings, \code{\link[FishStatsUtils]{fit_model}} for model fitting, and \code{\link[FishStatsUtils]{plot_results}} for generic plots
#' @docType package
#' @name VAST
NULL
4 changes: 3 additions & 1 deletion R/check_fit.R
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,9 @@
#' @export
#' @md
# Using https://cran.r-project.org/web/packages/roxygen2/vignettes/rd-formatting.html for guidance on markdown-enabled documentation
check_fit = function( parameter_estimates, check_gradients=FALSE, quiet=FALSE ){
check_fit = function( parameter_estimates,
check_gradients=FALSE,
quiet=FALSE ){

# Initialize code for good model
problem_found = FALSE
Expand Down
605 changes: 419 additions & 186 deletions R/make_data.R

Large diffs are not rendered by default.

245 changes: 183 additions & 62 deletions R/make_map.R

Large diffs are not rendered by default.

24 changes: 19 additions & 5 deletions R/make_model.R
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,22 @@

#' @export
make_model <-
function( TmbData, Version, RhoConfig=c("Beta1"=0,"Beta2"=0,"Epsilon1"=0,"Epsilon2"=0), Method="Mesh", Npool=0,
ConvergeTol=1, Use_REML=FALSE, loc_x=NULL, Parameters="generate", Random="generate", Map="generate",
DiagnosticDir=NULL, TmbDir=system.file("executables",package="VAST"), RunDir=getwd(), CompileDir=RunDir,
build_model=TRUE ){
function( TmbData,
Version,
RhoConfig=c("Beta1"=0,"Beta2"=0,"Epsilon1"=0,"Epsilon2"=0),
Method="Mesh",
Npool=0,
ConvergeTol=1,
Use_REML=FALSE,
loc_x=NULL,
Parameters="generate",
Random="generate",
Map="generate",
DiagnosticDir=NULL,
TmbDir=system.file("executables",package="VAST"),
RunDir=getwd(),
CompileDir=RunDir,
build_model=TRUE ){

# Extract Options and Options_vec (depends upon version)
if( all(c("Options","Options_vec") %in% names(TmbData)) ){
Expand Down Expand Up @@ -101,6 +113,8 @@ function( TmbData, Version, RhoConfig=c("Beta1"=0,"Beta2"=0,"Epsilon1"=0,"Epsilo
}
if( "Xiinput1_scp" %in% names(Parameters) ) Random = c(Random, "Xiinput1_scp")
if( "Xiinput2_scp" %in% names(Parameters) ) Random = c(Random, "Xiinput2_scp")
if( "Phiinput1_sk" %in% names(Parameters) ) Random = c(Random, "Phiinput1_sk")
if( "Phiinput2_sk" %in% names(Parameters) ) Random = c(Random, "Phiinput2_sk")
if( "Epsiloninput1_sff" %in% names(Parameters) ) Random = c(Random, "Epsiloninput1_sff")
if( "Epsiloninput2_sff" %in% names(Parameters) ) Random = c(Random, "Epsiloninput2_sff")
if( "Epsiloninput1_sft" %in% names(Parameters) ) Random = c(Random, "Epsiloninput1_sft")
Expand Down Expand Up @@ -128,7 +142,7 @@ function( TmbData, Version, RhoConfig=c("Beta1"=0,"Beta2"=0,"Epsilon1"=0,"Epsilo
origwd = getwd()
on.exit(setwd(origwd),add=TRUE)
setwd( CompileDir )
TMB::compile( paste0(Version,".cpp") )
TMB::compile( paste0(Version,".cpp"), CPPFLAGS="-Wno-ignored-attributes" )

# Build object
dyn.load( paste0(CompileDir,"/",TMB::dynlib(Version)) ) # random=Random,
Expand Down
66 changes: 41 additions & 25 deletions R/make_parameters.R

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions R/zzz.R
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

#.onLoad <- function(libname, pkgname) {
#}
# .onLoad <- function(libname, pkgname) {
# }

.onAttach <- function(libname, pkgname) {
packageStartupMessage("###########################################################################################")
Expand All @@ -25,9 +25,9 @@

# Load `FishStatsUtils` via .onAttach because importFrom wasn't working
# Also requries moving FishStatsUtils to SUGGESTS, so that it doesn't isntall main branch
if( !"FishStatsUtils" %in% utils::installed.packages()[,1] || utils::packageVersion("FishStatsUtils") < numeric_version("2.7.0") ){
packageStartupMessage("Updating package FishStatsUtils because previously using version < 2.7.0")
devtools::install_github("james-thorson/FishStatsUtils", ref="2.7.0")
if( !"FishStatsUtils" %in% utils::installed.packages()[,1] || utils::packageVersion("FishStatsUtils") < numeric_version("2.8.0") ){
packageStartupMessage("Updating package FishStatsUtils because previously using version < 2.8.0")
devtools::install_github("james-thorson/FishStatsUtils", ref="2.8.0")
}
packageStartupMessage( "Loading package `FishStatsUtils` version ", packageVersion("FishStatsUtils") )
library(FishStatsUtils)
Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,10 @@ Background

User resources for learning about VAST
=============
There are eight main resources for learning about VAST:
There are ten main resources for learning about VAST:

* *Model structure*: Please see the [User Manual](https://github.com/James-Thorson/VAST/blob/master/manual/VAST_model_structure.pdf) for a document listing model equations and relating them to the input/output used in R.
* *Change documentation*: Please see [NEWS](https://github.com/James-Thorson/VAST/blob/master/manual/NEWS.pdf) 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](https://www.sciencedirect.com/science/article/abs/pii/S0165783618302820) 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](https://github.com/James-Thorson/VAST/wiki/Simple-example) to running `VAST`
* *Examples*: The wiki also includes example code to run VAST for many common [use-cases](https://github.com/James-Thorson-NOAA/VAST/wiki), as listed in the right-hand-side toolbar at that link.
Expand Down
Loading

0 comments on commit 65d7b9a

Please sign in to comment.