fishR-Core-Team / FSA

FSA (Fisheries Stock Assessment) package provides R functions to conduct typical introductory fisheries analyses.
https://fishr-core-team.github.io/FSA/
GNU General Public License v2.0
65 stars 20 forks source link

Add ability to use non-standard species to `psdCalc()` #58

Closed droglenc closed 1 year ago

droglenc commented 4 years ago

Per request from Nick Heredia ... add ability to use psdCalc() with a species that does not exist in psdLit.

This should be a fairly quick addition ... just bypass call to psdVals() early in psdCalc() and make some catches if the user does not send the full compliment of length (i.e., one for each length category).

droglenc commented 1 year ago

This will be address in the next version (>0.9.3) by allowing the user to not include a name in species= as long as they include length categories in addLens=. In this way, the user can send their own length category breaks to psdCalc() for a species that does not have pre-defined Gabelhouse (or any) length categories (with the caveat that there must be two categories and the first must be named "stock").

For example, the following will now work (note that species is not used here in psdCalc()).

psdCalc(~yepmm,data=yepdf,
        addLens=c("stock"=130,"quality"=200,"preferred"=250,"memorable"=300,"trophy"=380))

to produce this (example) result

Estimate 95% LCI 95% UCI
PSD-Q         41      26      55
PSD-P         15       5      26
PSD-M         10       1      19
PSD-T          1       0       4
PSD S-Q       59      45      74
PSD Q-P       25      13      38
PSD P-M        5       0      12
PSD M-T        9       1      17
Warning message:
  Some category sample size <20, some CI coverage may be
lower than 95%.