A generalised distribution object for defining custom probability distributions as well as serving as the parent class to specific, familiar distributions.

Value

Returns R6 object of class Distribution.

Constructor

Distribution$new(name = NULL, short_name = NULL, type = NULL, support = NULL, symmetric = FALSE, pdf = NULL, cdf = NULL, quantile = NULL, rand = NULL, parameters = NULL, decorators = NULL, valueSupport = NULL, variateForm = NULL, description = NULL, suppressMoments = TRUE)

Constructor Arguments

ArgumentTypeDetails
namecharacterFull name of distribution.
short_namecharacterShort name to identify distribution.
typeset6::SetScientific type.
supportset6::SetDistribution support. See Details.
symmetriclogicalIs distribution symmetric?
pdffunctionSee Details.
cdffunctionSee Details.
quantilefunctionSee Details.
randfunctionSee Details.
parametersParameterSetSee Details.
decoratorslistR6 decorators to add in construction.
valueSupportcharactercontinuous, discrete, mixture. See Details.
variateFormcharacterunivariate, multivariate, matrixvariate. See Details.
descriptioncharacterShort description of distribution.
suppressMomentscharacterSee Details.

Constructor Details

The most basic Distribution object consists of a name and one of pdf/cdf.

If supplied, type and support should be given as a set6::Set object. If neither are supplied then the set of Reals is taken to be the type and the dimension is the number of formal arguments in the pdf/cdf. If only type is supplied then this is taken to also be the support.

By default, missing pdf, cdf, quantile and rand are not automatically imputed. Use the FunctionImputation decorator to generate these.

See ParameterSet for more details on construction of a ParameterSet.

decorators is an optional list of decorators (R6 environments not strings) to decorate the Distribution in construction. Decorators can also be added after construction. See decorate for more details.

valueSupport should be one of continuous/discrete/mixture if supplied. variateForm should be one of univariate/multivariate/matrixvariate if supplied. If not given these are automatically filled from type and support.

suppressMoments can be used to prevent the skewness and kurtosis type being automatically calculated in construction. This has the benefit of drastically decreasing computational time but at the cost of losing these in the distribution properties.

Public Variables

VariableReturn
nameName of distribution.
short_nameId of distribution.
descriptionBrief description of distribution.

Public Methods

Accessor MethodsLink
decoratorsdecorators
traitstraits
valueSupportvalueSupport
variateFormvariateForm
typetype
propertiesproperties
supportsupport
symmetrysymmetry
supsup
infinf
dmaxdmax
dmindmin
skewnessTypeskewnessType
kurtosisTypekurtosisType
d/p/q/r MethodsLink
pdf(x1, ..., log = FALSE, simplify = TRUE)pdf
cdf(x1, ..., lower.tail = TRUE, log.p = FALSE, simplify = TRUE)cdf
quantile(p, ..., lower.tail = TRUE, log.p = FALSE, simplify = TRUE)quantile.Distribution
rand(n, simplify = TRUE)rand
Statistical MethodsLink
prec()prec
stdev()stdev
median()median.Distribution
iqr()iqr
correlation()correlation
Parameter MethodsLink
parameters(id)parameters
getParameterValue(id, error = "warn")getParameterValue
setParameterValue(..., lst = NULL, error = "warn")setParameterValue
Validation MethodsLink
liesInSupport(x, all = TRUE, bound = FALSE)liesInSupport
liesInType(x, all = TRUE, bound = FALSE)liesInType
Representation MethodsLink
strprint(n = 2)strprint
print(n = 2)print
summary(full = T)summary.Distribution

Active Bindings

Active BindingLink
isPdfisPdf
isCdfisCdf
isQuantileisQuantile
isRandisRand

See also

See set6 for details on Sets and Intervals. See ParameterSet for parameter details. See decorate for Decorator details.