bbmFit: bbmFit class

bbmFitR Documentation

bbmFit class

Description

bbmFit class is used for storing the output of the bbm function. This includes abundance estimates in biomass (for recruits and adults) and information on the model fit.

Usage

bbmFit(object, ...)

## S4 method for signature 'missing'
bbmFit(
  object,
  years = "missing",
  niter = "missing",
  namesB = "missing",
  namesP = "missing",
  ...
)

## S4 method for signature 'FLStock,bbmFit'
e1 + e2

## S4 method for signature 'bbmFit'
residuals(object)

## S4 method for signature 'bbmFit'
logLik(object, ...)

## S4 method for signature 'bbmFit,ANY'
AIC(object, ..., k = 2)

## S4 method for signature 'bbmFit'
BIC(object, ...)

## S4 method for signature 'bbmFit'
iter(obj, it)

Arguments

obj

The object to be subset

it

Iteration(s) to be extracted

Slots

input

Input data. list, Containing the following information: catch, indicesB, indicesP, perindicesB, perindicesP, control, f and nper.

convergence

Convergence code, vector(niter). Where 0 indicates successful completion. For other possible error codes see ?optim.

message

Character string giving any additional information returned by the optimizer, or "".

fitSumm

Fit summary (with information on 'nlogL', 'nobs', 'nopar'), array[3,niter].

params

Estimated parameters in bbm function, FLPar[npar,niter], in linear scale.

params.se

Standard errors in parameters' estimates. FLPar[npar,niter], in linear scale.

vcov

Variance-covariance matrix, array[npar,npar,niter].

stock.bio

Estimated stock biomass for recruits and adults in the different seasons, where seasons are dertermined by the index times. FLQuant with two age classes: recruits and adults.

indicesB

Estimates of surveys' total abundances in biomass, FLQuants.

indicesP

Estimates of surveys' percentage of recruits in biomass, FLQuants.

Validity

Dimensions
  • age: stock.bio must be an FLQuant with only 2 age classes (recruits and adults) and each index in indicesB must be an FLQuant with only 1 age class ('all')

  • year, unit, season, area: equal for stock.bio, indicesB and indicesP

  • iter: equal for stock.bio, convergence, fitSumm, indicesB and indicesP

Parameters

Same number of parameters required in params, params.se and vcov

You can inspect the class validity function by using getValidity(getClassDef('bbmFit'))

Accessors

All slots in the class have accessor methods defined that allow retrieving individual slots.

Constructor

A construction method exists for this class that can take named arguments for any of its slots. All slots are then created to match the requirements of the class validity. If years, niter, namesB or namesP are provided, this is used for sizing and naming the different slots.

Methods

Methods exist for various calculations based on values stored in the class:

+

Updates an FLStock with new information on the BBM assessment.

residuals

Calculates Pearson residuals, returns an object of class bbmFitresiduals.

logLik

Method to extract Log-Likelihood, returns an object of class logLik.

AIC

Method to calculate Akaike's 'An Information Criterion' (AIC) of a bbmFit object from the value of the obtained log-likelihood stored in its logLik slot.

BIC

Method to calculate the Bayesian information criterion (BIC), also known as Schwarz's Bayesian criterion of a bbmFit object from the value of the obtained log-likelihood stored in its logLik slot.

iter

Extracts a subset of the iterations contained in a bbmFit object.

plot

One plot for estimated abundances and one extra plot for each of the surveys with the fitting of total biomass and proportion of recruits.

Author(s)

Leire Ibaibarriaga & Sonia Sanchez

See Also

bbm, bbmFitresiduals, logLik, bbmFLPar, plot

Examples


# Load data
data(ane)

# Generate an object of bbmFit class (different alternatives)
new("bbmFit")                # empty object
slotNames(bbmFit())          # slots

# bbmFit: setting dimensions for stock.bio
bbmFit( stock.bio = FLQuant(dim=c(2,20,1,3,1,1), dimnames=list(age=1:2, year=1980:1999))) 

# bbmFit: params class - FLPar with specific parameters for bbm function
bbmFit( params=bbmFLPar(years=dimnames(catch.ane)$year, 
                        namesB=names(indicesB.ane), namesP=names(indicesP.ane))) 

# Run assessment (output is of class bbmFit)
run <- bbm(catch.ane, indicesB=indicesB.ane, indicesP=indicesP.ane, control=control.ane, inits=inits.ane)
class(run)
run

# Plot
plot(run)


stock <- FLStock(catch.n=catch.ane, catch.wt=catch.ane*0+1)
units(stock@catch.wt) <- ''
stock@catch <- quantSums(stock@catch.n*stock@catch.wt)

newst <- stock + run # we must sum to the bbmFit object not to stock.bio(run)


# calculate residuals
residuals(run)

# log-Likelihood
logLik(run)

# AIC and BIC
AIC(run)

BIC(run)

flr/bbm documentation built on Sept. 6, 2022, 8:56 p.m.