Simulate expected yield under minimum length regulations using the Dynamic Pool model for a range of input parameters
Source:R/dpmBH_MinLL.R
dpmBH_MinLL.RdSimulate yield and transitional spawning potential ratio under minimum length regulations using the Dynamic Pool (DPM) model with (possibly) multiple values for conditional fishing mortality (cf) and conditional natural mortality (cm). Recruitment options can be a user supplied vector or based on one of three stock-recruitment models.
Arguments
- minLL
A single numeric representing the minimum length limit for harvest in mm.
- cf
A matrix of conditional fishing mortality where each row represents a year and each column represents an age (age-0 through maximum age; i.e.,
tmaxinlhparms). All values must be between 0 and 1 (inclusive).- cm
A matrix of conditional natural mortality where each row represents a year and each column represents an age (age-0 through maximum age; i.e.,
tmaxinlhparms). All values must be between 0 and 1 (inclusive).- recruitment_type
A string that indicates if recruitment is being supplied as a
vector(which requiresrecvalso specified or based on a stock-recruitment model,stockrecruit(which requires relevant coefficients also specified)- srmod
A string that indicates the type of stock-recruitment model,
Ricker,BevertonHolt,Shepherd. Required whenrecruitment_type=stockrecruit.- lhparms
A named vector or list that contains values for each
N0,tmax,Linf,K,t0,LWalpha, andLWbeta. SeemakeLHfor definitions of these life history parameters. Also see details.- simyears
A single numeric for the number of years to simulate. Value must be a whole number greater than 1.
- a
A single numeric to represent alpha in the Ricker, Beverton-Holt, and Shepherd stock-recruitment models.
- b
A single numeric to represent beta in the Ricker, Beverton-Holt, and Shepherd stock-recruitment models.
- c
A single numeric to represent c in the Shepherd stock-recruitment models.
- sigmaR
A single numeric to represent standard deviation of annual recruits in the Ricker, Beverton-Holt, and Shepherd stock-recruitment models.
- recv
A numeric vector with length
simyearsthat specifies the number of recruits each year. This vector is best generated using thegenRecruits. All values must be greater than 0.- species
A single character to specify the species used in the simulation. This will define the length for
stock,quality,preferred,memorable, andtrophylengths from the FSA package. See thePSDlitdocumentation.- group
A single character to specify the sub-group name for
specieswhich may be required when defining thestock,quality,preferred,memorable, andtrophylength categories from the FSA package. See thePSDlitdocumentation.- SPRdat
A named list that contains values for each
FLR,FLRint,FLRslope,MatAge,percF, andpercFSpawn. SeemakeSPRfor definitions of these parameters.- matchRicker
A logical that indicates whether the yield function should match that in Ricker (1975). Defaults to
FALSE. See the FAMS vs Ricker article.
Value
A list with two data.frame object. The first list item named sumbyAge contains a data.frame with the following calculated values in a summary by age:
yearis the year number for the simulationycis the year class number for the simulationageis the age of fish from the year classlengthis the length-at-age at the beginning of the year based on parameters supplied for the von Bertlanffy growth model.weightis the total weight at the beginning of the year for length-at-age based on the parameters supplied for the weight-length model.N_startis the number of fish alive at the start of the year for the given age and year class.exploitationis the exploitation rate at age based on the supplied conditional fishing mortality rate.expect_nat_deathis the expectation of natural death based on the supplied conditional natural mortality rate.cfis the supplied conditional fishing mortality rate.cmis the supplied conditional natural mortality rate.Fis the instantaneous rate of fishing mortality.Mis the instantaneous rate of natural mortality.Zis the instantaneous rate of total mortality.Sis the (total) annual rate of survival.biomassis the total biomass of fish at age and year.N_harvestis the total number of fish harvested at age and year.N_dieis the total number of fish that die at age and year.yieldis the estimated yield (in g).minLLis the minimum length limit specified in the simulation.
For convenience the data.frame also contains the model input values (N0, Linf, K, t0, LWalpha, LWbeta, and tmax).
The second list item named sumbyYear contains a data.frame with the following calculated values in a summary by year:
yearis the year number for the simulationage_1plusis the total number of fish age-1 plus per year.Yield_age_1plusis the total year of age-1 plus fish per year.Total_biomassis the total biomass of age-1 plus fish per year.n_harvest_age_1plusis the number of age-1 plus fish that are harvested per year.n_die_age_1plusis the number of age-1 plus fish that die per year.substockis the incremental number of substock sized fish at age and year at the beginning of the year.stockis the incremental number of stock sized fish at age and year at the beginning of the year.qualityis the incremental number of quality sized fish at age and year at the beginning of the year.preferredis the incremental number of preferred sized fish at age and year at the beginning of the year.memorableis the incremental number of memorable sized fish at age and year at the beginning of the year.trophyis the incremental number of trophy sized fish at age and year at the beginning of the year.PSDis the number of quality sized fish divided by the number of stock sized multiplied by 100.PSD_Pis the number of preferred sized fish divided by the number of stock sized multiplied by 100.PSD_Mis the number of memorable sized fish divided by the number of stock sized multiplied by 100.PSD_Tis the number of trophy sized fish divided by the number of stock sized multiplied by 100.wtSPRis the weighted transitional spawning potential ratio. This value is set to 0 for all simulation years less than the maximum age to ensure the population has reach equilibrium.
PSD-X are calculated based on the number of fish in each category (stock, quality, preferred, memorable, and trophy) at the beginning of the year. That is, the length-at-age during the start of the year is used to assign PSD-X categories at age. For example, if Quality size is 300mm, an age-1 fish at 275mm at the start of the year would not be counted as a quality-sized fish, but an age-2 fish at 325mm at the start of the year would be counted as a quality-sized fish. Note that the number in each size category are incremental. That is, the number of stock size fish is the number greater than stock size but less than quality size.
Details
Details will be filled out later.
Note that the main calculations are in the internal dpmBH_func (use rFAMS:::dpmBH_func to see that source code).
See also
yprBH_MinLL for estimating yield with a yield-per-recruit model using a minimum length limit and yprBH_SlotLL for estimating yield with the yield-per-recruit model and a slot limit.
See this demonstration page for more examples of this function.
Author
Jason C. Doll, jason.doll@fmarion.edu
Examples
#load required library
library(dplyr)
#>
#> Attaching package: 'dplyr'
#> The following objects are masked from 'package:stats':
#>
#> filter, lag
#> The following objects are masked from 'package:base':
#>
#> intersect, setdiff, setequal, union
library(ggplot2)
# Example of simulating yield with the dynamic pool model,
# Seetings for all examples
lhparms <- makeLH(N0=100,tmax=30,Linf=1349.5,K=0.111,t0=0.065,
LWalpha=-5.2147,LWbeta=3.153)
simyears <- 150
minLL <- 400
rec <- genRecruits(method = "fixed", nR = 100, simyears = simyears)
cm <- matrix(rep(c(rep(0,1), rep(0.18,(lhparms$tmax))), simyears),nrow=simyears,byrow=TRUE)
cf <- matrix(rep(c(rep(0,1), rep(0.33,(lhparms$tmax))), simyears),nrow=simyears,byrow=TRUE)
out<-dpmBH_MinLL(simyears = simyears, minLL = minLL, cf = cf,
cm = cm, recruitment_type = c("vector"), recv = rec, lhparms = lhparms,
matchRicker=FALSE,species="Striped Bass",group="landlocked")
#Use summary by year data frame to plot yield vs year
ggplot(data=out[[2]],mapping=aes(x=year,y=Yield_age_1plus)) +
geom_point() +
geom_line() +
labs(y="Total yield (g)",x="Year") +
theme_bw()
#Plot date using summary by age
#filter for year class = 1
plotdat<- out[[1]] |> filter(yc==1)
#Plot yield vs age
ggplot(data=plotdat,mapping=aes(x=age,y=yield)) +
geom_point() +
geom_line() +
labs(y="Total yield (g)",x="Age") +
theme_bw()
#Recruitment based on a normal distribution
rec <- genRecruits(method = "normal", simyears = simyears,
meanR = 1000, sdR = 500, minR = 100, maxR =2500)
cm <- matrix(rep(c(rep(0,1), rep(0.18,(lhparms$tmax))), simyears),nrow=simyears,byrow=TRUE)
cf <- matrix(rep(c(rep(0,1), rep(0.33,(lhparms$tmax))), simyears),nrow=simyears,byrow=TRUE)
out_2<-dpmBH_MinLL(minLL = minLL, cf = cf, cm = cm,
recruitment_type = c("vector"), recv = rec, lhparms = lhparms,
simyears = simyears,
species="Striped Bass",group="landlocked",matchRicker=FALSE)
#Use summary by year data frame to plot yield vs year
ggplot(data=out_2[[2]],mapping=aes(x=year,y=PSD)) +
geom_point() +
geom_line() +
labs(y="PSD",x="Year") +
theme_bw()
#Plot date using summary by age
#Plot yield vs age for each year class
ggplot(data=out_2[[1]],mapping=aes(x=age,y=yield,group=yc,color=yc)) +
geom_point() +
geom_line() +
labs(y="Total yield (g)",x="Age") +
theme_bw()
#Recruitment based on a Ricker stock-recruitment model
cm <- matrix(rep(c(rep(0,1), rep(0.18,(lhparms$tmax))), simyears),nrow=simyears,byrow=TRUE)
cf <- matrix(rep(c(rep(0,1), rep(0.33,(lhparms$tmax))), simyears),nrow=simyears,byrow=TRUE)
SPRdat<- makeSPR(FLR = "linear", FLRint = -1057029, FLRslope = 2777.08, MatAge = 4,
percF=c(0,0,0,rep(0.50,27)),
percFSpawn = c(0,0,0,0.24,0.24,0.53,rep(1.00,24)))
out_3<-dpmBH_MinLL(minLL = minLL, cf = cf, cm = cm,
recruitment_type = c("stockrecruit"), srmod = c("Ricker"),
a = 6.8, b = 0.0025, sigmaR = 0.2, SPRdat = SPRdat,
lhparms = lhparms, simyears = simyears,
species="Striped Bass",group="landlocked",matchRicker=FALSE)
#Use summary by year data frame to plot yield vs year
out_3[[2]] |>
dplyr::filter(year>35) |> #Filter out years before equilibrium
ggplot(mapping=aes(x=year,y=PSD)) +
geom_point() +
geom_line() +
labs(y="PSD",x="Year") +
theme_bw()
#Plot date using summary by age
#Plot yield vs age for each year class
out_3[[1]] |>
dplyr::filter(year>35) |> #Filter out years before equilibrium
ggplot(mapping=aes(x=age,y=yield,group=yc,color=yc)) +
geom_point() +
geom_line() +
labs(y="Total yield (g)",x="Age") +
theme_bw()