An S4 class representing the extension of a method
Source:R/extended-method-class.R
ExtendedMethod-class.Rd
An object of class ExtendedMethod
is like a
Method
except it uses the output of another method in
addition to the Model
and
Draws
. We can also form chains of
ExtendedMethod
's, in which one ExtendedMethod
is taken to be
the "base_method
" of a subsequent ExtendedMethod
. This means
that the latter ExtendedMethod
would use the output of the former
ExtendedMethod
.
Details
While one can create an ExtendedMethod
from scratch,
typically it will be cleaner to write a MethodExtension
object
and then use the addition operator:
my_extended_method = my_base_method + my_method_extension
. For
example, if my_base_method
is the lasso, my_method_extension
might be cross-validation, and the resulting my_extended_method
would
be the lasso with tuning parameter chosen by cross-validation. The advantage
is that if we have several methods, we only have to write the
cross-validation MethodExtension
object once.
For an example in which one has a chain of ExtendedMethod
's, consider
the lasso example in which we have a MethodExtension
called, say,
refit
, which takes the nonzeros from the lasso's output and
performs least squares on these selected variables. Let cv
be another
MethodExtension
. Then, refitted_lasso = lasso + refit
is
an ExtendedMethod
and refitted_lasso + cv
is as well.
This class inherits from the Component
class.
Slots
name
a short name identifier. Must be alphanumeric.
label
a longer, human readable label that can have other characters such as spaces, hyphens, etc.
base_method
a list of length 1 containing the object of class
Method
orExtendedMethod
that is being extendedextended_method
a function with arguments "model", "draw", "out", and "base_method".