Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

DistributionWrapper

Abstract DistributionWrapper Class


Description

Abstract class that cannot be constructed directly.

Details

Wrappers in distr6 use the composite pattern (Gamma et al. 1994), so that a wrapped distribution has the same methods and fields as an unwrapped one. After wrapping, the parameters of a distribution are prefixed with the distribution name to ensure uniqueness of parameter IDs.

Use listWrappers function to see constructable wrappers.

Value

Returns error. Abstract classes cannot be constructed directly.

Super class

distr6::Distribution -> DistributionWrapper

Methods

Public methods


Method new()

Creates a new instance of this R6 class.

Usage
DistributionWrapper$new(
  distlist = NULL,
  name,
  short_name,
  description,
  support,
  type,
  valueSupport,
  variateForm,
  parameters = NULL,
  outerID = NULL
)
Arguments
distlist

(list())
List of Distributions.

name

(character(1))
Wrapped distribution name.

short_name

(character(1))
Wrapped distribution ID.

description

(character())
Wrapped distribution description.

support

([set6::Set])
Wrapped distribution support.

type

([set6::Set])
Wrapped distribution type.

valueSupport

(character(1))
Wrapped distribution value support.

variateForm

(character(1))
Wrapped distribution variate form.

parameters

([ParameterSetCollection])
Optional parameters to add to the internal collection, ignored if distlist is given.

outerID

([ParameterSet])
Parameters added by the wrapper.


Method wrappedModels()

Returns model(s) wrapped by this wrapper.

Usage
DistributionWrapper$wrappedModels(model = NULL)
Arguments
model

(character(1))
id of wrapped Distributions to return. If NULL (default), a list of all wrapped Distributions is returned; if only one Distribution is matched then this is returned, otherwise a list of Distributions.


Method setParameterValue()

Sets the value(s) of the given parameter(s).

Usage
DistributionWrapper$setParameterValue(
  ...,
  lst = NULL,
  error = "warn",
  resolveConflicts = FALSE
)
Arguments
...

ANY
Named arguments of parameters to set values for. See examples.

lst

(list(1))
Alternative argument for passing parameters. List names should be parameter names and list values are the new values to set.

error

(character(1))
If "warn" then returns a warning on error, otherwise breaks if "stop".

resolveConflicts

(logical(1))
If FALSE (default) throws error if conflicting parameterisations are provided, otherwise automatically resolves them by removing all conflicting parameters.


Method clone()

The objects of this class are cloneable with this method.

Usage
DistributionWrapper$clone(deep = FALSE)
Arguments
deep

Whether to make a deep clone.

References

Gamma, Erich, Richard Helm, Ralph Johnson, and John Vlissides. 1994. “Design Patterns: Elements of Reusable Object-Oriented Software.” Addison-Wesley.

See Also


distr6

The Complete R6 Probability Distributions Interface

v1.5.2
MIT + file LICENSE
Authors
Raphael Sonabend [aut, cre] (<https://orcid.org/0000-0001-9225-4654>), Franz Kiraly [aut], Peter Ruckdeschel [ctb] (Author of distr), Matthias Kohl [ctb] (Author of distr), Nurul Ain Toha [ctb], Shen Chen [ctb], Jordan Deenichin [ctb], Chengyang Gao [ctb], Chloe Zhaoyuan Gu [ctb], Yunjie He [ctb], Xiaowen Huang [ctb], Shuhan Liu [ctb], Runlong Yu [ctb], Chijing Zeng [ctb], Qian Zhou [ctb]
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.