| bbmFit | R Documentation |
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.
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)
obj |
The object to be subset |
it |
Iteration(s) to be extracted |
Input data. list, Containing the following information:
catch, indicesB, indicesP, perindicesB, perindicesP, control, f and nper.
Convergence code, vector(niter). Where 0 indicates successful completion.
For other possible error codes see ?optim.
Character string giving any additional information returned by the optimizer, or "".
Fit summary (with information on 'nlogL', 'nobs', 'nopar'), array[3,niter].
Estimated parameters in bbm function, FLPar[npar,niter], in linear scale.
Standard errors in parameters' estimates. FLPar[npar,niter], in linear scale.
Variance-covariance matrix, array[npar,npar,niter].
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.
Estimates of surveys' total abundances in biomass, FLQuants.
Estimates of surveys' percentage of recruits in biomass, FLQuants.
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
Same number of parameters required in params, params.se and vcov
You can inspect the class validity function by using
getValidity(getClassDef('bbmFit'))
All slots in the class have accessor methods defined that allow retrieving individual slots.
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 exist for various calculations based on values stored in the class:
Updates an FLStock with new information on the BBM assessment.
Calculates Pearson residuals, returns an object of class bbmFitresiduals.
Method to extract Log-Likelihood, returns an object of class logLik.
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.
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.
Extracts a subset of the iterations contained in a bbmFit object.
One plot for estimated abundances and one extra plot for each of the surveys with the fitting of total biomass and proportion of recruits.
Leire Ibaibarriaga & Sonia Sanchez
bbm, bbmFitresiduals, logLik, bbmFLPar, plot
# 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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.