EF1_Numerator: Calculate the numerator for the first level expansion factor

View source: R/EF1_Numerator.R

EF1_NumeratorR Documentation

Calculate the numerator for the first level expansion factor

Description

Calculate the numerator for the first-level expansion factor, where the numerator is the species-specific landing weight for a given sample. Thus, if two clusters were sampled from a single trip, they would both use the same landing weight.

Usage

EF1_Numerator(Pdata, 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().

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

Previously, Trip_Sampled_Lbs was calculated differently for each state. For California, Species_Percent_Sampled * TOTAL_WGT. For Oregon, Pdata$EXP_WT and if missing, the same as California. For Washington, Pdata$RWT_LBS, Pdata$TOTAL_WGT, RWT_LBS, or median(Pdata$TOTAL_WGT). Then, if all else failed, per-year, state-specific medians.

Now, PacFIN works hard behind the scenes to provide species-specific landing weights for each sampled fish. Therefore, we no longer rely on code to calculate a fabricated landing weight. Species-specific landing weights are available in either EXPANDED_SAMPLE_WEIGHT or WEIGHT_OF_LANDING_LBS. The former, is specific to Oregon and samples that do not provide an expanded sample weight should not be used more than likely anyway.

todo:

  • determine if we want to flag some bad samples in cleanPacFIN.

  • fix up the plotting and summary code

Value

A Pdata with additional columns, where Trip_Sampled_Lbs is the sample weight in pounds.

Author(s)

Andi Stephens

See Also

getExpansion_1 calls this function.


nwfsc-assess/PacFIN.Utilities documentation built on July 20, 2024, 8:42 a.m.