A generalised distribution object for defining custom probability distributions as well as serving as the parent class to specific, familiar distributions.
Returns R6 object of class Distribution.
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)
Argument | Type | Details |
name |
character | Full name of distribution. |
short_name |
character | Short name to identify distribution. |
type |
SetInterval | Scientific type. |
support |
SetInterval | Distribution support. See Details. |
symmetric |
logical | Is distribution symmetric? |
pdf |
function | See Details. |
cdf |
function | See Details. |
quantile |
function | See Details. |
rand |
function | See Details. |
parameters |
ParameterSet | See Details. |
decorators |
list | R6 decorators to add in construction. |
valueSupport |
character | continuous, discrete, mixture. See Details. |
variateForm |
character | univariate, multivariate, matrixvariate. See Details. |
description |
character | Short description of distribution. |
suppressMoments |
character | See Details. |
The most basic Distribution object consists of a name and one of pdf/cdf.
If supplied, type
and support
should be given as an R6 SetInterval 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.
Variable | Return |
name |
Name of distribution. |
short_name |
Id of distribution. |
description |
Brief description of distribution. |
Accessor Methods | Link |
decorators() |
decorators |
traits() |
traits |
valueSupport() |
valueSupport |
variateForm() |
variateForm |
type() |
type |
properties() |
properties |
support() |
support |
symmetry() |
symmetry |
sup() |
sup |
inf() |
inf |
dmax() |
dmax |
dmin() |
dmin |
skewnessType() |
skewnessType |
kurtosisType() |
kurtosisType |
d/p/q/r Methods | Link |
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 Methods | Link |
prec() |
prec |
stdev() |
stdev |
median() |
median.Distribution |
iqr() |
iqr |
correlation() |
correlation |
Parameter Methods | Link |
parameters(id) |
parameters |
getParameterValue(id, error = "warn") |
getParameterValue |
setParameterValue(..., lst = NULL, error = "warn") |
setParameterValue |
Validation Methods | Link |
liesInSupport(x, all = TRUE, bound = FALSE) |
liesInSupport |
liesInType(x, all = TRUE, bound = FALSE) |
liesInType |
Representation Methods | Link |
strprint(n = 2) |
strprint |
print(n = 2) |
print |
summary(full = T) |
summary.Distribution |
Active Binding | Link |
isPdf |
isPdf |
isCdf |
isCdf |
isQuantile |
isQuantile |
isRand |
isRand |
See SetInterval
and SpecialSet
for details on Sets and
Intervals. See ParameterSet
for parameter details. See
decorate
for Decorator details.