| Title: | Fish Body Mass at Age Estimation |
|---|---|
| Description: | A random effects model for estimating variance in weight-at-age, with utilities to read ADMB outputs and plot weight-at-age anomalies. |
| Authors: | Jim Ianelli [aut, cre] |
| Maintainer: | Jim Ianelli <[email protected]> |
| License: | CC0-1.0 |
| Version: | 0.1.0 |
| Built: | 2026-05-31 06:01:11 UTC |
| Source: | https://github.com/afsc-assessments/WtAgeRe |
Transparent colors
colr(col.pal = 1, a = 1)colr(col.pal = 1, a = 1)
col.pal |
Color palette or vector of colors. |
a |
Numeric alpha in |
Character vector of colors with alpha applied.
Author: Nathan Stephens (hacks package)
Read ADMB output and return predicted weight-at-age by year.
fn_get_pred(file = c("wt"), dat = NULL, source = c("model"), age_range = NULL)fn_get_pred(file = c("wt"), dat = NULL, source = c("model"), age_range = NULL)
file |
Character vector of base filenames (no extension). Default is "wt". |
dat |
Optional data list used to infer age range (indices 8 and 9). |
source |
Character vector of model labels for each file. |
age_range |
Optional numeric vector of ages to use as column names. |
A data frame with year, age columns, and a source column.
Plot weight-at-age anomalies
fn_plot_anoms(dfin, maxage = 10, firstyr = 1982, minage = 3, txtsize = 3)fn_plot_anoms(dfin, maxage = 10, firstyr = 1982, minage = 3, txtsize = 3)
dfin |
Data frame output from |
maxage |
Maximum age to plot. |
firstyr |
First year to include. |
minage |
Minimum age to plot. |
txtsize |
Text label size. |
A ggplot object.
Read ADMB output files .rep, .par, and .cor and return an R object of type 'list'
read_admb(repfile)read_admb(repfile)
repfile |
ADMB output files to be read (no extension needed) |
object of type 'list' with ADMB outputs as list elements
Steve Martell, Anders Nielsen, Athol Whitten, D'Arcy N. Webber
Read ADMB .ctl file and return an R object of type 'list'. DOES NOT WORK
read_ctl(fn)read_ctl(fn)
repfile |
name of ADMB output file to be read |
object of type 'list' with ADMB outputs therein
D'Arcy N. Webber
Read ADMB data files
read_dat(datfile)read_dat(datfile)
repfile |
ADMB output files to be read (no extension needed) |
object of type 'list' with ADMB outputs as list elements
Steve Martell, Anders Nielsen, Athol Whitten, D'Arcy N. Webber
Read ADMB .par, .std, and .cor file and return an R object of type 'list' of estimates and correlations
read_fit(repfile)read_fit(repfile)
repfile |
name of ADMB output file to be read (no extension needed) |
object of type 'list' with ADMB outputs therein
Steve Martell, Anders Nielsen, Athol Whitten, D'Arcy N. Webber
Read ADMB .psv file and return an R object of type 'list'
read_psv(fn, nsamples = 10000)read_psv(fn, nsamples = 10000)
repfile |
name of ADMB output file to be read (no extension needed) |
object of type 'list' with ADMB outputs therein
Steve Martell
Read ADMB .rep file and return an R object of type 'list'
read_rep(fn)read_rep(fn)
fn |
name of ADMB output file to be read (no extension needed) |
object of type "list" with ADMB outputs therein
Steve Martell, D'Arcy N. Webber
Replace outliers with mean for mean weight-at-age
replace_zeros_with_mean(column)replace_zeros_with_mean(column)
column |
Numeric vector. |
Numeric vector with outliers replaced by the mean of non-zero values.
Replace zeros with near-two for SD
replace_zeros_with_two(column)replace_zeros_with_two(column)
column |
Numeric vector. |
Numeric vector with zeros replaced by 1.9999.
Write ADMB data file
write_dat(A, datfile)write_dat(A, datfile)
A |
List of ADMB objects. |
datfile |
Output data file path. |
Invisibly returns NULL.