Package 'NamibianHake'

Title: Namibian Hake Stock Assessment Model
Description: Runs, validates, summarizes, and reports results from the age-structured ADMB assessment model for Namibian hake.
Authors: Jim Ianelli [aut, cre], John Kathena [aut]
Maintainer: Jim Ianelli <[email protected]>
License: MIT + file LICENSE
Version: 0.0.0.9000
Built: 2026-07-23 20:46:17 UTC
Source: https://github.com/jimianelli/NamibianHake

Help Index


Plot Selectivity

Description

This function creates a plot of selectivity across years and ages.

Usage

plot_sel(
  Year = M$Year,
  sel = M[, 2:10],
  styr = 1964,
  fage = NULL,
  lage = NULL,
  alpha = 0.2,
  scale = 3.8,
  fill = "purple"
)

Arguments

Year

A vector of years. Default is M$Year.

sel

A matrix of selectivity values. Default is M[,2:10].

styr

An integer specifying the start year for the plot. Default is 1964.

fage

An integer specifying the first age to include in the plot. Default is NULL.

lage

An integer specifying the last age to include in the plot. Default is NULL.

alpha

A numeric value specifying the transparency level of the fill. Default is 0.2.

scale

A numeric value specifying the scale for the density ridges. Default is 3.8.

fill

A character string specifying the fill color for the density ridges. Default is "purple".

Value

A ggplot object showing selectivity across years and ages.

Examples

## Not run: 
plot_sel(Year = M$Year, sel = M[, 2:10], styr = 1970, fage = 1, lage = 8)

## End(Not run)

Plot Age Fit

Description

This function creates a plot comparing observed and predicted age compositions for a specified type.

Usage

PlotAgeFit(x = bc, title = NULL, type = "fishery", fage = 2, lage = 7)

Arguments

x

A list containing the observed and predicted age compositions. Default is bc.

title

A character string for the plot title. Default is NULL.

type

A character string specifying the type of composition to plot. Default is "fishery".

fage

An integer specifying the first age to include in the plot. Default is 2.

lage

An integer specifying the last age to include in the plot. Default is 7.

Value

A ggplot object comparing observed and predicted age compositions.

Examples

## Not run: 
PlotAgeFit(x = bc, title = "Age Composition", type = "survey", fage = 1, lage = 8)

## End(Not run)

Read ADMB output files

Description

Read ADMB output files .rep, .par, and .cor and return an R object of type 'list'

Usage

read_admb(repfile)

Arguments

repfile

ADMB output files to be read (no extension needed)

Value

object of type 'list' with ADMB outputs as list elements

Author(s)

Steve Martell, Anders Nielsen, Athol Whitten, D'Arcy N. Webber


Read ADMB .ctl file

Description

Read ADMB .ctl file and return an R object of type 'list'. DOES NOT WORK

Usage

read_ctl(fn)

Arguments

repfile

name of ADMB output file to be read

Value

object of type 'list' with ADMB outputs therein

Author(s)

D'Arcy N. Webber


Read ADMB .par, .std, and .cor file and return an R object of type 'list' of estimates and correlations

Description

Read ADMB .par, .std, and .cor file and return an R object of type 'list' of estimates and correlations

Usage

read_fit(repfile)

Arguments

repfile

name of ADMB output file to be read (no extension needed)

Value

object of type 'list' with ADMB outputs therein

Author(s)

Steve Martell, Anders Nielsen, Athol Whitten, D'Arcy N. Webber


Read ADMB .psv file

Description

Read ADMB .psv file and return an R object of type 'list'

Usage

read_psv(fn, nsamples = 10000)

Arguments

repfile

name of ADMB output file to be read (no extension needed)

Value

object of type 'list' with ADMB outputs therein

Author(s)

Steve Martell


Read output file from the random effects (RE) model into a data.frame

Description

Read output file from the random effects (RE) model into a data.frame

Usage

read_re_output(file = "rwout.rep", skip_data = FALSE, use_names = FALSE)

Arguments

file

A character string of the file to be read in, defaulting to 'rwout.rep' in the current working directory.

skip_data

Whether to skip returning columns representing the data inputs. If TRUE these are included and will have NA values for any missing years

use_names

Whether to use the names written by the RE model or to use more meaningful ones (default)

Value

A dataframe with columns named based on the tags in the output file


Read ADMB .rep file

Description

Read ADMB .rep file and return an R object of type 'list'

Usage

read_rep(fn)

Arguments

fn

name of ADMB output file to be read (no extension needed)

Value

object of type "list" with ADMB outputs therein

Author(s)

Steve Martell, D'Arcy N. Webber


Test the RE on a single species. This compares a current ADMB univariate run to a previous run. It tests continuity not correctness

Description

Test the RE on a single species. This compares a current ADMB univariate run to a previous run. It tests continuity not correctness

Usage

test_re_species(d, test_tmb = TRUE)

Arguments

d

The .dat file name, e.g., bigskate_t.dat, found in tests/data folder

Details

It will throw an error if the results have changed, otherwise results are consistent.

Value

A data.frame with ADMB and TMB estimates for comparing


Write an input file for the RE model

Description

Write an input file for the RE model

Usage

write_re_input(
  file,
  years,
  biomass,
  CV,
  tag = NULL,
  sp = "species",
  survey = "survey",
  yr_start = NULL,
  yr_end = NULL
)

Arguments

file

A path to the output file, usually ending in .dat

years

A vector of years for the observations

biomass

A vector of biomasses for the observations

CV

A vector of CV values for the observations

tag

Optional character string to print to file for bookkeeping (e.g., "EBS shelf flathead sole")

yr_start

Optional start year for predictions

yr_end

Optional end year for predictions

Value

Nothing, a data file is written to file

See Also

read_re_output