Compare length histogram of aged samples to all lengthed samples

age_representativeness_plot(
  bio,
  xlim = c(0, max_break),
  ylim = c(0, 0.049),
  max_break = 155,
  file = NULL,
  plot_panels = c(10, 2),
  wait2plot = FALSE
)

Arguments

bio

The dataframe containing the lengths and ages. Currently the function works with data from the West Coast Groundfish Bottom Trawl Survey extracted by the nwfscSurvey package as well as PacFIN data. Must include either the columns Year, Length_cm, and Age, or, for PacFIN data, SAMPLE_YEAR, FISH_LENGTH, and FISH_AGE_YEARS_FINAL. Additional columns can be present.

xlim

The x limits for the histogram

ylim

The y limits for the histogram

max_break

The maximum length in cm (If PacFIN data is provided, FISH_LENGTH is automatically converted from mm to cm).

file

The relative or absolute path and name of the file to write to, as a .png file.

plot_panels

A vector of two integers that determine the matrix dimensions of the plots panels (row x columns), i.e., used in par() if !is.null(file).

wait2plot

A logical specifying if you want R to ask you to confirm page changes between plots. The default is FALSE and it will also be FALSE if plots are saved to the disk.

Value

Several plots, potentially, are printed to the screen or saved to the disk

Details

Output on figures include K-S p-value, which is the p-value output from ks.test and is colored red if <.05 and green if >=.05, and expression(hat(b)), which is the bhattacharyya coefficient calculated as sum(sqrt(pi1*pi2)) where pi1 and pi2 are the proportion of data in bin i for each of the two distributions.

Author

Ian G. Taylor, Kathryn L. Doering, Brian Langseth, Kelli F. Johnson