-
Notifications
You must be signed in to change notification settings - Fork 53
Expand age and length composition
Jim Thorson edited this page Apr 20, 2019
·
9 revisions
It is possible to use VAST
to expand subsamples of age/length composition obtained during bottom-trawl sampling. To do so, we first perform first-stage expansion and then fit a spatio-temporal model to those expanded samples:
# Download development branch (or perhaps master branch in future releases)
devtools::install_github("james-thorson/VAST", ref="development")
devtools::install_github("james-thorson/FishStatsUtils", ref="development")
# Load packages
library(TMB)
library(VAST)
# load data set
# see `?load_example` for list of stocks with example data
# that are installed automatically with `FishStatsUtils`.
example = load_example( data_set="Lingcod_comp_expansion" )
# Make settings
settings = make_settings( n_x=50, Region=example$Region, purpose="index",
strata.limits=example$strata.limits )
# Change settings from defaults
settings$ObsModel = c(2,0)
settings$use_anisotropy = FALSE
settings$fine_scale = FALSE
# Run model
fit = fit_model( "settings"=settings, "Lat_i"=example$sampling_data[,'Lat'], "Lon_i"=example$sampling_data[,'Lon'],
"t_i"=example$sampling_data[,'Year'], "c_i"=as.numeric(example$sampling_data[,"Length_bin"])-1,
"b_i"=example$sampling_data[,'First_stage_expanded_numbers'],
"a_i"=example$sampling_data[,'AreaSwept_km2'], model_args=list("Npool"=20),
newtonsteps=0, optimize_args=list("getsd"=FALSE) )
# Plot results
plot_results( settings=settings, fit=fit )
- Note: this result differs somewhat from the result used for backwards-compatibility checks, due to differences in the k-means locations for knots between earlier reposited results and newer version of
FishStatsUtils
.
Example applications:
- Index standardization
- Empirical Orthogonal Functions
- Ordination using joint species distribution model
- End-of-century projections
- Expand length and age-composition samples
- Combine condition and biomass data
- Expand stomach content samples
- Combine presence/absence, counts, and biomass data
- Seasonal and annual variation
- Combine acoustic and bottom trawl data
- Surplus production models
- Multispecies model of biological interactions
- Stream network models
Usage demos:
- Adding covariates
- Visualize covariate response
- Percent deviance explained
- Create a new extrapolation grid
- Custom maps using ggplot
- Modify axes for distribution metrics
- K-fold crossvalidation
- Simulating new data
- Modify defaults for advanced users
Project structure and utilities: