Skip to content

One-step ahead (OSA) residuals for age and length compositions fit in stock assessment models.

Notifications You must be signed in to change notification settings

noaa-afsc/afscOSA

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

afscOSA

One-step ahead (OSA) residual diagnostic plots for observed and predicted age and length compositions with an assumed multinomial distribution from assessment models. OSA residuals are computed using the compResidual R library (Trijoulet and Nielsen, 2022).

Installation

Install compResidual and afscOSA using the instructions below.

# install.packages("devtools")

# see https://github.com/fishfollower/compResidual#composition-residuals for
# installation instructions

# TMB:::install.contrib("https://github.com/vtrijoulet/OSA_multivariate_dists/archive/main.zip")
# devtools::install_github("fishfollower/compResidual/compResidual")

devtools::install_github("noaa-afsc/afscOSA", dependencies = TRUE)

Examples

There are code examples for GOA pollock (a bespoke ADMB model), BSAI Atka mackerel (AMAK), and AI Pacific cod (SS3).

Example scripts are downloaded when afscOSC is installed. Locate them on your computer by running the following commands:

(afscOSA_path <- find.package('afscOSA'))
(afscOSA_examples <- file.path(afscOSA_path, 'examples'))
list.files(afscOSA_examples)

# AI_PCOD # a folder with all the aipcod.R script and all the Pcod stock synthesis files
# bsaiam.R # Atka mackerel
# goapk.R # GOA pollock

The afscOSA worflow

  1. Load afscOSA and data.

  2. Structure observed and expected compositions as matrices with nrows = number of years, ncols = number of ages or length bins.

  3. Calculate OSA residuals for each fleet using run_osa(). See details for inputs and outputs by running ??run_osa().

  4. Plot OSA residuals and aggregate fits for one or more fits using plot_osa(). Input to plot_osa() is a list of output(s) from run_osa(). See more details by running ??plot_osa.

References

Trijoulet V, Nielsen A (2022). compResidual: Residual calculation for compositional observations. R package version 0.0.1.

About

One-step ahead (OSA) residuals for age and length compositions fit in stock assessment models.

Resources

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages