FLModel | R Documentation |
A virtual class for statistical models
FLModel(model, ...)
The FLModel
class provides a virtual class that developers of various
statistical models can use to implement classes that allow those models to
be tested, fitted and presented.
Slots in this class attempt to map all the usual outputs for a modelling
exercise, together with the standard inputs. Input data are stored in slots
created by a specified class based on FLModel
. See for example
FLSR
for a class used for stock-recruitment models.
The initial
slot contains a function used to obtain initial values for
the numerical solver. It can also contain two attributes, upper
and
lower
that limit the sarch area for each parameter.
Various fitting algorithms, similar to those present in the basic R packages,
are currently available for FLModel
, including fmle
,
nls-FLCore
and glm
.
Name of the object, character
.
Description of the object, character
.
Range, numeric
.
Associated error probability dfistribution, factor
.
Estimated values, FLQuant
.
Residuals obtained from the model fit, FLQuant
.
Model formula, formula
.
Function returning the gradient of the likelihood, function
.
Log-likelihood function. function
.
Function returning initial parameter values for the
optimizer, as an object of class FLPar
, function
.
Estimated parameter values, FLPar
.
Value of the log-likelihood, logLik
.
Variance-covariance matrix, array
.
Hessian matrix obtained from the parameter fitting, array
.
extra information on the model fit procedure, list
.
The FLR Team
AIC, BIC, fmle, nls, FLComp
# Normally, FLModel objects won't be created if "class" is not set
summary(FLModel(length~width*alpha))
# Objects of FLModel-based classes use their own constructor,
# which internally calls FLModel
fsr <- FLModel(rec~ssb*a, class='FLSR')
is(fsr)
summary(fsr)
# An example constructor method for an FLModel-based class
# Create class FLGrowth with a single new slot, 'mass'
setClass('FLGrowth', representation('FLModel', mass='FLArray'))
# Define a creator method based on FLModel
setGeneric("FLGrowth", function(object, ...) standardGeneric("FLGrowth"))
setMethod('FLGrowth', signature(object='ANY'),
function(object, ...) return(FLModel(object, ..., class='FLGrowth')))
setMethod('FLGrowth', signature(object='missing'),
function(...) return(FLModel(formula(NULL), ..., class='FLGrowth')))
# Define an accessor method
setMethod('mass', signature(object='FLGrowth'),
function(object) return(slot(object, 'mass')))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.