To calculate the status of global fish stocks from the SAUP 2021 catch data we use catch-MSY (CMSY) developed by Martell and Froese (2012). This model requires catch and resilience information for each stock. Stocks are defined by FAO areas and are limited to only those records where catch is reported at the species level.
The datalimited
R package, developed by Sean Anderson, is used to run CMSY.
To install the datalimited
package:
install.packages("remotes")
::install_github("datalimited/datalimited") remotes
::opts_chunk$set(fig.width = 6, fig.height = 4, fig.path = 'figs/',message = FALSE, warning = FALSE)
knitr
#devtools::install_github("datalimited/datalimited")
library(datalimited) #has the 4 catch only models
library(tidyverse)
library(doParallel)
library(here)
setwd(here::here("globalprep/fis/v2021"))
registerDoParallel(cores = 5)
source(here('workflow/R/common.R'))
Read in catch data aggregated from half degree cell to OHI region catch_data_prep.Rmd.
<- read_csv('output/stock_catch.csv') %>%
catch rename(common = CommonName)
If the CMSY values have already been calculated for each stock, this step can be skipped:
# calculate cmsy values and create a .rds file that is saved on Mazu
<- plyr::dlply(catch, c("stock_id", "common"), function(x) {
cmsy_fits
#make sure the data is ordered from 1950 to 2010
<- arrange(x,year)
x
<- cmsy(ct = x$tons, yr = x$year, start_r = resilience(x$Resilience[1]),
out reps = 2e4)
$year <- x$year
out
out
.parallel = TRUE)
},
saveRDS(cmsy_fits, file = file.path(dir_M,"git-annex/globalprep/fis/v2021/int/cmsy-fits.rds"))
Take output and format:
<- readRDS(file.path(dir_M,"git-annex/globalprep/fis/v2021/int/cmsy-fits.rds"))
cmsy_fits
<- data.frame(bbmsy_q2.5 = NA, bbmsy_q25 = NA, bbmsy_q50 = NA,
fake_data bbmsy_q75 = NA, bbmsy_q97.5 = NA)
<- plyr::ldply(cmsy_fits, function(x) {
cmsy_bbmsy <- x$biomass[, -1] / x$bmsy
bbmsy_cmsy <- tryCatch({
bbmsy_out <- summarize_bbmsy(bbmsy_cmsy)
bbmsy_out $year <- x$year
bbmsy_outerror = function(e) fake_data)
bbmsy_out},
})
$model <- "CMSY"
cmsy_bbmsy
write.csv(cmsy_bbmsy,file='output/cmsy_bbmsy.csv', row.names=FALSE)
Explore why there are some NAs (I think non convergance)
<- read_csv("output/cmsy_bbmsy.csv")
cmsy_bbmsy
<- cmsy_bbmsy %>%
nas group_by(stock_id)%>%
summarize(m = mean(bbmsy_mean))%>%
filter(is.na(m))
nrow(nas)
Looking at mean bbmsy for 2014
<- read_csv('output/cmsy_bbmsy.csv') %>%
results filter(year == 2014)
hist(results$bbmsy_mean)
Why are so many around 0.5 (extracting half of maximum sustainable yield)?
.5 <- results %>%
stocks_0filter(bbmsy_mean < 0.6,
> 0.4) bbmsy_mean