calc_lw_residuals: A function to calculate length-weight residuals

View source: R/calc_lw_residuals.R

calc_lw_residualsR Documentation

A function to calculate length-weight residuals

Description

This function makes a log-log regression of length and weight for individual fish and then calculates a residual. A Bonferroni-corrected outlier correction can be applied to remove outliers. Option to use separate covariates for different strata.

Usage

calc_lw_residuals(
  len,
  wt,
  stratum = NA,
  bias_correction = TRUE,
  outlier_rm = FALSE,
  make_diagnostics = FALSE,
  species_code = NA,
  year = NA,
  region = NA,
  include_ci = TRUE
)

Arguments

stratum

Stratum code for length-weight regression by stratum.

bias_correction

Bias corrected residuals following Brodziak (2012)

outlier_rm

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

make_diagnostics

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

species_code

Species code (provide if make_diagnostics = TRUE)

year

Year (provide if make_diagnostics = TRUE)

region

Region (provide if make_diagnostics = TRUE)

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.

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.