eqsr_fit: Stock recruitment fitting

View source: R/eqsr_fit.R

eqsr_fitR Documentation

Stock recruitment fitting

Description

Fits one or more stock recruitment relationship to data containted in an FLStock object. If more than one stock recruit relationship is provided, the models are weighted based on smooth AIC weighting (See Buckland et al., 1997).

Usage

eqsr_fit(
  stk,
  nsamp = 1000,
  models = c("Ricker", "Segreg", "Bevholt"),
  id.sr = FLCore::name(stk),
  remove.years = NULL,
  rshift = 0
)

Arguments

stk

FLStock object

nsamp

Number of samples (iterations) to take from the stock recruitment fit (default is 1000). If 0 (zero) then only the fits to the data are returned and no simulations are made.

models

A character vector containing stock recruitment models to use in the model averaging. User can set any combination of "Ricker", "Segreg", "Bevholt", "Smooth_hockey".

id.sr

A character vector specifying an id or name for the stock recruitment fit being run. The default is to use the slot "name" in the stk parameter is provided

remove.years

A vector specifying the years to remove from the model fitting.

rshift

lag ssb by aditional years (default = 0). As an example, for some herring stocks, age 1 (1 winter ring) fish were spawned 2 years previously, in this case, rshift = 1.

Value

A list containing the following objects:

  • 'sr.sto' data.frame containing the alpha (a), beta (b), cv and model names. The number of rows correspond to the value set of 'nsamp' in the function call.

  • 'sr.det' The parameters in the stock recruitment model corresponding to the "best fit" of any given model.

  • 'stk' An FLStock object, same as provided as input by the user.

  • 'rby' A data.frame containing the recruitment (rec), spawning stock biomass (ssb) and year used in the fitting of the data.

  • 'id.sr' A string containing run name (taken from the 'id.sr' argument)

References

Buckland, S.T., K.P. Burnham & N.H. Augustin (1997). Model selection: An integral part of inference. Biometrics 53, 603-618. DOI: 10.2307/2533961

See Also

eqsr_plot plots a simulation of predictive recruitment from the fit, and shows a summary of the contributions of each stock recruitment model to the model average fit.

Examples

data(icesStocks)
FIT <- eqsr_fit(icesStocks$saiNS,
                nsamp = 0,
                models = c("Ricker", "Segreg"))

# summary of individual fits
FIT$sr.det
eqsr_plot(FIT)

# fit a bounded segmented regression
Segreg_bounded  <- function(ab, ssb) {
  ab$b <- min_ssb + ab$b
  Segreg(ab, ssb)
}
min_ssb <- min(FLCore::ssb(icesStocks$saiNS))

FIT <- eqsr_fit(icesStocks$saiNS,
                nsamp = 0,
                models = c("Segreg", "Segreg_bounded"))

# summary of individual fits
FIT$sr.det
FIT$sr.det$b[2] + min_ssb
eqsr_plot(FIT)

## Not run: 
FIT <- eqsr_fit(icesStocks$saiNS,
                nsamp = 2000,
                models = c("Segreg", "Segreg_bounded"))

# summary of individual fits
FIT$sr.det
eqsr_plot(FIT)

## End(Not run)


ices-tools-prod/msy documentation built on Nov. 3, 2022, 6:41 p.m.