library(knitr) ## Global options opts_chunk$set(cache =TRUE, cache.path='cache/performance/', echo =TRUE, eval =TRUE, prompt =FALSE, comment =NA, message =FALSE, warning =FALSE, tidy =FALSE, fig.height=6, fig.width =8, fig.path ='tex/performance-') iFig=0 options(digits=3)
library(plyr) library(reshape) library(ggplot2)
library(FLCore) library(FLasher) library(FLBRP) library(FLife) library(mydas)
options(scipen = 999) library(DBI) library(RPostgreSQL) drv = dbDriver("PostgreSQL") con = dbConnect(drv, host = 'postgresql-seascope.csffkpr9jjjn.eu-west-2.rds.amazonaws.com', dbname='FLRout', port = 5432, user = 'MydasApplication', password = 'gmit2017!') mpb = dbGetQuery(con1, paste("select* from mpb where spp = 'turbot' and year < 94")) ss_labels = c("0.7"="Ftar=0.7", "1"="Ftar=1") ggplot(mpb, aes(as.factor(year), ssb/msy_ssb,fill=as.factor(btrig)))+ geom_boxplot(outlier.size=0.1, position=position_dodge(1),width=0.8, lwd=0.05, notch=TRUE)+ stat_summary(fun.y=mean, geom="line", aes(group=1))+ geom_hline(aes(yintercept=1), size=0.75, colour= "red", linetype="dashed")+ facet_wrap(~ftar,ncol=1, labeller = labeller(ftar = ss_labels),scale="free_y") + theme_bw() + theme(panel.grid.major = element_blank(), text = element_text(size=14), panel.grid.minor = element_blank(), strip.background = element_blank(), panel.border = element_rect(colour = "black"), legend.position="bottom") + scale_colour_manual(values=c("white", "#56B4E9"), labels=c("0.5","0.6")) + scale_fill_manual(name=expression(B[trig]),values=c("white", "#56B4E9"), labels=c("0.5","0.6")) + scale_x_discrete(breaks = c(50,60,70,80,90))+ scale_y_continuous(breaks = c(0:5))+ xlab("year")+ylab(expression(B/B[MSY])) ggplot(mpb, aes(as.factor(year), catch/msy_yield,fill=as.factor(btrig)))+ geom_boxplot(outlier.size=0.1, position=position_dodge(1),width=0.8, lwd=0.05, notch=TRUE)+ stat_summary(fun.y=mean, geom="line", aes(group=1))+ geom_hline(aes(yintercept=1), size=0.75, colour= "red", linetype="dashed")+ facet_wrap(~ftar,ncol=1, labeller = labeller(ftar = ss_labels),scale="free_y") + theme_bw() + theme(panel.grid.major = element_blank(), text = element_text(size=14), panel.grid.minor = element_blank(), strip.background = element_blank(), panel.border = element_rect(colour = "black"), legend.position="bottom") + scale_colour_manual(values=c("white", "#56B4E9"), labels=c("0.5","0.6")) + scale_fill_manual(name=expression(B[trig]),values=c("white", "#56B4E9"), labels=c("0.5","0.6")) + scale_x_discrete(breaks = c(50,60,70,80,90))+ scale_y_continuous(breaks = c(0:5))+ xlab("year")+ylab(expression(catch/catch[MSY])) ggplot(mpb,aes(as.factor(year), fbar/msy_harvest,fill=as.factor(btrig)))+ geom_boxplot(outlier.size=0.1, position=position_dodge(1),width=0.8, lwd=0.05, notch=TRUE)+ stat_summary(fun.y=mean, geom="line", aes(group=1))+ geom_hline(aes(yintercept=1), size=0.75, colour= "red", linetype="dashed")+ facet_wrap(~ftar,ncol=1, labeller = labeller(ftar = ss_labels),scale="free_y") + theme_bw() + theme(panel.grid.major = element_blank(), text = element_text(size=14), panel.grid.minor = element_blank(), strip.background = element_blank(), panel.border = element_rect(colour = "black"), legend.position="bottom") + scale_colour_manual(values=c("white", "#56B4E9"), labels=c("0.5","0.6")) + scale_fill_manual(name=expression(B[trig]),values=c("white", "#56B4E9"), labels=c("0.5","0.6")) + scale_x_discrete(breaks = c(50,60,70,80,90))+ scale_y_continuous(breaks = c(0:5))+ xlab("year")+ylab(expression(f/f[MSY]))
data(om)
plot(om,iter=7:9)
Figure r iFig=iFig+1; iFig
Operating model example for turbot with indiviual random Monte Carlo simulations.
data(eq) plot(FLQuants(window(om,30), F =function(x) fbar(x)%/%fmsy(eq), SSB=function(x) ssb(x)%/%bmsy(eq)) ,iter=7:9)+ xlab("Year")
Figure r iFig=iFig+1; iFig
Operating model example F and SSB relative to $F_{MSY}$ and $B_{MSY}$, with indiviual random Monte Carlo simulations.
head(omSmry(om))
head(omSmry(om,eq))
lh=FLPar(c(a=0.01111,b=3.15)) head(omSmry(om,eq,lh))
stats=omSmry(om,eq,lh)
library(dplyr) plot(FLQuants(ssb =as.FLQuant(transmute(stats,data=ssb, year=year,iter=iter)), sln =as.FLQuant(transmute(stats,data=sln, year=year,iter=iter)), sage=as.FLQuant(transmute(stats,data=sage,year=year,iter=iter)), swt =as.FLQuant(transmute(stats,data=swt, year=year,iter=iter))), iter=7)
Figure r iFig=iFig+1; iFig
Indicators for ssb.
plot(FLQuants(biomass=as.FLQuant(transmute(stats,data=stock, year=year,iter=iter)), cln =as.FLQuant(transmute(stats,data=cln, year=year,iter=iter)), cage =as.FLQuant(transmute(stats,data=cage, year=year,iter=iter)), cwt =as.FLQuant(transmute(stats,data=cwt, year=year,iter=iter))), iter=7)
Figure r iFig=iFig+1; iFig
Indicators for catch.
r version$version.string
r packageVersion('FLCore')
r # packageVersion('FLPKG')
r date()
r system("git log --pretty=format:'%h' -n 1", intern=TRUE)
Laurence KELL. laurie@seaplusplus.co.uk
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.