Jump to Introduction

Jump to Packages

Jump to HCRs

Jump to More Information

Jump to References

Back to Top

Introduction

Packages

FLR

library(FLCore)
library(FLBRP)
library(FLasher)
library(FLife)
library(ggplotFL)

library(FLCandy)

Plotting and Data wrangling

library(plyr)
library(dplyr)
library(reshape)
library(ggplot2)
theme_set(theme_bw())

library(ggpubr)
library(ggcorrplot)
library(GGally)

Back to Top

HCRs

eq=lhEql(lhPar(FLPar(linf=100,s=0.6)))

refpts(eq)=properties(eq)

plot(eq,panel=3)

eq1=eq
fbar(eq1)=FLQuant(rep(refpts(eq)[,"harvest",drop=T],each=101),
                 dimnames=dimnames(propagate(fbar(eq),7)))
om =as(eq1,"FLStock")
om =fwd(om,fbar=fbar(om)[,-1],sr=eq)

om1=iter(om,1)
om2=iter(om,2)
om3=iter(om,4)
om1=fwd(om1,fbar=fbar(eq1)[,-1],sr=eq)
om2=fwd(om2,fbar=fbar(eq1)[,-1],sr=eq)
om3=fwd(om3,fbar=fbar(eq1)[,-1],sr=eq)

eq2=eq
fbar(eq2)=FLQuant(c(seq(0,1,length.out=21),
                   rep(1,50))*c(refpts(eq2)["msy","harvest"]))
dat=rbind(cbind(What=2,model.frame(FLQuants(om2[,-1],SSB=ssb,Yield=catch),drop=T)),
          cbind(What=3,model.frame(FLQuants(om3[,-1],SSB=ssb,Yield=catch),drop=T)))
ggplot(dat)+
  geom_line(aes(SSB,Yield),data=model.frame(FLQuants(eq,SSB=ssb,Yield=catch)))+
  geom_path( aes(SSB,Yield,group=iter,col =ac(iter)))+
  geom_point(aes(SSB,Yield,group=iter,fill=ac(iter)),shape=21,col="grey50")+
  facet_grid(What~.)

hcr<-function(ssb,eq){
 trgt=(ssb%=%1)%*%refpts(eq)["msy","harvest"]
 rtn =(ssb%/%refpts(eq)["msy","ssb"])%*%refpts(eq)["msy","harvest"]
 
 rtn=qmin(trgt,rtn)
 dimnames(rtn)$year=ac(an(dimnames(rtn)$year)+1)
 rtn}

om2.=iter(om2,1)
om3.=iter(om3,1)
for (iYr in dimnames(om1)$year[-dim(om1)[2]]){
  om2.=fwd(om2.,fbar=hcr(ssb(om2.[,iYr]),eq),sr=eq)
  om3.=fwd(om3.,fbar=hcr(ssb(om3.[,iYr]),eq),sr=eq)}

dat=rbind(cbind(What=2,model.frame(FLQuants(om2.[,-1],SSB=ssb,Yield=catch,F=fbar),drop=T)),
          cbind(What=3,model.frame(FLQuants(om3.[,-1],SSB=ssb,Yield=catch,F=fbar),drop=T)))
ggplot(dat)+
  geom_line( aes(SSB,Yield),data=model.frame(FLQuants(eq,SSB=ssb,Yield=catch)))+
  geom_path( aes(SSB,Yield,group=What),col="grey")+
  geom_point(aes(SSB,Yield,group=What),shape=21)+
  facet_grid(What~.)

More Information

Author information

Laurence Kell.

Acknowledgements

Software Versions

R version 4.2.1 (2022-06-23)

  • knitr: 1.43

  • FLCore: 2.6.19.9105

  • FLBRP: 2.5.9.9022

  • FLasher: 0.7.1.9221

  • FLife: 3.4.0

  • ggplotFL: 2.7.0.9132

  • FLCandy: 0.1.0

  • rfishbase: 3.1.9.99

  • SPMpriors: 1.0.4

  • FishLife: 3.0.0

  • plyr: 1.8.9

  • dplyr: 1.1.4

  • reshape: 0.8.9

  • ggplot2: 3.4.4

  • ggpubr: 0.6.0

  • ggcorrplot: 0.1.3

  • GGally: 2.1.2

Compiled: Sun Jan 21 12:40:24 2024

Back to Top

References

Back to Top

References

Back to Top


  1. http://flr-project.org↩︎