calc_lw_residuals_multimodel: Length-weight residuals from best linear regression among...

View source: R/calc_lw_residuals_multimodel.R

calc_lw_residuals_multimodelR Documentation

Length-weight residuals from best linear regression among candidate models with

Description

Fits 1 (no stratum or sex covariates), 4 (either no stratum or no sex covariates), or 15 (stratum and sex covariates) linear regression models to log-weight and log-length with varying combinations of stratum-specific and sex-specific coefficients for allometric slope and intercept terms. The most parsimonious model is selected based on AIC then length-weight residuals are calculated using the best-fit model. Can optionally remove outliers based on a Bonferroni test (outlier_rm = TRUE), bias correct log-weight predictions (bias_correction = TRUE), write regression diagnostics to /output/ directory (make_diagnostics = TRUE), and include confidence intervals for

Usage

calc_lw_residuals_multimodel(
  len,
  wt,
  stratum = NULL,
  sex = NULL,
  day_of_year = NULL,
  year = NULL,
  region = "all",
  species_code = NA,
  bias_correction = TRUE,
  make_diagnostics = TRUE,
  outlier_rm = TRUE,
  include_ci = TRUE,
  multiple_models = TRUE,
  ...
)

Arguments

stratum

Stratum code for length-weight regression by stratum.

sex

Sex code for fish; convertible to a factor.

day_of_year

Day of year as an integer.

year

Numeric vector for year (provide if make_diagnostics = TRUE)

region

Character vector for region (provide if make_diagnostics = TRUE)

species_code

Species code (provide if make_diagnostics = TRUE)

make_diagnostics

Output diagnostic plots and summaries? Default FALSE produces no diagnostics and summaries. If true, species_code and region should be specified.

outlier_rm

Should outliers be removed using Bonferroni test (cutoff = 0.7)

include_ci

Include upper and lower estimates for the 95 pct confidence interval of residuals in the output.

length

Set of individual fish lengths.

weight

Corresponding set of individual fish weights.

bias_correct

Bias corrected residuals following Brodziak (2012)

Details

Brodziak, J.2012. Fitting length-weight relationships with linear regression using the log-transformed allometric model with bias-correction. Pacific Islands Fish. Sci. Cent., Natl. Mar. Fish. Serv., NOAA, Honolulu, HI 96822-2396. Pacific Islands Fish. Sci. Cent. Admin. Rep. H-12-03, 4 p.


afsc-gap-products/akfishcondition documentation built on June 11, 2025, 5:37 p.m.