R/buffer_fxn.R

Defines functions get_buffer

Documented in get_buffer

#' Buffer calculation for U.S. West Coast Groundfish Stocks
#' Applies the time-varying sigma approach based on the 2019
#' approach.
#' @param years the years to generate buffer values for
#' @param sigma the sigma value to use (cat 1 = 0.50, cat 2 = 1.0, cat 3 = 2.0)
#' @param pstar managment uncertainty value (i.e., 0.45, 0.40)
#' @examples
#' get_buffer(years = 2011:2032, sigma = 1.0, pstar = 0.4)
#' @author written by Chantel Wetzel
#' @export
#'
get_buffer <- function(years, sigma, pstar){
	y = 1:(length(years) - 1)
	r = 0.075 # the rate of change in sigma approved by the SSC
	# This is the equation for the rate of change in sigma
	sigma_calc =  c(sigma, sigma * (1+(y-1)*r))
	buffer = exp(stats::qnorm(pstar, 0, sigma_calc))
	# Set the buffer for fixed catch years to 1.0
	buffer[1:2] = 1
	out = cbind(years, round(buffer, 3))
	return(out)
}
nwfsc-assess/PEPtools documentation built on Nov. 7, 2023, 1:33 p.m.