checkLenAge: Calculate von Bertalanffy Growth Parameters

View source: R/checkLenAge.R

checkLenAgeR Documentation

Calculate von Bertalanffy Growth Parameters

Description

Calaculate the von Bertalanffy growth parameters and compare them to parameters estimated when outliers are removed from the data set. Outliers are determined using standard deviations (i.e., sdFactor input parameter).

Usage

checkLenAge(
  Pdata,
  Par = list(K = 0.13, Linf = 55, L0 = 15, CV0 = 0.1, CV1 = 0.1),
  len_col = "lengthcm",
  age_col = "Age",
  sex_col = "SEX",
  mult = 1,
  keepAll = TRUE,
  sdFactor = 4,
  Optim = TRUE,
  precision = 1,
  verbose = TRUE,
  dir = NULL
)

Arguments

Pdata

A data frame of biological samples originating from the Pacific Fishieries Information Network (PacFIN) data warehouse, which originated in 2014. Data are pulled using sql calls, see PullBDS.PacFIN().

Par

A list of five initial or externally estimated parameter values for the von Bertalanffy growth function. List entries should be named as follows: "K", "Linf", "L0", "CV0", "CV1". If they aren't named, then it is imperative that they are in the previous order. Each list element, i.e., vector, can have multiple values specific to each sex type present in your data. These vector elements must be named and the length of all vectors must be the same. A typical example for a list element would be K = c(F = 0.10, M = 0.20, U = 0.15) for female, male, and unsexed fish. If each vector within the list is only made up of a single element, it doesn't need to be named and each sex type present in the data will use the same value.

len_col

Name of the length column to use for comparisons (default = "lengthcm").

age_col

Name of the age column to use for comparisons (default = "age").

sex_col

Name of the sex column to use for comparisons (default = "SEX"). If the value is NULL, then all aged fish are included in a single analysis rather than separating data by available sex information.

mult

A multiplier to convert lengths (default value 1). This multiplier is used to scale the input parameters if the length column is a different unit other than cm. In reality one really shouldn't need to use this because you can make a column of lengths in the correct units and supply that column name to len_col.

keepAll

Option to change inconsistent lengths to a value of NA, which is only done if keepAll = FALSE. The default is to not change any values.

sdFactor

Option to control the threshold of the estimated low and high bound that is compared to when throwing out data. Default value is 4 standard deviations away from the mean prediction.

Optim

A logical value specifying whether or not to internally solve for the parameter estimates or use Par as input parameter to the growth function for predictions.

precision

An integer providing the precision for the predicted lengths or the number of digits the results will have after passing them through round(x, digits = precision).

verbose

A logical specifying if output should be written to the screen or not. Good for testing and exploring your data but can be turned off when output indicates information that you already know. The printing of output to the screen does not affect any of the returned objects. The default is to always print to the screen, i.e., verbose = TRUE.

dir

A file path to a directory where you want information saved to a file, or multiple files. If NULL, which is the default, then nothing is saved.

Value

Returns a combined dataset in PacFIN format.

Author(s)

Chantel R. Wetzel, Vlada Gertseva, James Thorson


nwfsc-assess/PacFIN.Utilities documentation built on March 19, 2024, 11:54 p.m.