Functionality to decorate R6 Distributions (and child classes) with extra methods.
distribution to decorate
list or vector of decorators. See Details.
Returns a decorated R6 object inheriting from class SDistribution with the methods listed from one of the available decorators added to the SDistribution methods.
Decorating is the process of adding methods to classes that are not part of the core
interface (Gamma et al. 1994). Use
listDecorators to see which decorators are currently available. The primary
use-cases are to add numeric results when analytic ones are missing, to add complex modelling functions and
to impute missing d/p/q/r functions.
decorators parameter should either be a list of decorator classes or their names
or a single decorator class; see examples.
Gamma, Erich, Richard Helm, Ralph Johnson, and John Vlissides. 1994. “Design Patterns: Elements of Reusable Object-Oriented Software.” Addison-Wesley.
listDecorators for available decorators.
B <- Binomial$new() decorate(B, CoreStatistics)#>#> Binom(prob = 0.5, size = 10)E <- Exponential$new() decorate(E, list(CoreStatistics, ExoticStatistics))#>#> Exp(rate = 1)E <- Exponential$new() decorate(E, list(CoreStatistics, "ExoticStatistics"))#>#> Exp(rate = 1)E <- Exponential$new() decorate(E, c("CoreStatistics", "ExoticStatistics"))#>#> Exp(rate = 1)