FLife package

library(knitr)
## Global options
opts_chunk$set(cache     =!TRUE,
               echo      =TRUE,
               eval      =TRUE,
               prompt    =FALSE,
               comment   =NA,
               message   =FALSE,
               warning   =FALSE,
               tidy      =FALSE,
               fig.height=6,
               fig.width =8)

iFig=0
library(ggplotFL)
library(plyr)
library(reshape)
library(FLBRP)
library(FLife)
theme_set(theme_bw())
options(digits=3)

Life history parameters

data(wklife)

wklife
library(GGally)

my_smooth <- function(data,mapping,...){
  ggplot(data=data,mapping=mapping)+
  geom_point(...,size=.5)+
  geom_smooth(...,method="lm",se=FALSE)}

my_density <- function(data,mapping,...){
  ggplot(data=data,mapping=mapping)+
  geom_density(...,lwd=1)}

ggpairs(transform(wklife[,-c(1:5,10:11)],linf=log(linf),k=log(k),l50=log(l50)),
  lower = list(continuous = wrap(my_smooth)),
  diag=list(continuous=wrap(my_density,alpha=0.2)),
  title = "")+
  theme(legend.position ="none",
  panel.grid.major =element_blank(),
  axis.ticks       =element_blank(),
  axis.text.x      =element_blank(),
  axis.text.y      =element_blank(),
  panel.border     =element_rect(linetype = 1, colour="black", fill=NA))

Figure r iFig=iFig+1; iFig Pairwise scatter plots of life history parameters.

Equilibrium Dynamics

Create an FLPar

wkpar=as(wklife[,6:13],"FLPar")
attributes(wkpar)[names(wklife)[1:5]]=wklife[,1:5]

Then use life history relationships to estimate missing values

par <- lhPar(wkpar)

and then to derive vectors for processses such as natural mortality

eql=lhEql(par)
sel<-function(x) 
  catch.sel(x)%/%fapex(catch.sel(x))

ggplot(FLQuants(eql,"m","catch.sel"=sel,"mat","catch.wt"))+
  geom_line(aes(age,data,col=attributes(wkpar)$stock[as.numeric(iter)]))+
  facet_wrap(~qname,scale="free")+
  scale_x_continuous(limits=c(0,15))+
  guides(colour=guide_legend(title="Species",title.position="top"))

Figure r iFig=iFig+1; iFig Vectors of m, selection pattern, maturity and weight-at-age.

and estimate equilibrium dynamics and reference points, e.g. for lemon sole

plot(iter(eql,3))

Figure r iFig=iFig+1; iFig Equilibrium curves for ling.

Simulation

Create a forward projection, i.e. an FLStock from an equilibrium object

lmsl=as(iter(eql,7),"FLStock")

units(mat(lmsl))="NA"
units(harvest(lmsl))="f"
plot(lmsl)

Figure r iFig=iFig+1; iFig Simulate a stock with increasing F

Software Versions

Author information

Laurence KELL. laurie.kell.es

Acknowledgements

This vignette and many of the methods documented in it were developed under the MyDas project funded by the Irish exchequer and EMFF 2014-2020. The overall aim of MyDas is to develop and test a range of assessment models and methods to establish Maximum Sustainable Yield (MSY) reference points (or proxy MSY reference points) across the spectrum of data-limited stocks.

References {#References}



flr/FLife documentation built on March 29, 2024, 5:50 p.m.