preFit {latrend} | R Documentation |
lcMethod
estimation step: method preparation logic
Description
Note: this function should not be called directly, as it is part of the lcMethod
estimation procedure.
For fitting an lcMethod
object to a dataset, use the latrend()
function or one of the other standard estimation functions.
The preFit()
function of the lcMethod
object performs preparatory work that is needed for fitting the method but should not be counted towards the method estimation time.
The work is added to the provided environment
, allowing the fit()
function to make use of the prepared work.
Usage
preFit(method, data, envir, verbose, ...)
## S4 method for signature 'lcMethod'
preFit(method, data, envir, verbose)
Arguments
method |
An object inheriting from |
data |
A |
envir |
The |
verbose |
A R.utils::Verbose object indicating the level of verbosity. |
... |
Not used. |
Value
The updated environment
that will be passed to fit()
.
Implementation
setMethod("preFit", "lcMethodExample", function(method, data, envir, verbose) { # update envir with additional computed work envir$x <- INTENSIVE_OPERATION return(envir) })
Estimation procedure
The steps for estimating a lcMethod
object are defined and executed as follows:
-
compose()
: Evaluate and finalize the method argument values. -
validate()
: Check the validity of the method argument values in relation to the dataset. -
prepareData()
: Process the training data for fitting. -
preFit()
: Prepare environment for estimation, independent of training data. -
fit()
: Estimate the specified method on the training data, outputting an object inheriting fromlcModel
. -
postFit()
: Post-process the outputtedlcModel
object.
The result of the fitting procedure is an lcModel object that inherits from the lcModel
class.