getExpansion_1: First-Stage Expansion for Composition Data

View source: R/getExpansion_1.R

getExpansion_1R Documentation

First-Stage Expansion for Composition Data

Description

First-stage expansions account for unsampled fish in the smallest measured unit. Where, in PacFIN data, the smallest unit is that which is available to the port or dockside sampler, so more than likely a trip rather than a tow as would be with survey data.

Usage

getExpansion_1(
  Pdata,
  maxExp = 0.95,
  Exp_WA = TRUE,
  fa = NA,
  fb = NA,
  ma = NA,
  mb = NA,
  ua = NA,
  ub = NA,
  verbose = TRUE,
  plot = FALSE
)

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().

maxExp

The maximum expansion factor (either a number or a quantile) for building expansions. Typically, the default is 0.95. Set maxExp = Inf to see largest values.

Exp_WA

Default FALSE. If TRUE, expand the WA samples.

fa

Female specific weight length coefficient.

fb

Female specific weight length exponent.

ma

Male specific weight length coefficient.

mb

Male specific weight length exponent.

ua

Unsexed weight length coefficient.

ub

Unsexed weight length exponent.

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.

plot

Argument takes either a logical or character value specifying the file name if you want to write the plots to a disk rather than printing them to the console. If plot = FALSE no plots will be generated. If printing to the disk the character value should end in .png as png() is used to save the plotting device.

Details

The workflow is to run getExpansion_1 after cleanPacFIN, which assures that all of the necessary columns are available and that the data are in the correct units. getExpansion_1 calls EF1_Numerator and EF1_Denominator (i.e., the weight of sampled fish and the weight of all fish of the respective species in the tow) and returns their ratio.

Value

A data.frame where all of the original columns in Pdata remain unaltered but additional columns are added. In particular columns starting with Expansion_Factor_1 are available for setting the Final_Expansion_Factor.

Expansion

  • Age data are expanded separately from lengths.

  • WA fish are generally only expanded using Expansion_Factor_2.

  • Other expansions are the product of Expansion_Factor_1 * Expansion_Factor_2

  • For age-at-length comps, set Final_Expansion_Factor to 1 because each fish represents only itself.

See Also

Called within this function are EF1_Numerator EF1_Denominator. Called after this function should be getExpansion_2.


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