The repository for the msy package is located on github, more specifically on github.com/wgmg/msy. A more recent version (potentially unstable) can sometimes be found at github.com/einarhjorleifsson/msy.
The easiest way to install the msy package is to use the function install_github in the devtools package. Since the input into the msy is in the form of a FLStock object it is advised to obtain the latest release of FLCore from the same site.
The Rtools.exe software is needed for building packages under Microsoft Windows.
Run the following lines to install the latest versions of msy and FLCore.
# install.packages("devtools")
library(devtools)
install_github("flr/FLCore")
install_github("einarhjorleifsson/msy")
# to get a "manual" one could also do (this takes longer time)
# install_github("einarhjorleifsson/msy",build_vignettes = TRUE)
The above is equivalent to install.packages and hence need only to be performed once. However, since the msy package is currently under development (including bug-fixing) one may expect more frequent code updating in the package than what one may be familiar with for packages on CRAN. Once installed the msy packages is simply loaded via the familiar:
library(msy)
# if manual was installed (see above) one can do:
# vignette("msy")
attach("WBC_stock_object_20150313.RData")
FIT <- eqsr_fit(wbc.stk,
nsamp = 1000,
models = c("Ricker", "Segreg", "Bevholt"))
SIM <- eqsim_run(FIT,
bio.years = c(2004, 2013),
sel.years = c(2004, 2013),
Fscan=seq(0,1,len=40),
Fcv=0.25,
Fphi=0.55,
Blim=136000,
Bpa=220000,
Btrigger=0,
verbose=FALSE)
The stock recruitment function can be plotted by:
eqsr_plot(FIT,n=2e4)
Summary of the key results can be obtained by:
SIM$Refs
F05 F10 F50 medianMSY meanMSY FCrash05
catF 1.403e-01 1.887e-01 4.108e-01 2.821e-01 2.308e-01 9.487e-01
lanF NA NA NA 2.821e-01 2.308e-01 NA
catch 4.496e+04 4.825e+04 4.733e+04 4.961e+04 4.945e+04 2.412e+04
landings NA NA NA 4.961e+04 4.945e+04 NA
catB 3.356e+05 2.739e+05 1.360e+05 1.965e+05 2.337e+05 3.495e+04
lanB NA NA NA 1.965e+05 2.337e+05 NA
FCrash50
catF NA
lanF NA
catch NA
landings NA
catB NA
lanB NA
Summary plots conditioned on maximizing catch are obtained by:
eqsim_plot(SIM,catch=TRUE)
Summary plots of Fmsy range (WKMSYREF3) are obtained by:
eqsim_plot_range(SIM, type="mean")
eqsim_plot_range(SIM, type="median")
eqsim_plot_range(SIM, type="ssb")
eqsim_plot_range(SIM, type="carmen")
The calculation associated with the \(F_{msy}\) range values (and then some) can be accessed simply by:
SIM$Refs2
F05 F10 F50 medianMSY meanMSY Medlower
catF 1.403e-01 1.887e-01 4.108e-01 NA 2.308e-01 NA
lanF NA NA NA 2.633e-01 2.308e-01 1.672e-01
catch 4.496e+04 4.825e+04 4.733e+04 NA 4.945e+04 NA
landings NA NA NA 4.968e+04 4.945e+04 4.723e+04
catB 3.356e+05 2.739e+05 1.360e+05 NA 2.337e+05 NA
lanB NA NA NA 2.088e+05 2.337e+05 2.980e+05
Meanlower Medupper Meanupper
catF NA NA NA
lanF 1.602e-01 4.174e-01 3.436e-01
catch NA NA NA
landings 3.013e+11 4.718e+04 3.010e+11
catB NA NA NA
lanB NA 1.337e+05 NA
FIT2 <- eqsr_fit(wbc.stk,
nsamp = 1000,
models = c("Segreg"))
SIM2 <- eqsim_run(FIT2,
bio.years = c(2004, 2013),
sel.years = c(2004, 2013),
Fscan=seq(0,1,len=40),
Fcv=0.25,
Fphi=0.55,
Blim=136000,
Bpa=220000,
Btrigger=0,
verbose=FALSE)
The stock recruitment function can be plotted by:
eqsr_plot(FIT2,n=2e4)
Summary of the key results can be obtained by:
SIM2$Refs
F05 F10 F50 medianMSY meanMSY FCrash05
catF 1.042e-01 1.418e-01 3.246e-01 2.821e-01 2.821e-01 9.231e-01
lanF NA NA NA 2.821e-01 2.821e-01 NA
catch 3.117e+04 3.486e+04 3.836e+04 3.860e+04 3.860e+04 2.113e+04
landings NA NA NA 3.860e+04 3.860e+04 NA
catB 3.142e+05 2.635e+05 1.361e+05 1.549e+05 1.549e+05 3.151e+04
lanB NA NA NA 1.549e+05 1.549e+05 NA
FCrash50
catF NA
lanF NA
catch NA
landings NA
catB NA
lanB NA
Summary plots conditioned on maximizing catch are obtained by:
eqsim_plot(SIM2,catch=TRUE)
Summary plots of Fmsy range (WKMSYREF3) are obtained by:
eqsim_plot_range(SIM2, type="mean")
eqsim_plot_range(SIM2, type="median")
eqsim_plot_range(SIM2, type="ssb")
eqsim_plot_range(SIM2, type="carmen")
The calculation associated with the \(F_{msy}\) range values (and then some) can be accessed simply by:
SIM2$Refs2
F05 F10 F50 medianMSY meanMSY Medlower
catF 1.042e-01 1.418e-01 3.246e-01 NA 2.821e-01 NA
lanF NA NA NA 2.713e-01 2.821e-01 1.712e-01
catch 3.117e+04 3.486e+04 3.836e+04 NA 3.860e+04 NA
landings NA NA NA 3.862e+04 3.860e+04 3.669e+04
catB 3.142e+05 2.635e+05 1.361e+05 NA 1.549e+05 NA
lanB NA NA NA 1.604e+05 1.549e+05 2.315e+05
Meanlower Medupper Meanupper
catF NA NA NA
lanF 1.719e-01 4.424e-01 0.447
catch NA NA NA
landings 4.187e+04 3.668e+04 41853.967
catB NA NA NA
lanB NA 9.954e+04 NA
segreg3 <- function(ab, ssb) log(ifelse(ssb >= 27421 , ab$a * 27421 , ab$a * ssb))
FIT3 <- eqsr_fit(wbc.stk, nsamp = 1000, models = "segreg3")
SIM3 <- eqsim_run(FIT3,
bio.years = c(2004, 2013),
sel.years = c(2004, 2013),
Fscan=seq(0,1,len=40),
Fcv=0.25,
Fphi=0.55,
Blim=136000,
Bpa=220000,
Btrigger=0,
verbose=FALSE)
The stock recruitment function can be plotted by:
eqsr_plot(FIT3,n=2e4)
Summary of the key results can be obtained by:
SIM3$Refs
F05 F10 F50 medianMSY meanMSY FCrash05
catF 9.451e-02 1.293e-01 2.708e-01 2.821e-01 2.821e-01 8.974e-01
lanF NA NA NA 2.821e-01 2.821e-01 NA
catch 2.527e+04 2.884e+04 3.273e+04 3.273e+04 3.273e+04 2.101e+04
landings NA NA NA 3.273e+04 3.273e+04 NA
catB 2.805e+05 2.358e+05 1.360e+05 1.309e+05 1.309e+05 3.203e+04
lanB NA NA NA 1.309e+05 1.309e+05 NA
FCrash50
catF NA
lanF NA
catch NA
landings NA
catB NA
lanB NA
Summary plots conditioned on maximizing catch are obtained by:
eqsim_plot(SIM3,catch=TRUE)
Summary plots of Fmsy range (WKMSYREF3) are obtained by:
eqsim_plot_range(SIM3, type="mean")
eqsim_plot_range(SIM3, type="median")
eqsim_plot_range(SIM3, type="ssb")
eqsim_plot_range(SIM3, type="carmen")
The calculation associated with the \(F_{msy}\) range values (and then some) can be accessed simply by:
SIM3$Refs2
F05 F10 F50 medianMSY meanMSY Medlower
catF 9.451e-02 1.293e-01 2.708e-01 NA 2.821e-01 NA
lanF NA NA NA 2.673e-01 2.821e-01 1.682e-01
catch 2.527e+04 2.884e+04 3.273e+04 NA 3.273e+04 NA
landings NA NA NA 3.276e+04 3.273e+04 3.111e+04
catB 2.805e+05 2.358e+05 1.360e+05 NA 1.309e+05 NA
lanB NA NA NA 1.374e+05 1.309e+05 1.984e+05
Meanlower Medupper Meanupper
catF NA NA NA
lanF 1.719e-01 4.394e-01 4.489e-01
catch NA NA NA
landings 3.457e+04 3.111e+04 3.457e+04
catB NA NA NA
lanB NA 8.491e+04 NA
devtools::session_info()
Session info --------------------------------------------------------------
setting value
version R version 3.1.2 (2014-10-31) system x86_64, linux-gnu
ui X11
language (EN)
collate en_US.UTF-8
tz Atlantic/Reykjavik
Packages ------------------------------------------------------------------
package * version date
devtools * 1.7.0 2015-01-17 digest * 0.6.4 2013-12-03 evaluate * 0.5.3 2014-03-29 FLCore * 2.5.20150309 2015-03-13 formatR * 1.0 2014-08-25 htmltools * 0.2.6 2014-09-08 knitr * 1.6 2014-05-25 lattice * 0.20-29 2014-04-04 MASS * 7.3-35 2014-09-30 msy 0.1.16 2015-03-20 plyr * 1.8.1 2014-02-26 Rcpp * 0.11.3 2014-09-29 rmarkdown * 0.3.10 2014-12-04 rstudioapi * 0.2 2014-12-31 stringr * 0.6.2 2012-12-06 yaml * 2.1.7 2013-03-05 source
CRAN (R 3.1.2)
CRAN (R 3.0.2)
CRAN (R 3.0.2)
Github (flr/FLCore@48e8aeb)
CRAN (R 3.1.1)
CRAN (R 3.1.1)
CRAN (R 3.0.2)
CRAN (R 3.1.1)
CRAN (R 3.1.1)
Github (einarhjorleifsson/msy@0b2a879) CRAN (R 3.0.2)
CRAN (R 3.1.1)
Github (rstudio/rmarkdown@b96214b)
CRAN (R 3.1.2)
CRAN (R 3.1.2)
CRAN (R 3.0.1)