Title: | The Complete R6 Probability Distributions Interface |
---|---|
Description: | An R6 object oriented distributions package. Unified interface for 42 probability distributions and 11 kernels including functionality for multiple scientific types. Additionally functionality for composite distributions and numerical imputation. Design patterns including wrappers and decorators are described in Gamma et al. (1994, ISBN:0-201-63361-2). For quick reference of probability distributions including d/p/q/r functions and results we refer to McLaughlin, M. P. (2001). Additionally Devroye (1986, ISBN:0-387-96305-7) for sampling the Dirichlet distribution, Gentle (2009) <doi:10.1007/978-0-387-98144-4> for sampling the Multivariate Normal distribution and Michael et al. (1976) <doi:10.2307/2683801> for sampling the Wald distribution. |
Authors: | Raphael Sonabend [aut, cre] , 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], Michal Lauer [ctb], John Zobolas [ctb] |
Maintainer: | Raphael Sonabend <[email protected]> |
License: | MIT + file LICENSE |
Version: | 1.8.4 |
Built: | 2024-11-05 04:59:12 UTC |
Source: | https://github.com/xoopR/distr6 |
distr6 is an object oriented (OO) interface, primarily used for interacting with probability distributions in R. Additionally distr6 includes functionality for composite distributions, a symbolic representation for mathematical sets and intervals, basic methods for common kernels and numeric methods for distribution analysis. distr6 is the official R6 upgrade to the distr family of packages.
The main features of distr6 are:
Currently implements 45 probability distributions (and 11 Kernels) including all distributions in the R stats package. Each distribution has (where possible) closed form analytic expressions for basic statistical methods.
Decorators that add further functionality to probability distributions including numeric results for useful modelling functions such as p-norms and k-moments.
Wrappers for composite distributions including convolutions, truncation, mixture distributions and product distributions.
To learn more about distr6, start with the distr6 vignette:
vignette("distr6", "distr6")
And for more advanced usage see the complete tutorials at
https://xoopr.github.io/distr6/index.html #nolint
Maintainer: Raphael Sonabend [email protected] (ORCID)
Authors:
Franz Kiraly [email protected]
Other contributors:
Peter Ruckdeschel [email protected] (Author of distr) [contributor]
Matthias Kohl [email protected] (Author of distr) [contributor]
Nurul Ain Toha [email protected] [contributor]
Shen Chen [email protected] [contributor]
Jordan Deenichin [email protected] [contributor]
Chengyang Gao [email protected] [contributor]
Chloe Zhaoyuan Gu [email protected] [contributor]
Yunjie He [email protected] [contributor]
Xiaowen Huang [email protected] [contributor]
Shuhan Liu [email protected] [contributor]
Runlong Yu [email protected] [contributor]
Chijing Zeng [email protected] [contributor]
Qian Zhou [email protected] [contributor]
Michal Lauer [email protected] [contributor]
John Zobolas [email protected] (ORCID) [contributor]
Useful links:
Report bugs at https://github.com/xoopr/distr6/issues
Extract a WeightedDiscrete or Matdist or Arrdist from a Arrdist.
## S3 method for class 'Arrdist' ad[i = NULL, j = NULL]
## S3 method for class 'Arrdist' ad[i = NULL, j = NULL]
ad |
Arrdist from which to extract Distributions. |
i |
indices specifying distributions (first dimension) to extract, all returned if NULL. |
j |
indices specifying curves (third dimension) to extract, all returned if NULL. |
If length(i) == 1
and length(j) == 1
then returns a WeightedDiscrete otherwise if
j
is NULL
returns an Arrdist. If length(i)
is greater than 1 or NULL
returns a
Matdist if length(j) == 1
.
pdf <- runif(400) arr <- array(pdf, c(20, 10, 2), list(NULL, sort(sample(1:20, 10)), NULL)) arr <- aperm(apply(arr, c(1, 3), function(x) x / sum(x)), c(2, 1, 3)) darr <- as.Distribution(arr, fun = "pdf") # WeightDisc darr[1, 1] # Matdist darr[1:2, 1] # Arrdist darr[1:3, 1:2] darr[1, 1:2]
pdf <- runif(400) arr <- array(pdf, c(20, 10, 2), list(NULL, sort(sample(1:20, 10)), NULL)) arr <- aperm(apply(arr, c(1, 3), function(x) x / sum(x)), c(2, 1, 3)) darr <- as.Distribution(arr, fun = "pdf") # WeightDisc darr[1, 1] # Matdist darr[1:2, 1] # Arrdist darr[1:3, 1:2] darr[1, 1:2]
Extract a WeightedDiscrete or Matdist from a Matdist.
## S3 method for class 'Matdist' md[i]
## S3 method for class 'Matdist' md[i]
md |
Matdist from which to extract Distributions. |
i |
indices specifying distributions to extract. |
If length(i) == 1
then returns a WeightedDiscrete otherwise
returns a Matdist.
m <- as.Distribution( t(apply(matrix(runif(200), 20, 10, FALSE, list(NULL, sort(sample(1:20, 10)))), 1, function(x) x / sum(x))), fun = "pdf" ) m[1] m[1:2]
m <- as.Distribution( t(apply(matrix(runif(200), 20, 10, FALSE, list(NULL, sort(sample(1:20, 10)))), 1, function(x) x / sum(x))), fun = "pdf" ) m[1] m[1:2]
Once a VectorDistribution
has been constructed, use [
to extract one or more Distribution
s from inside it.
## S3 method for class 'VectorDistribution' vecdist[i]
## S3 method for class 'VectorDistribution' vecdist[i]
vecdist |
VectorDistribution from which to extract Distributions. |
i |
indices specifying distributions to extract or ids of wrapped distributions. |
v <- VectorDistribution$new(distribution = "Binom", params = data.frame(size = 1:2, prob = 0.5)) v[1] v["Binom1"]
v <- VectorDistribution$new(distribution = "Binom", params = data.frame(size = 1:2, prob = 0.5)) v[1] v["Binom1"]
Mathematical and statistical functions for the Arcsine distribution, which is commonly used in the study of random walks and as a special case of the Beta distribution.
The Arcsine distribution parameterised with lower, , and upper,
, limits is defined by the pdf,
for .
Returns an R6 object inheriting from class SDistribution.
The distribution is supported on .
Arc(lower = 0, upper = 1)
N/A
N/A
distr6::Distribution
-> distr6::SDistribution
-> Arcsine
name
Full name of distribution.
short_name
Short name of distribution for printing.
description
Brief description of the distribution.
alias
Alias of the distribution.
properties
Returns distribution properties, including skewness type and symmetry.
distr6::Distribution$cdf()
distr6::Distribution$confidence()
distr6::Distribution$correlation()
distr6::Distribution$getParameterValue()
distr6::Distribution$iqr()
distr6::Distribution$liesInSupport()
distr6::Distribution$liesInType()
distr6::Distribution$median()
distr6::Distribution$parameters()
distr6::Distribution$pdf()
distr6::Distribution$prec()
distr6::Distribution$print()
distr6::Distribution$quantile()
distr6::Distribution$rand()
distr6::Distribution$setParameterValue()
distr6::Distribution$stdev()
distr6::Distribution$strprint()
distr6::Distribution$summary()
distr6::Distribution$workingSupport()
new()
Creates a new instance of this R6 class.
Arcsine$new(lower = NULL, upper = NULL, decorators = NULL)
lower
(numeric(1))
Lower limit of the Distribution, defined on the Reals.
upper
(numeric(1))
Upper limit of the Distribution, defined on the Reals.
decorators
(character())
Decorators to add to the distribution during construction.
mean()
The arithmetic mean of a (discrete) probability distribution X is the expectation
with an integration analogue for continuous distributions.
Arcsine$mean(...)
...
Unused.
mode()
The mode of a probability distribution is the point at which the pdf is a local maximum, a distribution can be unimodal (one maximum) or multimodal (several maxima).
Arcsine$mode(which = "all")
which
(character(1) | numeric(1)
Ignored if distribution is unimodal. Otherwise "all"
returns all modes, otherwise specifies
which mode to return.
variance()
The variance of a distribution is defined by the formula
where is the expectation of distribution X. If the distribution is multivariate the
covariance matrix is returned.
Arcsine$variance(...)
...
Unused.
skewness()
The skewness of a distribution is defined by the third standardised moment,
where is the expectation of distribution X,
is the mean of the
distribution and
is the standard deviation of the distribution.
Arcsine$skewness(...)
...
Unused.
kurtosis()
The kurtosis of a distribution is defined by the fourth standardised moment,
where is the expectation of distribution X,
is the mean of the
distribution and
is the standard deviation of the distribution.
Excess Kurtosis is Kurtosis - 3.
Arcsine$kurtosis(excess = TRUE, ...)
excess
(logical(1))
If TRUE
(default) excess kurtosis returned.
...
Unused.
entropy()
The entropy of a (discrete) distribution is defined by
where is the pdf of distribution X, with an integration analogue for
continuous distributions.
Arcsine$entropy(base = 2, ...)
base
(integer(1))
Base of the entropy logarithm, default = 2 (Shannon entropy)
...
Unused.
pgf()
The probability generating function is defined by
where X is the distribution and is the expectation of the distribution X.
Arcsine$pgf(z, ...)
z
(integer(1))
z integer to evaluate probability generating function at.
...
Unused.
clone()
The objects of this class are cloneable with this method.
Arcsine$clone(deep = FALSE)
deep
Whether to make a deep clone.
McLaughlin, M. P. (2001). A compendium of common probability distributions (pp. 2014-01). Michael P. McLaughlin.
Other continuous distributions:
BetaNoncentral
,
Beta
,
Cauchy
,
ChiSquaredNoncentral
,
ChiSquared
,
Dirichlet
,
Erlang
,
Exponential
,
FDistributionNoncentral
,
FDistribution
,
Frechet
,
Gamma
,
Gompertz
,
Gumbel
,
InverseGamma
,
Laplace
,
Logistic
,
Loglogistic
,
Lognormal
,
MultivariateNormal
,
Normal
,
Pareto
,
Poisson
,
Rayleigh
,
ShiftedLoglogistic
,
StudentTNoncentral
,
StudentT
,
Triangular
,
Uniform
,
Wald
,
Weibull
Other univariate distributions:
Arrdist
,
Bernoulli
,
BetaNoncentral
,
Beta
,
Binomial
,
Categorical
,
Cauchy
,
ChiSquaredNoncentral
,
ChiSquared
,
Degenerate
,
DiscreteUniform
,
Empirical
,
Erlang
,
Exponential
,
FDistributionNoncentral
,
FDistribution
,
Frechet
,
Gamma
,
Geometric
,
Gompertz
,
Gumbel
,
Hypergeometric
,
InverseGamma
,
Laplace
,
Logarithmic
,
Logistic
,
Loglogistic
,
Lognormal
,
Matdist
,
NegativeBinomial
,
Normal
,
Pareto
,
Poisson
,
Rayleigh
,
ShiftedLoglogistic
,
StudentTNoncentral
,
StudentT
,
Triangular
,
Uniform
,
Wald
,
Weibull
,
WeightedDiscrete
Mathematical and statistical functions for the Arrdist distribution, which is commonly used in matrixed Bayesian estimators such as Kaplan-Meier with confidence bounds over arbitrary dimensions.
The Arrdist distribution is defined by the pmf,
for .
This is a generalised case of Matdist with a third dimension over an arbitrary length.
By default all results are returned for the median curve as determined by
(dim(a)[3L] + 1)/2
where a
is the array and assuming third dimension is odd,
this can be changed by setting the which.curve
parameter.
Given the complexity in construction, this distribution is not mutable (cannot be updated after construction).
Returns an R6 object inheriting from class SDistribution.
The distribution is supported on .
Arrdist(array(0.5, c(2, 2, 2), list(NULL, 1:2, NULL)))
N/A
N/A
distr6::Distribution
-> distr6::SDistribution
-> Arrdist
name
Full name of distribution.
short_name
Short name of distribution for printing.
description
Brief description of the distribution.
alias
Alias of the distribution.
properties
Returns distribution properties, including skewness type and symmetry.
distr6::Distribution$cdf()
distr6::Distribution$confidence()
distr6::Distribution$correlation()
distr6::Distribution$getParameterValue()
distr6::Distribution$iqr()
distr6::Distribution$liesInSupport()
distr6::Distribution$liesInType()
distr6::Distribution$parameters()
distr6::Distribution$pdf()
distr6::Distribution$prec()
distr6::Distribution$print()
distr6::Distribution$quantile()
distr6::Distribution$rand()
distr6::Distribution$setParameterValue()
distr6::Distribution$stdev()
distr6::Distribution$summary()
distr6::Distribution$workingSupport()
new()
Creates a new instance of this R6 class.
Arrdist$new(pdf = NULL, cdf = NULL, which.curve = 0.5, decorators = NULL)
pdf
numeric()
Probability mass function for corresponding samples, should be same length x
.
If cdf
is not given then calculated as cumsum(pdf)
.
cdf
numeric()
Cumulative distribution function for corresponding samples, should be same length x
. If
given then pdf
calculated as difference of cdf
s.
which.curve
numeric(1) | character(1)
Which curve (third dimension) should results be displayed for? If
between (0,1) taken as the quantile of the curves otherwise if greater than 1 taken as the curve index, can also be 'mean'. See examples.
decorators
(character())
Decorators to add to the distribution during construction.
strprint()
Printable string representation of the Distribution
. Primarily used internally.
Arrdist$strprint(n = 2)
n
(integer(1))
Ignored.
mean()
The arithmetic mean of a (discrete) probability distribution X is the expectation
with an integration analogue for continuous distributions. If distribution is improper (F(Inf) != 1, then E_X(x) = Inf).
Arrdist$mean(...)
...
Unused.
median()
Returns the median of the distribution. If an analytical expression is available
returns distribution median, otherwise if symmetric returns self$mean
, otherwise
returns self$quantile(0.5)
.
Arrdist$median()
mode()
The mode of a probability distribution is the point at which the pdf is a local maximum, a distribution can be unimodal (one maximum) or multimodal (several maxima).
Arrdist$mode(which = 1)
which
(character(1) | numeric(1)
Ignored if distribution is unimodal. Otherwise "all"
returns all modes, otherwise specifies
which mode to return.
variance()
The variance of a distribution is defined by the formula
where is the expectation of distribution X. If the distribution is multivariate the
covariance matrix is returned.
If distribution is improper (F(Inf) != 1, then var_X(x) = Inf).
Arrdist$variance(...)
...
Unused.
skewness()
The skewness of a distribution is defined by the third standardised moment,
where is the expectation of distribution X,
is the mean of the
distribution and
is the standard deviation of the distribution.
If distribution is improper (F(Inf) != 1, then sk_X(x) = Inf).
Arrdist$skewness(...)
...
Unused.
kurtosis()
The kurtosis of a distribution is defined by the fourth standardised moment,
where is the expectation of distribution X,
is the mean of the
distribution and
is the standard deviation of the distribution.
Excess Kurtosis is Kurtosis - 3.
If distribution is improper (F(Inf) != 1, then k_X(x) = Inf).
Arrdist$kurtosis(excess = TRUE, ...)
excess
(logical(1))
If TRUE
(default) excess kurtosis returned.
...
Unused.
entropy()
The entropy of a (discrete) distribution is defined by
where is the pdf of distribution X, with an integration analogue for
continuous distributions.
If distribution is improper then entropy is Inf.
Arrdist$entropy(base = 2, ...)
base
(integer(1))
Base of the entropy logarithm, default = 2 (Shannon entropy)
...
Unused.
mgf()
The moment generating function is defined by
where X is the distribution and is the expectation of the distribution X.
If distribution is improper (F(Inf) != 1, then mgf_X(x) = Inf).
Arrdist$mgf(t, ...)
t
(integer(1))
t integer to evaluate function at.
...
Unused.
cf()
The characteristic function is defined by
where X is the distribution and is the expectation of the distribution X.
If distribution is improper (F(Inf) != 1, then cf_X(x) = Inf).
Arrdist$cf(t, ...)
t
(integer(1))
t integer to evaluate function at.
...
Unused.
pgf()
The probability generating function is defined by
where X is the distribution and is the expectation of the distribution X.
If distribution is improper (F(Inf) != 1, then pgf_X(x) = Inf).
Arrdist$pgf(z, ...)
z
(integer(1))
z integer to evaluate probability generating function at.
...
Unused.
clone()
The objects of this class are cloneable with this method.
Arrdist$clone(deep = FALSE)
deep
Whether to make a deep clone.
McLaughlin, M. P. (2001). A compendium of common probability distributions (pp. 2014-01). Michael P. McLaughlin.
Other discrete distributions:
Bernoulli
,
Binomial
,
Categorical
,
Degenerate
,
DiscreteUniform
,
EmpiricalMV
,
Empirical
,
Geometric
,
Hypergeometric
,
Logarithmic
,
Matdist
,
Multinomial
,
NegativeBinomial
,
WeightedDiscrete
Other univariate distributions:
Arcsine
,
Bernoulli
,
BetaNoncentral
,
Beta
,
Binomial
,
Categorical
,
Cauchy
,
ChiSquaredNoncentral
,
ChiSquared
,
Degenerate
,
DiscreteUniform
,
Empirical
,
Erlang
,
Exponential
,
FDistributionNoncentral
,
FDistribution
,
Frechet
,
Gamma
,
Geometric
,
Gompertz
,
Gumbel
,
Hypergeometric
,
InverseGamma
,
Laplace
,
Logarithmic
,
Logistic
,
Loglogistic
,
Lognormal
,
Matdist
,
NegativeBinomial
,
Normal
,
Pareto
,
Poisson
,
Rayleigh
,
ShiftedLoglogistic
,
StudentTNoncentral
,
StudentT
,
Triangular
,
Uniform
,
Wald
,
Weibull
,
WeightedDiscrete
x <- Arrdist$new(pdf = array(0.5, c(3, 2, 4), dimnames = list(NULL, 1:2, NULL))) Arrdist$new(cdf = array(c(0.5, 0.5, 0.5, 1, 1, 1), c(3, 2, 4), dimnames = list(NULL, 1:2, NULL))) # equivalently # d/p/q/r x$pdf(1) x$cdf(1:2) # Assumes ordered in construction x$quantile(0.42) # Assumes ordered in construction x$rand(10) # Statistics x$mean() x$variance() summary(x) # Changing which.curve arr <- array(runif(90), c(3, 2, 5), list(NULL, 1:2, NULL)) arr <- aperm(apply(arr, c(1, 3), function(x) x / sum(x)), c(2, 1, 3)) arr[, , 1:3] x <- Arrdist$new(arr) x$mean() # default 0.5 quantile (in this case index 3) x$setParameterValue(which.curve = 3) # equivalently x$mean() # 1% quantile x$setParameterValue(which.curve = 0.01) x$mean() # 5th index x$setParameterValue(which.curve = 5) x$mean() # mean x$setParameterValue(which.curve = "mean") x$mean()
x <- Arrdist$new(pdf = array(0.5, c(3, 2, 4), dimnames = list(NULL, 1:2, NULL))) Arrdist$new(cdf = array(c(0.5, 0.5, 0.5, 1, 1, 1), c(3, 2, 4), dimnames = list(NULL, 1:2, NULL))) # equivalently # d/p/q/r x$pdf(1) x$cdf(1:2) # Assumes ordered in construction x$quantile(0.42) # Assumes ordered in construction x$rand(10) # Statistics x$mean() x$variance() summary(x) # Changing which.curve arr <- array(runif(90), c(3, 2, 5), list(NULL, 1:2, NULL)) arr <- aperm(apply(arr, c(1, 3), function(x) x / sum(x)), c(2, 1, 3)) arr[, , 1:3] x <- Arrdist$new(arr) x$mean() # default 0.5 quantile (in this case index 3) x$setParameterValue(which.curve = 3) # equivalently x$mean() # 1% quantile x$setParameterValue(which.curve = 0.01) x$mean() # 5th index x$setParameterValue(which.curve = 5) x$mean() # mean x$setParameterValue(which.curve = "mean") x$mean()
Coerces matrices to a VectorDistribution containing
WeightedDiscrete distributions or a Matdist. Number of distributions
are the number of rows in the matrix, number of x
points are number of
columns in the matrix.
as.Distribution(obj, fun, decorators = NULL, vector = FALSE) ## S3 method for class 'matrix' as.Distribution(obj, fun, decorators = NULL, vector = FALSE) ## S3 method for class 'array' as.Distribution(obj, fun, decorators = NULL, vector = FALSE)
as.Distribution(obj, fun, decorators = NULL, vector = FALSE) ## S3 method for class 'matrix' as.Distribution(obj, fun, decorators = NULL, vector = FALSE) ## S3 method for class 'array' as.Distribution(obj, fun, decorators = NULL, vector = FALSE)
obj |
matrix. Column names correspond to |
fun |
Either |
decorators |
Passed to VectorDistribution or Matdist. |
vector |
|
A VectorDistribution or Matdist
pdf <- runif(200) mat <- matrix(pdf, 20, 10, FALSE, list(NULL, 1:10)) mat <- t(apply(mat, 1, function(x) x / sum(x))) # coercion to matrix distribution as.Distribution(mat, fun = "pdf") # coercion to vector of weighted discrete distributions as.Distribution(mat, fun = "pdf", vector = TRUE)
pdf <- runif(200) mat <- matrix(pdf, 20, 10, FALSE, list(NULL, 1:10)) mat <- t(apply(mat, 1, function(x) x / sum(x))) # coercion to matrix distribution as.Distribution(mat, fun = "pdf") # coercion to vector of weighted discrete distributions as.Distribution(mat, fun = "pdf", vector = TRUE)
Helper functions to quickly convert compatible objects to a MixtureDistribution.
as.MixtureDistribution(object, weights = "uniform")
as.MixtureDistribution(object, weights = "uniform")
object |
|
weights |
|
Helper functions to quickly convert compatible objects to a ProductDistribution.
as.ProductDistribution(object)
as.ProductDistribution(object)
object |
Helper functions to quickly convert compatible objects to a VectorDistribution.
as.VectorDistribution(object)
as.VectorDistribution(object)
object |
Mathematical and statistical functions for the Bernoulli distribution, which is commonly used to model a two-outcome scenario.
The Bernoulli distribution parameterised with probability of success, , is defined by the pmf,
for probability .
Returns an R6 object inheriting from class SDistribution.
The distribution is supported on .
Bern(prob = 0.5)
N/A
N/A
distr6::Distribution
-> distr6::SDistribution
-> Bernoulli
name
Full name of distribution.
short_name
Short name of distribution for printing.
description
Brief description of the distribution.
alias
Alias of the distribution.
packages
Packages required to be installed in order to construct the distribution.
properties
Returns distribution properties, including skewness type and symmetry.
distr6::Distribution$cdf()
distr6::Distribution$confidence()
distr6::Distribution$correlation()
distr6::Distribution$getParameterValue()
distr6::Distribution$iqr()
distr6::Distribution$liesInSupport()
distr6::Distribution$liesInType()
distr6::Distribution$parameters()
distr6::Distribution$pdf()
distr6::Distribution$prec()
distr6::Distribution$print()
distr6::Distribution$quantile()
distr6::Distribution$rand()
distr6::Distribution$setParameterValue()
distr6::Distribution$stdev()
distr6::Distribution$strprint()
distr6::Distribution$summary()
distr6::Distribution$workingSupport()
new()
Creates a new instance of this R6 class.
Bernoulli$new(prob = NULL, qprob = NULL, decorators = NULL)
prob
(numeric(1))
Probability of success.
qprob
(numeric(1))
Probability of failure. If provided then prob
is ignored. qprob = 1 - prob
.
decorators
(character())
Decorators to add to the distribution during construction.
mean()
The arithmetic mean of a (discrete) probability distribution X is the expectation
with an integration analogue for continuous distributions.
Bernoulli$mean(...)
...
Unused.
mode()
The mode of a probability distribution is the point at which the pdf is a local maximum, a distribution can be unimodal (one maximum) or multimodal (several maxima).
Bernoulli$mode(which = "all")
which
(character(1) | numeric(1)
Ignored if distribution is unimodal. Otherwise "all"
returns all modes, otherwise specifies
which mode to return.
median()
Returns the median of the distribution. If an analytical expression is available
returns distribution median, otherwise if symmetric returns self$mean
, otherwise
returns self$quantile(0.5)
.
Bernoulli$median()
variance()
The variance of a distribution is defined by the formula
where is the expectation of distribution X. If the distribution is multivariate the
covariance matrix is returned.
Bernoulli$variance(...)
...
Unused.
skewness()
The skewness of a distribution is defined by the third standardised moment,
where is the expectation of distribution X,
is the mean of the
distribution and
is the standard deviation of the distribution.
Bernoulli$skewness(...)
...
Unused.
kurtosis()
The kurtosis of a distribution is defined by the fourth standardised moment,
where is the expectation of distribution X,
is the mean of the
distribution and
is the standard deviation of the distribution.
Excess Kurtosis is Kurtosis - 3.
Bernoulli$kurtosis(excess = TRUE, ...)
excess
(logical(1))
If TRUE
(default) excess kurtosis returned.
...
Unused.
entropy()
The entropy of a (discrete) distribution is defined by
where is the pdf of distribution X, with an integration analogue for
continuous distributions.
Bernoulli$entropy(base = 2, ...)
base
(integer(1))
Base of the entropy logarithm, default = 2 (Shannon entropy)
...
Unused.
mgf()
The moment generating function is defined by
where X is the distribution and is the expectation of the distribution X.
Bernoulli$mgf(t, ...)
t
(integer(1))
t integer to evaluate function at.
...
Unused.
cf()
The characteristic function is defined by
where X is the distribution and is the expectation of the distribution X.
Bernoulli$cf(t, ...)
t
(integer(1))
t integer to evaluate function at.
...
Unused.
pgf()
The probability generating function is defined by
where X is the distribution and is the expectation of the distribution X.
Bernoulli$pgf(z, ...)
z
(integer(1))
z integer to evaluate probability generating function at.
...
Unused.
clone()
The objects of this class are cloneable with this method.
Bernoulli$clone(deep = FALSE)
deep
Whether to make a deep clone.
McLaughlin, M. P. (2001). A compendium of common probability distributions (pp. 2014-01). Michael P. McLaughlin.
Other discrete distributions:
Arrdist
,
Binomial
,
Categorical
,
Degenerate
,
DiscreteUniform
,
EmpiricalMV
,
Empirical
,
Geometric
,
Hypergeometric
,
Logarithmic
,
Matdist
,
Multinomial
,
NegativeBinomial
,
WeightedDiscrete
Other univariate distributions:
Arcsine
,
Arrdist
,
BetaNoncentral
,
Beta
,
Binomial
,
Categorical
,
Cauchy
,
ChiSquaredNoncentral
,
ChiSquared
,
Degenerate
,
DiscreteUniform
,
Empirical
,
Erlang
,
Exponential
,
FDistributionNoncentral
,
FDistribution
,
Frechet
,
Gamma
,
Geometric
,
Gompertz
,
Gumbel
,
Hypergeometric
,
InverseGamma
,
Laplace
,
Logarithmic
,
Logistic
,
Loglogistic
,
Lognormal
,
Matdist
,
NegativeBinomial
,
Normal
,
Pareto
,
Poisson
,
Rayleigh
,
ShiftedLoglogistic
,
StudentTNoncentral
,
StudentT
,
Triangular
,
Uniform
,
Wald
,
Weibull
,
WeightedDiscrete
Mathematical and statistical functions for the Beta distribution, which is commonly used as the prior in Bayesian modelling.
The Beta distribution parameterised with two shape parameters, , is defined by the pdf,
for , where
is the Beta function.
Returns an R6 object inheriting from class SDistribution.
The distribution is supported on .
Beta(shape1 = 1, shape2 = 1)
N/A
N/A
distr6::Distribution
-> distr6::SDistribution
-> Beta
name
Full name of distribution.
short_name
Short name of distribution for printing.
description
Brief description of the distribution.
alias
Alias of the distribution.
packages
Packages required to be installed in order to construct the distribution.
properties
Returns distribution properties, including skewness type and symmetry.
distr6::Distribution$cdf()
distr6::Distribution$confidence()
distr6::Distribution$correlation()
distr6::Distribution$getParameterValue()
distr6::Distribution$iqr()
distr6::Distribution$liesInSupport()
distr6::Distribution$liesInType()
distr6::Distribution$median()
distr6::Distribution$parameters()
distr6::Distribution$pdf()
distr6::Distribution$prec()
distr6::Distribution$print()
distr6::Distribution$quantile()
distr6::Distribution$rand()
distr6::Distribution$setParameterValue()
distr6::Distribution$stdev()
distr6::Distribution$strprint()
distr6::Distribution$summary()
distr6::Distribution$workingSupport()
new()
Creates a new instance of this R6 class.
Beta$new(shape1 = NULL, shape2 = NULL, decorators = NULL)
shape1
(numeric(1))
First shape parameter, shape1 > 0
.
shape2
(numeric(1))
Second shape parameter, shape2 > 0
.
decorators
(character())
Decorators to add to the distribution during construction.
mean()
The arithmetic mean of a (discrete) probability distribution X is the expectation
with an integration analogue for continuous distributions.
Beta$mean(...)
...
Unused.
mode()
The mode of a probability distribution is the point at which the pdf is a local maximum, a distribution can be unimodal (one maximum) or multimodal (several maxima).
Beta$mode(which = "all")
which
(character(1) | numeric(1)
Ignored if distribution is unimodal. Otherwise "all"
returns all modes, otherwise specifies
which mode to return.
variance()
The variance of a distribution is defined by the formula
where is the expectation of distribution X. If the distribution is multivariate the
covariance matrix is returned.
Beta$variance(...)
...
Unused.
skewness()
The skewness of a distribution is defined by the third standardised moment,
where is the expectation of distribution X,
is the mean of the
distribution and
is the standard deviation of the distribution.
Beta$skewness(...)
...
Unused.
kurtosis()
The kurtosis of a distribution is defined by the fourth standardised moment,
where is the expectation of distribution X,
is the mean of the
distribution and
is the standard deviation of the distribution.
Excess Kurtosis is Kurtosis - 3.
Beta$kurtosis(excess = TRUE, ...)
excess
(logical(1))
If TRUE
(default) excess kurtosis returned.
...
Unused.
entropy()
The entropy of a (discrete) distribution is defined by
where is the pdf of distribution X, with an integration analogue for
continuous distributions.
Beta$entropy(base = 2, ...)
base
(integer(1))
Base of the entropy logarithm, default = 2 (Shannon entropy)
...
Unused.
pgf()
The probability generating function is defined by
where X is the distribution and is the expectation of the distribution X.
Beta$pgf(z, ...)
z
(integer(1))
z integer to evaluate probability generating function at.
...
Unused.
clone()
The objects of this class are cloneable with this method.
Beta$clone(deep = FALSE)
deep
Whether to make a deep clone.
McLaughlin, M. P. (2001). A compendium of common probability distributions (pp. 2014-01). Michael P. McLaughlin.
Other continuous distributions:
Arcsine
,
BetaNoncentral
,
Cauchy
,
ChiSquaredNoncentral
,
ChiSquared
,
Dirichlet
,
Erlang
,
Exponential
,
FDistributionNoncentral
,
FDistribution
,
Frechet
,
Gamma
,
Gompertz
,
Gumbel
,
InverseGamma
,
Laplace
,
Logistic
,
Loglogistic
,
Lognormal
,
MultivariateNormal
,
Normal
,
Pareto
,
Poisson
,
Rayleigh
,
ShiftedLoglogistic
,
StudentTNoncentral
,
StudentT
,
Triangular
,
Uniform
,
Wald
,
Weibull
Other univariate distributions:
Arcsine
,
Arrdist
,
Bernoulli
,
BetaNoncentral
,
Binomial
,
Categorical
,
Cauchy
,
ChiSquaredNoncentral
,
ChiSquared
,
Degenerate
,
DiscreteUniform
,
Empirical
,
Erlang
,
Exponential
,
FDistributionNoncentral
,
FDistribution
,
Frechet
,
Gamma
,
Geometric
,
Gompertz
,
Gumbel
,
Hypergeometric
,
InverseGamma
,
Laplace
,
Logarithmic
,
Logistic
,
Loglogistic
,
Lognormal
,
Matdist
,
NegativeBinomial
,
Normal
,
Pareto
,
Poisson
,
Rayleigh
,
ShiftedLoglogistic
,
StudentTNoncentral
,
StudentT
,
Triangular
,
Uniform
,
Wald
,
Weibull
,
WeightedDiscrete
Mathematical and statistical functions for the Noncentral Beta distribution, which is commonly used as the prior in Bayesian modelling.
The Noncentral Beta distribution parameterised with two shape parameters, , and location,
, is defined by the pdf,
for , where
is the Beta function.
Returns an R6 object inheriting from class SDistribution.
The distribution is supported on .
BetaNC(shape1 = 1, shape2 = 1, location = 0)
N/A
N/A
distr6::Distribution
-> distr6::SDistribution
-> BetaNoncentral
name
Full name of distribution.
short_name
Short name of distribution for printing.
description
Brief description of the distribution.
alias
Alias of the distribution.
packages
Packages required to be installed in order to construct the distribution.
properties
Returns distribution properties, including skewness type and symmetry.
distr6::Distribution$cdf()
distr6::Distribution$confidence()
distr6::Distribution$correlation()
distr6::Distribution$getParameterValue()
distr6::Distribution$iqr()
distr6::Distribution$liesInSupport()
distr6::Distribution$liesInType()
distr6::Distribution$median()
distr6::Distribution$parameters()
distr6::Distribution$pdf()
distr6::Distribution$prec()
distr6::Distribution$print()
distr6::Distribution$quantile()
distr6::Distribution$rand()
distr6::Distribution$setParameterValue()
distr6::Distribution$stdev()
distr6::Distribution$strprint()
distr6::Distribution$summary()
distr6::Distribution$workingSupport()
new()
Creates a new instance of this R6 class.
BetaNoncentral$new( shape1 = NULL, shape2 = NULL, location = NULL, decorators = NULL )
shape1
(numeric(1))
First shape parameter, shape1 > 0
.
shape2
(numeric(1))
Second shape parameter, shape2 > 0
.
location
(numeric(1))
Location parameter, defined on the non-negative Reals.
decorators
(character())
Decorators to add to the distribution during construction.
clone()
The objects of this class are cloneable with this method.
BetaNoncentral$clone(deep = FALSE)
deep
Whether to make a deep clone.
Jordan Deenichin
McLaughlin, M. P. (2001). A compendium of common probability distributions (pp. 2014-01). Michael P. McLaughlin.
Other continuous distributions:
Arcsine
,
Beta
,
Cauchy
,
ChiSquaredNoncentral
,
ChiSquared
,
Dirichlet
,
Erlang
,
Exponential
,
FDistributionNoncentral
,
FDistribution
,
Frechet
,
Gamma
,
Gompertz
,
Gumbel
,
InverseGamma
,
Laplace
,
Logistic
,
Loglogistic
,
Lognormal
,
MultivariateNormal
,
Normal
,
Pareto
,
Poisson
,
Rayleigh
,
ShiftedLoglogistic
,
StudentTNoncentral
,
StudentT
,
Triangular
,
Uniform
,
Wald
,
Weibull
Other univariate distributions:
Arcsine
,
Arrdist
,
Bernoulli
,
Beta
,
Binomial
,
Categorical
,
Cauchy
,
ChiSquaredNoncentral
,
ChiSquared
,
Degenerate
,
DiscreteUniform
,
Empirical
,
Erlang
,
Exponential
,
FDistributionNoncentral
,
FDistribution
,
Frechet
,
Gamma
,
Geometric
,
Gompertz
,
Gumbel
,
Hypergeometric
,
InverseGamma
,
Laplace
,
Logarithmic
,
Logistic
,
Loglogistic
,
Lognormal
,
Matdist
,
NegativeBinomial
,
Normal
,
Pareto
,
Poisson
,
Rayleigh
,
ShiftedLoglogistic
,
StudentTNoncentral
,
StudentT
,
Triangular
,
Uniform
,
Wald
,
Weibull
,
WeightedDiscrete
Mathematical and statistical functions for the Binomial distribution, which is commonly used to model the number of successes out of a number of independent trials.
The Binomial distribution parameterised with number of trials, n, and probability of success, p, is defined by the pmf,
for and probability
, where
is the combination (or binomial coefficient) function.
Returns an R6 object inheriting from class SDistribution.
The distribution is supported on .
Binom(size = 10, prob = 0.5)
N/A
N/A
distr6::Distribution
-> distr6::SDistribution
-> Binomial
name
Full name of distribution.
short_name
Short name of distribution for printing.
description
Brief description of the distribution.
alias
Alias of the distribution.
packages
Packages required to be installed in order to construct the distribution.
properties
Returns distribution properties, including skewness type and symmetry.
distr6::Distribution$cdf()
distr6::Distribution$confidence()
distr6::Distribution$correlation()
distr6::Distribution$getParameterValue()
distr6::Distribution$iqr()
distr6::Distribution$liesInSupport()
distr6::Distribution$liesInType()
distr6::Distribution$median()
distr6::Distribution$parameters()
distr6::Distribution$pdf()
distr6::Distribution$prec()
distr6::Distribution$print()
distr6::Distribution$quantile()
distr6::Distribution$rand()
distr6::Distribution$setParameterValue()
distr6::Distribution$stdev()
distr6::Distribution$strprint()
distr6::Distribution$summary()
distr6::Distribution$workingSupport()
new()
Creates a new instance of this R6 class.
Binomial$new(size = NULL, prob = NULL, qprob = NULL, decorators = NULL)
size
(integer(1))
Number of trials, defined on the positive Naturals.
prob
(numeric(1))
Probability of success.
qprob
(numeric(1))
Probability of failure. If provided then prob
is ignored. qprob = 1 - prob
.
decorators
(character())
Decorators to add to the distribution during construction.
mean()
The arithmetic mean of a (discrete) probability distribution X is the expectation
with an integration analogue for continuous distributions.
Binomial$mean(...)
...
Unused.
mode()
The mode of a probability distribution is the point at which the pdf is a local maximum, a distribution can be unimodal (one maximum) or multimodal (several maxima).
Binomial$mode(which = "all")
which
(character(1) | numeric(1)
Ignored if distribution is unimodal. Otherwise "all"
returns all modes, otherwise specifies
which mode to return.
variance()
The variance of a distribution is defined by the formula
where is the expectation of distribution X. If the distribution is multivariate the
covariance matrix is returned.
Binomial$variance(...)
...
Unused.
skewness()
The skewness of a distribution is defined by the third standardised moment,
where is the expectation of distribution X,
is the mean of the
distribution and
is the standard deviation of the distribution.
Binomial$skewness(...)
...
Unused.
kurtosis()
The kurtosis of a distribution is defined by the fourth standardised moment,
where is the expectation of distribution X,
is the mean of the
distribution and
is the standard deviation of the distribution.
Excess Kurtosis is Kurtosis - 3.
Binomial$kurtosis(excess = TRUE, ...)
excess
(logical(1))
If TRUE
(default) excess kurtosis returned.
...
Unused.
entropy()
The entropy of a (discrete) distribution is defined by
where is the pdf of distribution X, with an integration analogue for
continuous distributions.
Binomial$entropy(base = 2, ...)
base
(integer(1))
Base of the entropy logarithm, default = 2 (Shannon entropy)
...
Unused.
mgf()
The moment generating function is defined by
where X is the distribution and is the expectation of the distribution X.
Binomial$mgf(t, ...)
t
(integer(1))
t integer to evaluate function at.
...
Unused.
cf()
The characteristic function is defined by
where X is the distribution and is the expectation of the distribution X.
Binomial$cf(t, ...)
t
(integer(1))
t integer to evaluate function at.
...
Unused.
pgf()
The probability generating function is defined by
where X is the distribution and is the expectation of the distribution X.
Binomial$pgf(z, ...)
z
(integer(1))
z integer to evaluate probability generating function at.
...
Unused.
clone()
The objects of this class are cloneable with this method.
Binomial$clone(deep = FALSE)
deep
Whether to make a deep clone.
McLaughlin, M. P. (2001). A compendium of common probability distributions (pp. 2014-01). Michael P. McLaughlin.
Other discrete distributions:
Arrdist
,
Bernoulli
,
Categorical
,
Degenerate
,
DiscreteUniform
,
EmpiricalMV
,
Empirical
,
Geometric
,
Hypergeometric
,
Logarithmic
,
Matdist
,
Multinomial
,
NegativeBinomial
,
WeightedDiscrete
Other univariate distributions:
Arcsine
,
Arrdist
,
Bernoulli
,
BetaNoncentral
,
Beta
,
Categorical
,
Cauchy
,
ChiSquaredNoncentral
,
ChiSquared
,
Degenerate
,
DiscreteUniform
,
Empirical
,
Erlang
,
Exponential
,
FDistributionNoncentral
,
FDistribution
,
Frechet
,
Gamma
,
Geometric
,
Gompertz
,
Gumbel
,
Hypergeometric
,
InverseGamma
,
Laplace
,
Logarithmic
,
Logistic
,
Loglogistic
,
Lognormal
,
Matdist
,
NegativeBinomial
,
Normal
,
Pareto
,
Poisson
,
Rayleigh
,
ShiftedLoglogistic
,
StudentTNoncentral
,
StudentT
,
Triangular
,
Uniform
,
Wald
,
Weibull
,
WeightedDiscrete
Helper function for quickly combining distributions into a Arrdist.
## S3 method for class 'Arrdist' c(..., decorators = NULL)
## S3 method for class 'Arrdist' c(..., decorators = NULL)
... |
array distributions to be concatenated. |
decorators |
If supplied then adds given decorators, otherwise pulls them from underlying distributions. |
# create three array distributions with different column names arr <- replicate(3, { pdf <- runif(400) arr <- array(pdf, c(20, 10, 2), list(NULL, sort(sample(1:20, 10)), NULL)) arr <- aperm(apply(arr, c(1, 3), function(x) x / sum(x)), c(2, 1, 3)) as.Distribution(arr, fun = "pdf") }) do.call(c, arr)
# create three array distributions with different column names arr <- replicate(3, { pdf <- runif(400) arr <- array(pdf, c(20, 10, 2), list(NULL, sort(sample(1:20, 10)), NULL)) arr <- aperm(apply(arr, c(1, 3), function(x) x / sum(x)), c(2, 1, 3)) as.Distribution(arr, fun = "pdf") }) do.call(c, arr)
Helper function for quickly combining distributions into a VectorDistribution.
## S3 method for class 'Distribution' c(..., name = NULL, short_name = NULL, decorators = NULL)
## S3 method for class 'Distribution' c(..., name = NULL, short_name = NULL, decorators = NULL)
... |
distributions to be concatenated. |
name , short_name , decorators
|
A VectorDistribution
# Construct and combine c(Binomial$new(), Normal$new()) # More complicated distributions b <- truncate(Binomial$new(), 2, 6) n <- huberize(Normal$new(), -1, 1) c(b, n) # Concatenate VectorDistributions v1 <- VectorDistribution$new(list(Binomial$new(), Normal$new())) v2 <- VectorDistribution$new( distribution = "Gamma", params = data.table::data.table(shape = 1:2, rate = 1:2) ) c(v1, v2)
# Construct and combine c(Binomial$new(), Normal$new()) # More complicated distributions b <- truncate(Binomial$new(), 2, 6) n <- huberize(Normal$new(), -1, 1) c(b, n) # Concatenate VectorDistributions v1 <- VectorDistribution$new(list(Binomial$new(), Normal$new())) v2 <- VectorDistribution$new( distribution = "Gamma", params = data.table::data.table(shape = 1:2, rate = 1:2) ) c(v1, v2)
Helper function for quickly combining distributions into a Matdist.
## S3 method for class 'Matdist' c(..., decorators = NULL)
## S3 method for class 'Matdist' c(..., decorators = NULL)
... |
matrix distributions to be concatenated. |
decorators |
If supplied then adds given decorators, otherwise pulls them from underlying distributions. |
# create three matrix distributions with different column names mats <- replicate(3, { pdf <- runif(200) mat <- matrix(pdf, 20, 10, FALSE, list(NULL, sort(sample(1:20, 10)))) mat <- t(apply(mat, 1, function(x) x / sum(x))) as.Distribution(mat, fun = "pdf") }) do.call(c, mats)
# create three matrix distributions with different column names mats <- replicate(3, { pdf <- runif(200) mat <- matrix(pdf, 20, 10, FALSE, list(NULL, sort(sample(1:20, 10)))) mat <- t(apply(mat, 1, function(x) x / sum(x))) as.Distribution(mat, fun = "pdf") }) do.call(c, mats)
Mathematical and statistical functions for the Categorical distribution, which is commonly used in classification supervised learning.
The Categorical distribution parameterised with a given support set, , and respective probabilities,
, is defined by the pmf,
for .
Sampling from this distribution is performed with the sample function with the elements given
as the support set and the probabilities from the probs
parameter. The cdf and quantile assumes
that the elements are supplied in an indexed order (otherwise the results are meaningless).
The number of points in the distribution cannot be changed after construction.
Returns an R6 object inheriting from class SDistribution.
The distribution is supported on .
Cat(elements = 1, probs = 1)
N/A
N/A
distr6::Distribution
-> distr6::SDistribution
-> Categorical
name
Full name of distribution.
short_name
Short name of distribution for printing.
description
Brief description of the distribution.
alias
Alias of the distribution.
properties
Returns distribution properties, including skewness type and symmetry.
distr6::Distribution$cdf()
distr6::Distribution$confidence()
distr6::Distribution$correlation()
distr6::Distribution$getParameterValue()
distr6::Distribution$iqr()
distr6::Distribution$liesInSupport()
distr6::Distribution$liesInType()
distr6::Distribution$median()
distr6::Distribution$parameters()
distr6::Distribution$pdf()
distr6::Distribution$prec()
distr6::Distribution$print()
distr6::Distribution$quantile()
distr6::Distribution$rand()
distr6::Distribution$setParameterValue()
distr6::Distribution$stdev()
distr6::Distribution$strprint()
distr6::Distribution$summary()
distr6::Distribution$workingSupport()
new()
Creates a new instance of this R6 class.
Categorical$new(elements = NULL, probs = NULL, decorators = NULL)
elements
list()
Categories in the distribution, see examples.
probs
numeric()
Probabilities of respective categories occurring.
decorators
(character())
Decorators to add to the distribution during construction.
# Note probabilities are automatically normalised (if not vectorised) x <- Categorical$new(elements = list("Bapple", "Banana", 2), probs = c(0.2, 0.4, 1)) # Length of elements and probabilities cannot be changed after construction x$setParameterValue(probs = c(0.1, 0.2, 0.7)) # d/p/q/r x$pdf(c("Bapple", "Carrot", 1, 2)) x$cdf("Banana") # Assumes ordered in construction x$quantile(0.42) # Assumes ordered in construction x$rand(10) # Statistics x$mode() summary(x)
mean()
The arithmetic mean of a (discrete) probability distribution X is the expectation
with an integration analogue for continuous distributions.
Categorical$mean(...)
...
Unused.
mode()
The mode of a probability distribution is the point at which the pdf is a local maximum, a distribution can be unimodal (one maximum) or multimodal (several maxima).
Categorical$mode(which = "all")
which
(character(1) | numeric(1)
Ignored if distribution is unimodal. Otherwise "all"
returns all modes, otherwise specifies
which mode to return.
variance()
The variance of a distribution is defined by the formula
where is the expectation of distribution X. If the distribution is multivariate the
covariance matrix is returned.
Categorical$variance(...)
...
Unused.
skewness()
The skewness of a distribution is defined by the third standardised moment,
where is the expectation of distribution X,
is the mean of the
distribution and
is the standard deviation of the distribution.
Categorical$skewness(...)
...
Unused.
kurtosis()
The kurtosis of a distribution is defined by the fourth standardised moment,
where is the expectation of distribution X,
is the mean of the
distribution and
is the standard deviation of the distribution.
Excess Kurtosis is Kurtosis - 3.
Categorical$kurtosis(excess = TRUE, ...)
excess
(logical(1))
If TRUE
(default) excess kurtosis returned.
...
Unused.
entropy()
The entropy of a (discrete) distribution is defined by
where is the pdf of distribution X, with an integration analogue for
continuous distributions.
Categorical$entropy(base = 2, ...)
base
(integer(1))
Base of the entropy logarithm, default = 2 (Shannon entropy)
...
Unused.
mgf()
The moment generating function is defined by
where X is the distribution and is the expectation of the distribution X.
Categorical$mgf(t, ...)
t
(integer(1))
t integer to evaluate function at.
...
Unused.
cf()
The characteristic function is defined by
where X is the distribution and is the expectation of the distribution X.
Categorical$cf(t, ...)
t
(integer(1))
t integer to evaluate function at.
...
Unused.
pgf()
The probability generating function is defined by
where X is the distribution and is the expectation of the distribution X.
Categorical$pgf(z, ...)
z
(integer(1))
z integer to evaluate probability generating function at.
...
Unused.
clone()
The objects of this class are cloneable with this method.
Categorical$clone(deep = FALSE)
deep
Whether to make a deep clone.
McLaughlin, M. P. (2001). A compendium of common probability distributions (pp. 2014-01). Michael P. McLaughlin.
Other discrete distributions:
Arrdist
,
Bernoulli
,
Binomial
,
Degenerate
,
DiscreteUniform
,
EmpiricalMV
,
Empirical
,
Geometric
,
Hypergeometric
,
Logarithmic
,
Matdist
,
Multinomial
,
NegativeBinomial
,
WeightedDiscrete
Other univariate distributions:
Arcsine
,
Arrdist
,
Bernoulli
,
BetaNoncentral
,
Beta
,
Binomial
,
Cauchy
,
ChiSquaredNoncentral
,
ChiSquared
,
Degenerate
,
DiscreteUniform
,
Empirical
,
Erlang
,
Exponential
,
FDistributionNoncentral
,
FDistribution
,
Frechet
,
Gamma
,
Geometric
,
Gompertz
,
Gumbel
,
Hypergeometric
,
InverseGamma
,
Laplace
,
Logarithmic
,
Logistic
,
Loglogistic
,
Lognormal
,
Matdist
,
NegativeBinomial
,
Normal
,
Pareto
,
Poisson
,
Rayleigh
,
ShiftedLoglogistic
,
StudentTNoncentral
,
StudentT
,
Triangular
,
Uniform
,
Wald
,
Weibull
,
WeightedDiscrete
## ------------------------------------------------ ## Method `Categorical$new` ## ------------------------------------------------ # Note probabilities are automatically normalised (if not vectorised) x <- Categorical$new(elements = list("Bapple", "Banana", 2), probs = c(0.2, 0.4, 1)) # Length of elements and probabilities cannot be changed after construction x$setParameterValue(probs = c(0.1, 0.2, 0.7)) # d/p/q/r x$pdf(c("Bapple", "Carrot", 1, 2)) x$cdf("Banana") # Assumes ordered in construction x$quantile(0.42) # Assumes ordered in construction x$rand(10) # Statistics x$mode() summary(x)
## ------------------------------------------------ ## Method `Categorical$new` ## ------------------------------------------------ # Note probabilities are automatically normalised (if not vectorised) x <- Categorical$new(elements = list("Bapple", "Banana", 2), probs = c(0.2, 0.4, 1)) # Length of elements and probabilities cannot be changed after construction x$setParameterValue(probs = c(0.1, 0.2, 0.7)) # d/p/q/r x$pdf(c("Bapple", "Carrot", 1, 2)) x$cdf("Banana") # Assumes ordered in construction x$quantile(0.42) # Assumes ordered in construction x$rand(10) # Statistics x$mode() summary(x)
Mathematical and statistical functions for the Cauchy distribution, which is commonly used in physics and finance.
The Cauchy distribution parameterised with location, , and scale,
, is defined by the pdf,
for and
.
Returns an R6 object inheriting from class SDistribution.
The distribution is supported on the Reals.
Cauchy(location = 0, scale = 1)
N/A
N/A
distr6::Distribution
-> distr6::SDistribution
-> Cauchy
name
Full name of distribution.
short_name
Short name of distribution for printing.
description
Brief description of the distribution.
alias
Alias of the distribution.
packages
Packages required to be installed in order to construct the distribution.
distr6::Distribution$cdf()
distr6::Distribution$confidence()
distr6::Distribution$correlation()
distr6::Distribution$getParameterValue()
distr6::Distribution$iqr()
distr6::Distribution$liesInSupport()
distr6::Distribution$liesInType()
distr6::Distribution$median()
distr6::Distribution$parameters()
distr6::Distribution$pdf()
distr6::Distribution$prec()
distr6::Distribution$print()
distr6::Distribution$quantile()
distr6::Distribution$rand()
distr6::Distribution$setParameterValue()
distr6::Distribution$stdev()
distr6::Distribution$strprint()
distr6::Distribution$summary()
distr6::Distribution$workingSupport()
new()
Creates a new instance of this R6 class.
Cauchy$new(location = NULL, scale = NULL, decorators = NULL)
location
(numeric(1))
Location parameter defined on the Reals.
scale
(numeric(1))
Scale parameter defined on the positive Reals.
decorators
(character())
Decorators to add to the distribution during construction.
mean()
The arithmetic mean of a (discrete) probability distribution X is the expectation
with an integration analogue for continuous distributions.
Cauchy$mean(...)
...
Unused.
mode()
The mode of a probability distribution is the point at which the pdf is a local maximum, a distribution can be unimodal (one maximum) or multimodal (several maxima).
Cauchy$mode(which = "all")
which
(character(1) | numeric(1)
Ignored if distribution is unimodal. Otherwise "all"
returns all modes, otherwise specifies
which mode to return.
variance()
The variance of a distribution is defined by the formula
where is the expectation of distribution X. If the distribution is multivariate the
covariance matrix is returned.
Cauchy$variance(...)
...
Unused.
skewness()
The skewness of a distribution is defined by the third standardised moment,
where is the expectation of distribution X,
is the mean of the
distribution and
is the standard deviation of the distribution.
Cauchy$skewness(...)
...
Unused.
kurtosis()
The kurtosis of a distribution is defined by the fourth standardised moment,
where is the expectation of distribution X,
is the mean of the
distribution and
is the standard deviation of the distribution.
Excess Kurtosis is Kurtosis - 3.
Cauchy$kurtosis(excess = TRUE, ...)
excess
(logical(1))
If TRUE
(default) excess kurtosis returned.
...
Unused.
entropy()
The entropy of a (discrete) distribution is defined by
where is the pdf of distribution X, with an integration analogue for
continuous distributions.
Cauchy$entropy(base = 2, ...)
base
(integer(1))
Base of the entropy logarithm, default = 2 (Shannon entropy)
...
Unused.
mgf()
The moment generating function is defined by
where X is the distribution and is the expectation of the distribution X.
Cauchy$mgf(t, ...)
t
(integer(1))
t integer to evaluate function at.
...
Unused.
cf()
The characteristic function is defined by
where X is the distribution and is the expectation of the distribution X.
Cauchy$cf(t, ...)
t
(integer(1))
t integer to evaluate function at.
...
Unused.
pgf()
The probability generating function is defined by
where X is the distribution and is the expectation of the distribution X.
Cauchy$pgf(z, ...)
z
(integer(1))
z integer to evaluate probability generating function at.
...
Unused.
clone()
The objects of this class are cloneable with this method.
Cauchy$clone(deep = FALSE)
deep
Whether to make a deep clone.
Chijing Zeng
McLaughlin, M. P. (2001). A compendium of common probability distributions (pp. 2014-01). Michael P. McLaughlin.
Other continuous distributions:
Arcsine
,
BetaNoncentral
,
Beta
,
ChiSquaredNoncentral
,
ChiSquared
,
Dirichlet
,
Erlang
,
Exponential
,
FDistributionNoncentral
,
FDistribution
,
Frechet
,
Gamma
,
Gompertz
,
Gumbel
,
InverseGamma
,
Laplace
,
Logistic
,
Loglogistic
,
Lognormal
,
MultivariateNormal
,
Normal
,
Pareto
,
Poisson
,
Rayleigh
,
ShiftedLoglogistic
,
StudentTNoncentral
,
StudentT
,
Triangular
,
Uniform
,
Wald
,
Weibull
Other univariate distributions:
Arcsine
,
Arrdist
,
Bernoulli
,
BetaNoncentral
,
Beta
,
Binomial
,
Categorical
,
ChiSquaredNoncentral
,
ChiSquared
,
Degenerate
,
DiscreteUniform
,
Empirical
,
Erlang
,
Exponential
,
FDistributionNoncentral
,
FDistribution
,
Frechet
,
Gamma
,
Geometric
,
Gompertz
,
Gumbel
,
Hypergeometric
,
InverseGamma
,
Laplace
,
Logarithmic
,
Logistic
,
Loglogistic
,
Lognormal
,
Matdist
,
NegativeBinomial
,
Normal
,
Pareto
,
Poisson
,
Rayleigh
,
ShiftedLoglogistic
,
StudentTNoncentral
,
StudentT
,
Triangular
,
Uniform
,
Wald
,
Weibull
,
WeightedDiscrete
Mathematical and statistical functions for the Chi-Squared distribution, which is commonly used to model the sum of independent squared Normal distributions and for confidence intervals.
The Chi-Squared distribution parameterised with degrees of freedom, , is defined by the pdf,
for .
Returns an R6 object inheriting from class SDistribution.
The distribution is supported on the Positive Reals.
ChiSq(df = 1)
N/A
N/A
distr6::Distribution
-> distr6::SDistribution
-> ChiSquared
name
Full name of distribution.
short_name
Short name of distribution for printing.
description
Brief description of the distribution.
alias
Alias of the distribution.
packages
Packages required to be installed in order to construct the distribution.
properties
Returns distribution properties, including skewness type and symmetry.
distr6::Distribution$cdf()
distr6::Distribution$confidence()
distr6::Distribution$correlation()
distr6::Distribution$getParameterValue()
distr6::Distribution$iqr()
distr6::Distribution$liesInSupport()
distr6::Distribution$liesInType()
distr6::Distribution$median()
distr6::Distribution$parameters()
distr6::Distribution$pdf()
distr6::Distribution$prec()
distr6::Distribution$print()
distr6::Distribution$quantile()
distr6::Distribution$rand()
distr6::Distribution$setParameterValue()
distr6::Distribution$stdev()
distr6::Distribution$strprint()
distr6::Distribution$summary()
distr6::Distribution$workingSupport()
new()
Creates a new instance of this R6 class.
ChiSquared$new(df = NULL, decorators = NULL)
df
(integer(1))
Degrees of freedom of the distribution defined on the positive Reals.
decorators
(character())
Decorators to add to the distribution during construction.
mean()
The arithmetic mean of a (discrete) probability distribution X is the expectation
with an integration analogue for continuous distributions.
ChiSquared$mean(...)
...
Unused.
mode()
The mode of a probability distribution is the point at which the pdf is a local maximum, a distribution can be unimodal (one maximum) or multimodal (several maxima).
ChiSquared$mode(which = "all")
which
(character(1) | numeric(1)
Ignored if distribution is unimodal. Otherwise "all"
returns all modes, otherwise specifies
which mode to return.
variance()
The variance of a distribution is defined by the formula
where is the expectation of distribution X. If the distribution is multivariate the
covariance matrix is returned.
ChiSquared$variance(...)
...
Unused.
skewness()
The skewness of a distribution is defined by the third standardised moment,
where is the expectation of distribution X,
is the mean of the
distribution and
is the standard deviation of the distribution.
ChiSquared$skewness(...)
...
Unused.
kurtosis()
The kurtosis of a distribution is defined by the fourth standardised moment,
where is the expectation of distribution X,
is the mean of the
distribution and
is the standard deviation of the distribution.
Excess Kurtosis is Kurtosis - 3.
ChiSquared$kurtosis(excess = TRUE, ...)
excess
(logical(1))
If TRUE
(default) excess kurtosis returned.
...
Unused.
entropy()
The entropy of a (discrete) distribution is defined by
where is the pdf of distribution X, with an integration analogue for
continuous distributions.
ChiSquared$entropy(base = 2, ...)
base
(integer(1))
Base of the entropy logarithm, default = 2 (Shannon entropy)
...
Unused.
mgf()
The moment generating function is defined by
where X is the distribution and is the expectation of the distribution X.
ChiSquared$mgf(t, ...)
t
(integer(1))
t integer to evaluate function at.
...
Unused.
cf()
The characteristic function is defined by
where X is the distribution and is the expectation of the distribution X.
ChiSquared$cf(t, ...)
t
(integer(1))
t integer to evaluate function at.
...
Unused.
pgf()
The probability generating function is defined by
where X is the distribution and is the expectation of the distribution X.
ChiSquared$pgf(z, ...)
z
(integer(1))
z integer to evaluate probability generating function at.
...
Unused.
clone()
The objects of this class are cloneable with this method.
ChiSquared$clone(deep = FALSE)
deep
Whether to make a deep clone.
McLaughlin, M. P. (2001). A compendium of common probability distributions (pp. 2014-01). Michael P. McLaughlin.
Other continuous distributions:
Arcsine
,
BetaNoncentral
,
Beta
,
Cauchy
,
ChiSquaredNoncentral
,
Dirichlet
,
Erlang
,
Exponential
,
FDistributionNoncentral
,
FDistribution
,
Frechet
,
Gamma
,
Gompertz
,
Gumbel
,
InverseGamma
,
Laplace
,
Logistic
,
Loglogistic
,
Lognormal
,
MultivariateNormal
,
Normal
,
Pareto
,
Poisson
,
Rayleigh
,
ShiftedLoglogistic
,
StudentTNoncentral
,
StudentT
,
Triangular
,
Uniform
,
Wald
,
Weibull
Other univariate distributions:
Arcsine
,
Arrdist
,
Bernoulli
,
BetaNoncentral
,
Beta
,
Binomial
,
Categorical
,
Cauchy
,
ChiSquaredNoncentral
,
Degenerate
,
DiscreteUniform
,
Empirical
,
Erlang
,
Exponential
,
FDistributionNoncentral
,
FDistribution
,
Frechet
,
Gamma
,
Geometric
,
Gompertz
,
Gumbel
,
Hypergeometric
,
InverseGamma
,
Laplace
,
Logarithmic
,
Logistic
,
Loglogistic
,
Lognormal
,
Matdist
,
NegativeBinomial
,
Normal
,
Pareto
,
Poisson
,
Rayleigh
,
ShiftedLoglogistic
,
StudentTNoncentral
,
StudentT
,
Triangular
,
Uniform
,
Wald
,
Weibull
,
WeightedDiscrete
Mathematical and statistical functions for the Noncentral Chi-Squared distribution, which is commonly used to model the sum of independent squared Normal distributions and for confidence intervals.
The Noncentral Chi-Squared distribution parameterised with degrees of freedom, , and location,
, is defined by the pdf,
for ,
.
Returns an R6 object inheriting from class SDistribution.
The distribution is supported on the Positive Reals.
ChiSqNC(df = 1, location = 0)
N/A
N/A
distr6::Distribution
-> distr6::SDistribution
-> ChiSquaredNoncentral
name
Full name of distribution.
short_name
Short name of distribution for printing.
description
Brief description of the distribution.
alias
Alias of the distribution.
packages
Packages required to be installed in order to construct the distribution.
properties
Returns distribution properties, including skewness type and symmetry.
distr6::Distribution$cdf()
distr6::Distribution$confidence()
distr6::Distribution$correlation()
distr6::Distribution$getParameterValue()
distr6::Distribution$iqr()
distr6::Distribution$liesInSupport()
distr6::Distribution$liesInType()
distr6::Distribution$median()
distr6::Distribution$parameters()
distr6::Distribution$pdf()
distr6::Distribution$prec()
distr6::Distribution$print()
distr6::Distribution$quantile()
distr6::Distribution$rand()
distr6::Distribution$setParameterValue()
distr6::Distribution$stdev()
distr6::Distribution$strprint()
distr6::Distribution$summary()
distr6::Distribution$workingSupport()
new()
Creates a new instance of this R6 class.
ChiSquaredNoncentral$new(df = NULL, location = NULL, decorators = NULL)
df
(integer(1))
Degrees of freedom of the distribution defined on the positive Reals.
location
(numeric(1))
Location parameter, defined on the non-negative Reals.
decorators
(character())
Decorators to add to the distribution during construction.
mean()
The arithmetic mean of a (discrete) probability distribution X is the expectation
with an integration analogue for continuous distributions.
ChiSquaredNoncentral$mean(...)
...
Unused.
variance()
The variance of a distribution is defined by the formula
where is the expectation of distribution X. If the distribution is multivariate the
covariance matrix is returned.
ChiSquaredNoncentral$variance(...)
...
Unused.
skewness()
The skewness of a distribution is defined by the third standardised moment,
where is the expectation of distribution X,
is the mean of the
distribution and
is the standard deviation of the distribution.
ChiSquaredNoncentral$skewness(...)
...
Unused.
kurtosis()
The kurtosis of a distribution is defined by the fourth standardised moment,
where is the expectation of distribution X,
is the mean of the
distribution and
is the standard deviation of the distribution.
Excess Kurtosis is Kurtosis - 3.
ChiSquaredNoncentral$kurtosis(excess = TRUE, ...)
excess
(logical(1))
If TRUE
(default) excess kurtosis returned.
...
Unused.
mgf()
The moment generating function is defined by
where X is the distribution and is the expectation of the distribution X.
ChiSquaredNoncentral$mgf(t, ...)
t
(integer(1))
t integer to evaluate function at.
...
Unused.
cf()
The characteristic function is defined by
where X is the distribution and is the expectation of the distribution X.
ChiSquaredNoncentral$cf(t, ...)
t
(integer(1))
t integer to evaluate function at.
...
Unused.
clone()
The objects of this class are cloneable with this method.
ChiSquaredNoncentral$clone(deep = FALSE)
deep
Whether to make a deep clone.
Jordan Deenichin
McLaughlin, M. P. (2001). A compendium of common probability distributions (pp. 2014-01). Michael P. McLaughlin.
Other continuous distributions:
Arcsine
,
BetaNoncentral
,
Beta
,
Cauchy
,
ChiSquared
,
Dirichlet
,
Erlang
,
Exponential
,
FDistributionNoncentral
,
FDistribution
,
Frechet
,
Gamma
,
Gompertz
,
Gumbel
,
InverseGamma
,
Laplace
,
Logistic
,
Loglogistic
,
Lognormal
,
MultivariateNormal
,
Normal
,
Pareto
,
Poisson
,
Rayleigh
,
ShiftedLoglogistic
,
StudentTNoncentral
,
StudentT
,
Triangular
,
Uniform
,
Wald
,
Weibull
Other univariate distributions:
Arcsine
,
Arrdist
,
Bernoulli
,
BetaNoncentral
,
Beta
,
Binomial
,
Categorical
,
Cauchy
,
ChiSquared
,
Degenerate
,
DiscreteUniform
,
Empirical
,
Erlang
,
Exponential
,
FDistributionNoncentral
,
FDistribution
,
Frechet
,
Gamma
,
Geometric
,
Gompertz
,
Gumbel
,
Hypergeometric
,
InverseGamma
,
Laplace
,
Logarithmic
,
Logistic
,
Loglogistic
,
Lognormal
,
Matdist
,
NegativeBinomial
,
Normal
,
Pareto
,
Poisson
,
Rayleigh
,
ShiftedLoglogistic
,
StudentTNoncentral
,
StudentT
,
Triangular
,
Uniform
,
Wald
,
Weibull
,
WeightedDiscrete
Calculates the convolution of two distribution via numerical calculations.
## S3 method for class 'Distribution' x + y ## S3 method for class 'Distribution' x - y
## S3 method for class 'Distribution' x + y ## S3 method for class 'Distribution' x - y
x , y
|
The convolution of two probability distributions ,
is the sum
which has a pmf,
with an integration analogue for continuous distributions.
Currently distr6 supports the addition of discrete and continuous probability distributions, but only subtraction of continuous distributions.
Returns an R6 object of class Convolution.
distr6::Distribution
-> distr6::DistributionWrapper
-> Convolution
distr6::Distribution$cdf()
distr6::Distribution$confidence()
distr6::Distribution$correlation()
distr6::Distribution$getParameterValue()
distr6::Distribution$iqr()
distr6::Distribution$liesInSupport()
distr6::Distribution$liesInType()
distr6::Distribution$median()
distr6::Distribution$parameters()
distr6::Distribution$pdf()
distr6::Distribution$prec()
distr6::Distribution$print()
distr6::Distribution$quantile()
distr6::Distribution$rand()
distr6::Distribution$setParameterValue()
distr6::Distribution$stdev()
distr6::Distribution$strprint()
distr6::Distribution$summary()
distr6::Distribution$workingSupport()
distr6::DistributionWrapper$wrappedModels()
new()
Creates a new instance of this R6 class.
Convolution$new(dist1, dist2, add = TRUE)
dist1
([Distribution])
First Distribution in convolution, i.e. dist1 ± dist2
.
dist2
([Distribution])
Second Distribution in convolution, i.e. dist1 ± dist2
.
add
(logical(1))
If TRUE
(default) then adds the distributions together, otherwise substracts.
clone()
The objects of this class are cloneable with this method.
Convolution$clone(deep = FALSE)
deep
Whether to make a deep clone.
Other wrappers:
DistributionWrapper
,
HuberizedDistribution
,
MixtureDistribution
,
ProductDistribution
,
TruncatedDistribution
,
VectorDistribution
binom <- Bernoulli$new() + Bernoulli$new() binom$pdf(2) Binomial$new(size = 2)$pdf(2) norm <- Normal$new(mean = 3) - Normal$new(mean = 2) norm$pdf(1) Normal$new(mean = 1, var = 2)$pdf(1)
binom <- Bernoulli$new() + Bernoulli$new() binom$pdf(2) Binomial$new(size = 2)$pdf(2) norm <- Normal$new(mean = 3) - Normal$new(mean = 2) norm$pdf(1) Normal$new(mean = 1, var = 2)$pdf(1)
This decorator adds numeric methods for missing analytic expressions in Distributions as well as adding generalised expectation and moments functions.
Decorator objects add functionality to the given Distribution object by copying methods in the decorator environment to the chosen Distribution environment.
All methods implemented in decorators try to exploit analytical results where possible, otherwise numerical results are used with a message.
distr6::DistributionDecorator
-> CoreStatistics
mgf()
Numerically estimates the moment-generating function.
CoreStatistics$mgf(t, ...)
t
(integer(1))
t integer to evaluate function at.
...
ANY
Passed to $genExp
.
cf()
Numerically estimates the characteristic function.
CoreStatistics$cf(t, ...)
t
(integer(1))
t integer to evaluate function at.
...
ANY
Passed to $genExp
.
pgf()
Numerically estimates the probability-generating function.
CoreStatistics$pgf(z, ...)
z
(integer(1))
z integer to evaluate probability generating function at.
...
ANY
Passed to $genExp
.
entropy()
Numerically estimates the entropy function.
CoreStatistics$entropy(base = 2, ...)
base
(integer(1))
Base of the entropy logarithm, default = 2 (Shannon entropy)
...
ANY
Passed to $genExp
.
skewness()
Numerically estimates the distribution skewness.
CoreStatistics$skewness(...)
...
ANY
Passed to $genExp
.
kurtosis()
Numerically estimates the distribution kurtosis.
CoreStatistics$kurtosis(excess = TRUE, ...)
excess
(logical(1))
If TRUE
(default) excess kurtosis returned.
...
ANY
Passed to $genExp
.
variance()
Numerically estimates the distribution variance.
CoreStatistics$variance(...)
...
ANY
Passed to $genExp
.
kthmoment()
The kth central moment of a distribution is defined by
the kth standardised moment of a distribution is defined by
the kth raw moment of a distribution is defined by
where is the expectation of distribution X,
is the mean of the
distribution and
is the standard deviation of the distribution.
CoreStatistics$kthmoment(k, type = c("central", "standard", "raw"), ...)
k
integer(1)
The k
-th moment to evaluate the distribution at.
type
character(1)
Type of moment to evaluate.
...
ANY
Passed to $genExp
.
genExp()
Numerically estimates for some function
.
CoreStatistics$genExp(trafo = NULL, cubature = FALSE, ...)
trafo
function()
Transformation function to define the expectation, default is distribution mean.
cubature
logical(1)
If TRUE
uses cubature::cubintegrate for approximation, otherwise integrate.
...
ANY
Passed to cubature::cubintegrate.
mode()
Numerically estimates the distribution mode.
CoreStatistics$mode(which = "all")
which
(character(1) | numeric(1)
Ignored if distribution is unimodal. Otherwise "all"
returns all modes, otherwise specifies
which mode to return.
mean()
Numerically estimates the distribution mean.
CoreStatistics$mean(...)
...
ANY
Passed to $genExp
.
clone()
The objects of this class are cloneable with this method.
CoreStatistics$clone(deep = FALSE)
deep
Whether to make a deep clone.
Other decorators:
ExoticStatistics
,
FunctionImputation
decorate(Exponential$new(), "CoreStatistics") Exponential$new(decorators = "CoreStatistics") CoreStatistics$new()$decorate(Exponential$new())
decorate(Exponential$new(), "CoreStatistics") Exponential$new(decorators = "CoreStatistics") CoreStatistics$new()$decorate(Exponential$new())
Mathematical and statistical functions for the Cosine kernel defined by the pdf,
over the support .
distr6::Distribution
-> distr6::Kernel
-> Cosine
name
Full name of distribution.
short_name
Short name of distribution for printing.
description
Brief description of the distribution.
distr6::Distribution$cdf()
distr6::Distribution$confidence()
distr6::Distribution$correlation()
distr6::Distribution$getParameterValue()
distr6::Distribution$iqr()
distr6::Distribution$liesInSupport()
distr6::Distribution$liesInType()
distr6::Distribution$parameters()
distr6::Distribution$pdf()
distr6::Distribution$prec()
distr6::Distribution$print()
distr6::Distribution$quantile()
distr6::Distribution$rand()
distr6::Distribution$setParameterValue()
distr6::Distribution$stdev()
distr6::Distribution$strprint()
distr6::Distribution$summary()
distr6::Distribution$workingSupport()
distr6::Kernel$initialize()
distr6::Kernel$mean()
distr6::Kernel$median()
distr6::Kernel$mode()
distr6::Kernel$skewness()
pdfSquared2Norm()
The squared 2-norm of the pdf is defined by
where X is the Distribution, is its pdf and
are the distribution support limits.
Cosine$pdfSquared2Norm(x = 0, upper = Inf)
x
(numeric(1))
Amount to shift the result.
upper
(numeric(1))
Upper limit of the integral.
cdfSquared2Norm()
The squared 2-norm of the cdf is defined by
where X is the Distribution, is its pdf and
are the distribution support limits.
Cosine$cdfSquared2Norm(x = 0, upper = 0)
x
(numeric(1))
Amount to shift the result.
upper
(numeric(1))
Upper limit of the integral.
variance()
The variance of a distribution is defined by the formula
where is the expectation of distribution X. If the distribution is multivariate the
covariance matrix is returned.
Cosine$variance(...)
...
Unused.
clone()
The objects of this class are cloneable with this method.
Cosine$clone(deep = FALSE)
deep
Whether to make a deep clone.
Other kernels:
Epanechnikov
,
LogisticKernel
,
NormalKernel
,
Quartic
,
Sigmoid
,
Silverman
,
TriangularKernel
,
Tricube
,
Triweight
,
UniformKernel
Functionality to decorate R6 Distributions (and child classes) with extra methods.
decorate(distribution, decorators, ...)
decorate(distribution, decorators, ...)
distribution |
|
decorators |
|
... |
|
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.
Returns a Distribution with additional methods from the chosen DistributionDecorator.
Gamma, Erich, Richard Helm, Ralph Johnson, and John Vlissides. 1994. “Design Patterns: Elements of Reusable Object-Oriented Software.” Addison-Wesley.
listDecorators()
for available decorators and DistributionDecorator for the parent
class.
B <- Binomial$new() decorate(B, "CoreStatistics") E <- Exponential$new() decorate(E, c("CoreStatistics", "ExoticStatistics"))
B <- Binomial$new() decorate(B, "CoreStatistics") E <- Exponential$new() decorate(E, c("CoreStatistics", "ExoticStatistics"))
Mathematical and statistical functions for the Degenerate distribution, which is commonly used to model deterministic events or as a representation of the delta, or Heaviside, function.
The Degenerate distribution parameterised with mean, is defined by the pmf,
for .
Returns an R6 object inheriting from class SDistribution.
The distribution is supported on .
Degen(mean = 0)
N/A
Also known as the Dirac distribution.
distr6::Distribution
-> distr6::SDistribution
-> Degenerate
name
Full name of distribution.
short_name
Short name of distribution for printing.
description
Brief description of the distribution.
alias
Alias of the distribution.
properties
Returns distribution properties, including skewness type and symmetry.
distr6::Distribution$cdf()
distr6::Distribution$confidence()
distr6::Distribution$correlation()
distr6::Distribution$getParameterValue()
distr6::Distribution$iqr()
distr6::Distribution$liesInSupport()
distr6::Distribution$liesInType()
distr6::Distribution$median()
distr6::Distribution$parameters()
distr6::Distribution$pdf()
distr6::Distribution$prec()
distr6::Distribution$print()
distr6::Distribution$quantile()
distr6::Distribution$rand()
distr6::Distribution$setParameterValue()
distr6::Distribution$stdev()
distr6::Distribution$strprint()
distr6::Distribution$summary()
distr6::Distribution$workingSupport()
new()
Creates a new instance of this R6 class.
Degenerate$new(mean = NULL, decorators = NULL)
mean
numeric(1)
Mean of the distribution, defined on the Reals.
decorators
(character())
Decorators to add to the distribution during construction.
mean()
The arithmetic mean of a (discrete) probability distribution X is the expectation
with an integration analogue for continuous distributions.
Degenerate$mean(...)
...
Unused.
mode()
The mode of a probability distribution is the point at which the pdf is a local maximum, a distribution can be unimodal (one maximum) or multimodal (several maxima).
Degenerate$mode(which = "all")
which
(character(1) | numeric(1)
Ignored if distribution is unimodal. Otherwise "all"
returns all modes, otherwise specifies
which mode to return.
variance()
The variance of a distribution is defined by the formula
where is the expectation of distribution X. If the distribution is multivariate the
covariance matrix is returned.
Degenerate$variance(...)
...
Unused.
skewness()
The skewness of a distribution is defined by the third standardised moment,
where is the expectation of distribution X,
is the mean of the
distribution and
is the standard deviation of the distribution.
Degenerate$skewness(...)
...
Unused.
kurtosis()
The kurtosis of a distribution is defined by the fourth standardised moment,
where is the expectation of distribution X,
is the mean of the
distribution and
is the standard deviation of the distribution.
Excess Kurtosis is Kurtosis - 3.
Degenerate$kurtosis(excess = TRUE, ...)
excess
(logical(1))
If TRUE
(default) excess kurtosis returned.
...
Unused.
entropy()
The entropy of a (discrete) distribution is defined by
where is the pdf of distribution X, with an integration analogue for
continuous distributions.
Degenerate$entropy(base = 2, ...)
base
(integer(1))
Base of the entropy logarithm, default = 2 (Shannon entropy)
...
Unused.
mgf()
The moment generating function is defined by
where X is the distribution and is the expectation of the distribution X.
Degenerate$mgf(t, ...)
t
(integer(1))
t integer to evaluate function at.
...
Unused.
cf()
The characteristic function is defined by
where X is the distribution and is the expectation of the distribution X.
Degenerate$cf(t, ...)
t
(integer(1))
t integer to evaluate function at.
...
Unused.
clone()
The objects of this class are cloneable with this method.
Degenerate$clone(deep = FALSE)
deep
Whether to make a deep clone.
McLaughlin, M. P. (2001). A compendium of common probability distributions (pp. 2014-01). Michael P. McLaughlin.
Other discrete distributions:
Arrdist
,
Bernoulli
,
Binomial
,
Categorical
,
DiscreteUniform
,
EmpiricalMV
,
Empirical
,
Geometric
,
Hypergeometric
,
Logarithmic
,
Matdist
,
Multinomial
,
NegativeBinomial
,
WeightedDiscrete
Other univariate distributions:
Arcsine
,
Arrdist
,
Bernoulli
,
BetaNoncentral
,
Beta
,
Binomial
,
Categorical
,
Cauchy
,
ChiSquaredNoncentral
,
ChiSquared
,
DiscreteUniform
,
Empirical
,
Erlang
,
Exponential
,
FDistributionNoncentral
,
FDistribution
,
Frechet
,
Gamma
,
Geometric
,
Gompertz
,
Gumbel
,
Hypergeometric
,
InverseGamma
,
Laplace
,
Logarithmic
,
Logistic
,
Loglogistic
,
Lognormal
,
Matdist
,
NegativeBinomial
,
Normal
,
Pareto
,
Poisson
,
Rayleigh
,
ShiftedLoglogistic
,
StudentTNoncentral
,
StudentT
,
Triangular
,
Uniform
,
Wald
,
Weibull
,
WeightedDiscrete
Mathematical and statistical functions for the Dirichlet distribution, which is commonly used as a prior in Bayesian modelling and is multivariate generalisation of the Beta distribution.
The Dirichlet distribution parameterised with concentration parameters, , is defined by the pdf,
for , where
is the gamma function.
Sampling is performed via sampling independent Gamma distributions and normalising the samples (Devroye, 1986).
Returns an R6 object inheriting from class SDistribution.
The distribution is supported on .
Diri(params = c(1, 1))
cdf
and quantile
are
omitted as no closed form analytic expression could be found, decorate with FunctionImputation
for a numerical imputation.
N/A
distr6::Distribution
-> distr6::SDistribution
-> Dirichlet
name
Full name of distribution.
short_name
Short name of distribution for printing.
description
Brief description of the distribution.
alias
Alias of the distribution.
packages
Packages required to be installed in order to construct the distribution.
properties
Returns distribution properties, including skewness type and symmetry.
distr6::Distribution$cdf()
distr6::Distribution$confidence()
distr6::Distribution$correlation()
distr6::Distribution$getParameterValue()
distr6::Distribution$iqr()
distr6::Distribution$liesInSupport()
distr6::Distribution$liesInType()
distr6::Distribution$median()
distr6::Distribution$parameters()
distr6::Distribution$pdf()
distr6::Distribution$prec()
distr6::Distribution$print()
distr6::Distribution$quantile()
distr6::Distribution$rand()
distr6::Distribution$stdev()
distr6::Distribution$strprint()
distr6::Distribution$summary()
distr6::Distribution$workingSupport()
new()
Creates a new instance of this R6 class.
Dirichlet$new(params = NULL, decorators = NULL)
params
numeric()
Vector of concentration parameters of the distribution defined on the positive Reals.
decorators
(character())
Decorators to add to the distribution during construction.
mean()
The arithmetic mean of a (discrete) probability distribution X is the expectation
with an integration analogue for continuous distributions.
Dirichlet$mean(...)
...
Unused.
mode()
The mode of a probability distribution is the point at which the pdf is a local maximum, a distribution can be unimodal (one maximum) or multimodal (several maxima).
Dirichlet$mode(which = "all")
which
(character(1) | numeric(1)
Ignored if distribution is unimodal. Otherwise "all"
returns all modes, otherwise specifies
which mode to return.
variance()
The variance of a distribution is defined by the formula
where is the expectation of distribution X. If the distribution is multivariate the
covariance matrix is returned.
Dirichlet$variance(...)
...
Unused.
entropy()
The entropy of a (discrete) distribution is defined by
where is the pdf of distribution X, with an integration analogue for
continuous distributions.
Dirichlet$entropy(base = 2, ...)
base
(integer(1))
Base of the entropy logarithm, default = 2 (Shannon entropy)
...
Unused.
pgf()
The probability generating function is defined by
where X is the distribution and is the expectation of the distribution X.
Dirichlet$pgf(z, ...)
z
(integer(1))
z integer to evaluate probability generating function at.
...
Unused.
setParameterValue()
Sets the value(s) of the given parameter(s).
Dirichlet$setParameterValue( ..., lst = list(...), error = "warn", resolveConflicts = FALSE )
...
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.
clone()
The objects of this class are cloneable with this method.
Dirichlet$clone(deep = FALSE)
deep
Whether to make a deep clone.
McLaughlin, M. P. (2001). A compendium of common probability distributions (pp. 2014-01). Michael P. McLaughlin.
Devroye, Luc (1986). Non-Uniform Random Variate Generation. Springer-Verlag. ISBN 0-387-96305-7.
Other continuous distributions:
Arcsine
,
BetaNoncentral
,
Beta
,
Cauchy
,
ChiSquaredNoncentral
,
ChiSquared
,
Erlang
,
Exponential
,
FDistributionNoncentral
,
FDistribution
,
Frechet
,
Gamma
,
Gompertz
,
Gumbel
,
InverseGamma
,
Laplace
,
Logistic
,
Loglogistic
,
Lognormal
,
MultivariateNormal
,
Normal
,
Pareto
,
Poisson
,
Rayleigh
,
ShiftedLoglogistic
,
StudentTNoncentral
,
StudentT
,
Triangular
,
Uniform
,
Wald
,
Weibull
Other multivariate distributions:
EmpiricalMV
,
Multinomial
,
MultivariateNormal
d <- Dirichlet$new(params = c(2, 5, 6)) d$pdf(0.1, 0.4, 0.5) d$pdf(c(0.3, 0.2), c(0.6, 0.9), c(0.9, 0.1))
d <- Dirichlet$new(params = c(2, 5, 6)) d$pdf(0.1, 0.4, 0.5) d$pdf(c(0.3, 0.2), c(0.6, 0.9), c(0.9, 0.1))
Mathematical and statistical functions for the Discrete Uniform distribution, which is commonly used as a discrete variant of the more popular Uniform distribution, used to model events with an equal probability of occurring (e.g. role of a die).
The Discrete Uniform distribution parameterised with lower, , and upper,
, limits is defined by the pmf,
for .
Returns an R6 object inheriting from class SDistribution.
The distribution is supported on .
DUnif(lower = 0, upper = 1)
N/A
N/A
distr6::Distribution
-> distr6::SDistribution
-> DiscreteUniform
name
Full name of distribution.
short_name
Short name of distribution for printing.
description
Brief description of the distribution.
alias
Alias of the distribution.
packages
Packages required to be installed in order to construct the distribution.
properties
Returns distribution properties, including skewness type and symmetry.
distr6::Distribution$cdf()
distr6::Distribution$confidence()
distr6::Distribution$correlation()
distr6::Distribution$getParameterValue()
distr6::Distribution$iqr()
distr6::Distribution$liesInSupport()
distr6::Distribution$liesInType()
distr6::Distribution$median()
distr6::Distribution$parameters()
distr6::Distribution$pdf()
distr6::Distribution$prec()
distr6::Distribution$print()
distr6::Distribution$quantile()
distr6::Distribution$rand()
distr6::Distribution$setParameterValue()
distr6::Distribution$stdev()
distr6::Distribution$strprint()
distr6::Distribution$summary()
distr6::Distribution$workingSupport()
new()
Creates a new instance of this R6 class.
DiscreteUniform$new(lower = NULL, upper = NULL, decorators = NULL)
lower
(integer(1))
Lower limit of the Distribution, defined on the Naturals.
upper
(integer(1))
Upper limit of the Distribution, defined on the Naturals.
decorators
(character())
Decorators to add to the distribution during construction.
mean()
The arithmetic mean of a (discrete) probability distribution X is the expectation
with an integration analogue for continuous distributions.
DiscreteUniform$mean(...)
...
Unused.
mode()
The mode of a probability distribution is the point at which the pdf is a local maximum, a distribution can be unimodal (one maximum) or multimodal (several maxima).
DiscreteUniform$mode(which = "all")
which
(character(1) | numeric(1)
Ignored if distribution is unimodal. Otherwise "all"
returns all modes, otherwise specifies
which mode to return.
variance()
The variance of a distribution is defined by the formula
where is the expectation of distribution X. If the distribution is multivariate the
covariance matrix is returned.
DiscreteUniform$variance(...)
...
Unused.
skewness()
The skewness of a distribution is defined by the third standardised moment,
where is the expectation of distribution X,
is the mean of the
distribution and
is the standard deviation of the distribution.
DiscreteUniform$skewness(...)
...
Unused.
kurtosis()
The kurtosis of a distribution is defined by the fourth standardised moment,
where is the expectation of distribution X,
is the mean of the
distribution and
is the standard deviation of the distribution.
Excess Kurtosis is Kurtosis - 3.
DiscreteUniform$kurtosis(excess = TRUE, ...)
excess
(logical(1))
If TRUE
(default) excess kurtosis returned.
...
Unused.
entropy()
The entropy of a (discrete) distribution is defined by
where is the pdf of distribution X, with an integration analogue for
continuous distributions.
DiscreteUniform$entropy(base = 2, ...)
base
(integer(1))
Base of the entropy logarithm, default = 2 (Shannon entropy)
...
Unused.
mgf()
The moment generating function is defined by
where X is the distribution and is the expectation of the distribution X.
DiscreteUniform$mgf(t, ...)
t
(integer(1))
t integer to evaluate function at.
...
Unused.
cf()
The characteristic function is defined by
where X is the distribution and is the expectation of the distribution X.
DiscreteUniform$cf(t, ...)
t
(integer(1))
t integer to evaluate function at.
...
Unused.
pgf()
The probability generating function is defined by
where X is the distribution and is the expectation of the distribution X.
DiscreteUniform$pgf(z, ...)
z
(integer(1))
z integer to evaluate probability generating function at.
...
Unused.
clone()
The objects of this class are cloneable with this method.
DiscreteUniform$clone(deep = FALSE)
deep
Whether to make a deep clone.
McLaughlin, M. P. (2001). A compendium of common probability distributions (pp. 2014-01). Michael P. McLaughlin.
Other discrete distributions:
Arrdist
,
Bernoulli
,
Binomial
,
Categorical
,
Degenerate
,
EmpiricalMV
,
Empirical
,
Geometric
,
Hypergeometric
,
Logarithmic
,
Matdist
,
Multinomial
,
NegativeBinomial
,
WeightedDiscrete
Other univariate distributions:
Arcsine
,
Arrdist
,
Bernoulli
,
BetaNoncentral
,
Beta
,
Binomial
,
Categorical
,
Cauchy
,
ChiSquaredNoncentral
,
ChiSquared
,
Degenerate
,
Empirical
,
Erlang
,
Exponential
,
FDistributionNoncentral
,
FDistribution
,
Frechet
,
Gamma
,
Geometric
,
Gompertz
,
Gumbel
,
Hypergeometric
,
InverseGamma
,
Laplace
,
Logarithmic
,
Logistic
,
Loglogistic
,
Lognormal
,
Matdist
,
NegativeBinomial
,
Normal
,
Pareto
,
Poisson
,
Rayleigh
,
ShiftedLoglogistic
,
StudentTNoncentral
,
StudentT
,
Triangular
,
Uniform
,
Wald
,
Weibull
,
WeightedDiscrete
Displays the contents of the NEWS.md file for viewing distr6 release information.
distr6News()
distr6News()
NEWS.md in viewer.
## Not run: distr6News() ## End(Not run)
## Not run: distr6News() ## End(Not run)
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.
name
Full name of distribution.
short_name
Short name of distribution for printing.
description
Brief description of the distribution.
alias
Alias of the distribution.
decorators
Returns decorators currently used to decorate the distribution.
traits
Returns distribution traits.
valueSupport
Deprecated, use $traits$valueSupport
.
variateForm
Deprecated, use $traits$variateForm
.
type
Deprecated, use $traits$type
.
properties
Returns distribution properties, including skewness type and symmetry.
support
Deprecated, use $properties$type
.
symmetry
Deprecated, use $properties$symmetry
.
sup
Returns supremum (upper bound) of the distribution support.
inf
Returns infimum (lower bound) of the distribution support.
dmax
Returns maximum of the distribution support.
dmin
Returns minimum of the distribution support.
kurtosisType
Deprecated, use $properties$kurtosis
.
skewnessType
Deprecated, use $properties$skewness
.
new()
Creates a new instance of this R6 class.
Distribution$new( name = NULL, short_name = NULL, type, support = NULL, symmetric = FALSE, pdf = NULL, cdf = NULL, quantile = NULL, rand = NULL, parameters = NULL, decorators = NULL, valueSupport = NULL, variateForm = NULL, description = NULL, .suppressChecks = FALSE )
name
character(1)
Full name of distribution.
short_name
character(1)
Short name of distribution for printing.
type
([set6::Set])
Distribution type.
support
([set6::Set])
Distribution support.
symmetric
logical(1)
Symmetry type of the distribution.
pdf
function(1)
Probability density function of the distribution. At least one of pdf
and
cdf
must be provided.
cdf
function(1)
Cumulative distribution function of the distribution. At least one of pdf
and
cdf
must be provided.
quantile
function(1)
Quantile (inverse-cdf) function of the distribution.
rand
function(1)
Simulation function for drawing random samples from the distribution.
parameters
([param6::ParameterSet])
Parameter set for defining the parameters in the distribution, which should be set before
construction.
decorators
(character())
Decorators to add to the distribution during construction.
valueSupport
(character(1))
The support type of the distribution, one of "discrete", "continuous", "mixture"
.
If NULL
, determined automatically.
variateForm
(character(1))
The variate type of the distribution, one of "univariate", "multivariate", "matrixvariate"
.
If NULL
, determined automatically.
description
(character(1))
Optional short description of the distribution.
.suppressChecks
(logical(1))
Used internally.
alias
character(1)
Alias of distribution for parsing.
strprint()
Printable string representation of the Distribution
. Primarily used internally.
Distribution$strprint(n = 2)
n
(integer(1))
Number of parameters to display when printing.
print()
Prints the Distribution
.
Distribution$print(n = 2, ...)
n
(integer(1))
Passed to $strprint
.
...
ANY
Unused. Added for consistency.
summary()
Prints a summary of the Distribution
.
Distribution$summary(full = TRUE, ...)
full
(logical(1))
If TRUE
(default) prints a long summary of the distribution,
otherwise prints a shorter summary.
...
ANY
Unused. Added for consistency.
parameters()
Returns the full parameter details for the supplied parameter.
Distribution$parameters(id = NULL)
id
Deprecated.
getParameterValue()
Returns the value of the supplied parameter.
Distribution$getParameterValue(id, error = "warn")
id
character()
id of parameter value to return.
error
(character(1))
If "warn"
then returns a warning on error, otherwise breaks if "stop"
.
setParameterValue()
Sets the value(s) of the given parameter(s).
Distribution$setParameterValue( ..., lst = list(...), error = "warn", resolveConflicts = FALSE )
...
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.
b = Binomial$new() b$setParameterValue(size = 4, prob = 0.4) b$setParameterValue(lst = list(size = 4, prob = 0.4))
pdf()
For discrete distributions the probability mass function (pmf) is returned, defined as
for continuous distributions the probability density function (pdf), , is returned
for some infinitesimally small .
If available a pdf will be returned using an analytic expression. Otherwise,
if the distribution has not been decorated with FunctionImputation, NULL
is
returned.
Distribution$pdf(..., log = FALSE, simplify = TRUE, data = NULL)
...
(numeric())
Points to evaluate the function at Arguments do not need
to be named. The length of each argument corresponds to the number of points to evaluate,
the number of arguments corresponds to the number of variables in the distribution.
See examples.
log
(logical(1))
If TRUE
returns the logarithm of the probabilities. Default is FALSE
.
simplify
logical(1)
If TRUE
(default) simplifies the return if possible to a numeric
, otherwise returns a
data.table::data.table.
data
array
Alternative method to specify points to evaluate. If univariate then rows correspond with number
of points to evaluate and columns correspond with number of variables to evaluate. In the special
case of VectorDistributions of multivariate distributions, then the third dimension corresponds
to the distribution in the vector to evaluate.
b <- Binomial$new() b$pdf(1:10) b$pdf(1:10, log = TRUE) b$pdf(data = matrix(1:10)) mvn <- MultivariateNormal$new() mvn$pdf(1, 2) mvn$pdf(1:2, 3:4) mvn$pdf(data = matrix(1:4, nrow = 2), simplify = FALSE)
cdf()
The (lower tail) cumulative distribution function, , is defined as
If lower.tail
is FALSE then is returned, also known as the
survival
function.
If available a cdf will be returned using an analytic expression. Otherwise,
if the distribution has not been decorated with FunctionImputation, NULL
is
returned.
Distribution$cdf( ..., lower.tail = TRUE, log.p = FALSE, simplify = TRUE, data = NULL )
...
(numeric())
Points to evaluate the function at Arguments do not need
to be named. The length of each argument corresponds to the number of points to evaluate,
the number of arguments corresponds to the number of variables in the distribution.
See examples.
lower.tail
(logical(1))
If TRUE
(default), probabilities are X <= x
, otherwise, P(X > x)
.
log.p
(logical(1))
If TRUE
returns the logarithm of the probabilities. Default is FALSE
.
simplify
logical(1)
If TRUE
(default) simplifies the return if possible to a numeric
, otherwise returns a
data.table::data.table.
data
array
Alternative method to specify points to evaluate. If univariate then rows correspond with number
of points to evaluate and columns correspond with number of variables to evaluate. In the special
case of VectorDistributions of multivariate distributions, then the third dimension corresponds
to the distribution in the vector to evaluate.
b <- Binomial$new() b$cdf(1:10) b$cdf(1:10, log.p = TRUE, lower.tail = FALSE) b$cdf(data = matrix(1:10))
quantile()
The quantile function, , is the inverse cdf, i.e.
#nolint
If lower.tail
is FALSE then is returned.
If available a quantile will be returned using an analytic expression. Otherwise,
if the distribution has not been decorated with FunctionImputation, NULL
is
returned.
Distribution$quantile( ..., lower.tail = TRUE, log.p = FALSE, simplify = TRUE, data = NULL )
...
(numeric())
Points to evaluate the function at Arguments do not need
to be named. The length of each argument corresponds to the number of points to evaluate,
the number of arguments corresponds to the number of variables in the distribution.
See examples.
lower.tail
(logical(1))
If TRUE
(default), probabilities are X <= x
, otherwise, P(X > x)
.
log.p
(logical(1))
If TRUE
returns the logarithm of the probabilities. Default is FALSE
.
simplify
logical(1)
If TRUE
(default) simplifies the return if possible to a numeric
, otherwise returns a
data.table::data.table.
data
array
Alternative method to specify points to evaluate. If univariate then rows correspond with number
of points to evaluate and columns correspond with number of variables to evaluate. In the special
case of VectorDistributions of multivariate distributions, then the third dimension corresponds
to the distribution in the vector to evaluate.
b <- Binomial$new() b$quantile(0.42) b$quantile(log(0.42), log.p = TRUE, lower.tail = TRUE) b$quantile(data = matrix(c(0.1,0.2)))
rand()
The rand function draws n
simulations from the distribution.
If available simulations will be returned using an analytic expression. Otherwise,
if the distribution has not been decorated with FunctionImputation, NULL
is
returned.
Distribution$rand(n, simplify = TRUE)
n
(numeric(1))
Number of points to simulate from the distribution. If length greater than , then
n <- length(n)
,
simplify
logical(1)
If TRUE
(default) simplifies the return if possible to a numeric
, otherwise returns a
data.table::data.table.
b <- Binomial$new() b$rand(10) mvn <- MultivariateNormal$new() mvn$rand(5)
prec()
Returns the precision of the distribution as 1/self$variance()
.
Distribution$prec()
stdev()
Returns the standard deviation of the distribution as sqrt(self$variance())
.
Distribution$stdev()
median()
Returns the median of the distribution. If an analytical expression is available
returns distribution median, otherwise if symmetric returns self$mean
, otherwise
returns self$quantile(0.5)
.
Distribution$median(na.rm = NULL, ...)
na.rm
(logical(1))
Ignored, addded for consistency.
...
ANY
Ignored, addded for consistency.
iqr()
Inter-quartile range of the distribution. Estimated as
self$quantile(0.75) - self$quantile(0.25)
.
Distribution$iqr()
confidence()
1 or 2-sided confidence interval around distribution.
Distribution$confidence(alpha = 0.95, sides = "both", median = FALSE)
alpha
(numeric(1))
Level of confidence, default is 95%
sides
(character(1))
One of 'lower', 'upper' or 'both'
median
(logical(1))
If TRUE
also returns median
correlation()
If univariate returns 1
, otherwise returns the distribution correlation.
Distribution$correlation()
liesInSupport()
Tests if the given values lie in the support of the distribution.
Uses [set6::Set]$contains
.
Distribution$liesInSupport(x, all = TRUE, bound = FALSE)
x
ANY
Values to test.
all
logical(1)
If TRUE
(default) returns TRUE
if all x
are in the distribution,
otherwise returns a vector of logicals corresponding to each element in
x
.
bound
logical(1)
If TRUE
then tests if x
lie between the upper and lower bounds of the distribution,
otherwise tests if x
lie between the maximum and minimum of the distribution.
liesInType()
Tests if the given values lie in the type of the distribution.
Uses [set6::Set]$contains
.
Distribution$liesInType(x, all = TRUE, bound = FALSE)
x
ANY
Values to test.
all
logical(1)
If TRUE
(default) returns TRUE
if all x
are in the distribution,
otherwise returns a vector of logicals corresponding to each element in
x
.
bound
logical(1)
If TRUE
then tests if x
lie between the upper and lower bounds of the distribution,
otherwise tests if x
lie between the maximum and minimum of the distribution.
workingSupport()
Returns an estimate for the computational support of the distribution.
If an analytical cdf is available, then this is computed as the smallest interval
in which the cdf lower bound is 0
and the upper bound is 1
, bounds are incremented in
10^i intervals. If no analytical cdf is available, then this is computed as the smallest
interval in which the lower and upper bounds of the pdf are 0
, this is much less precise
and is more prone to error. Used primarily by decorators.
Distribution$workingSupport()
clone()
The objects of this class are cloneable with this method.
Distribution$clone(deep = FALSE)
deep
Whether to make a deep clone.
## ------------------------------------------------ ## Method `Distribution$setParameterValue` ## ------------------------------------------------ b = Binomial$new() b$setParameterValue(size = 4, prob = 0.4) b$setParameterValue(lst = list(size = 4, prob = 0.4)) ## ------------------------------------------------ ## Method `Distribution$pdf` ## ------------------------------------------------ b <- Binomial$new() b$pdf(1:10) b$pdf(1:10, log = TRUE) b$pdf(data = matrix(1:10)) mvn <- MultivariateNormal$new() mvn$pdf(1, 2) mvn$pdf(1:2, 3:4) mvn$pdf(data = matrix(1:4, nrow = 2), simplify = FALSE) ## ------------------------------------------------ ## Method `Distribution$cdf` ## ------------------------------------------------ b <- Binomial$new() b$cdf(1:10) b$cdf(1:10, log.p = TRUE, lower.tail = FALSE) b$cdf(data = matrix(1:10)) ## ------------------------------------------------ ## Method `Distribution$quantile` ## ------------------------------------------------ b <- Binomial$new() b$quantile(0.42) b$quantile(log(0.42), log.p = TRUE, lower.tail = TRUE) b$quantile(data = matrix(c(0.1,0.2))) ## ------------------------------------------------ ## Method `Distribution$rand` ## ------------------------------------------------ b <- Binomial$new() b$rand(10) mvn <- MultivariateNormal$new() mvn$rand(5)
## ------------------------------------------------ ## Method `Distribution$setParameterValue` ## ------------------------------------------------ b = Binomial$new() b$setParameterValue(size = 4, prob = 0.4) b$setParameterValue(lst = list(size = 4, prob = 0.4)) ## ------------------------------------------------ ## Method `Distribution$pdf` ## ------------------------------------------------ b <- Binomial$new() b$pdf(1:10) b$pdf(1:10, log = TRUE) b$pdf(data = matrix(1:10)) mvn <- MultivariateNormal$new() mvn$pdf(1, 2) mvn$pdf(1:2, 3:4) mvn$pdf(data = matrix(1:4, nrow = 2), simplify = FALSE) ## ------------------------------------------------ ## Method `Distribution$cdf` ## ------------------------------------------------ b <- Binomial$new() b$cdf(1:10) b$cdf(1:10, log.p = TRUE, lower.tail = FALSE) b$cdf(data = matrix(1:10)) ## ------------------------------------------------ ## Method `Distribution$quantile` ## ------------------------------------------------ b <- Binomial$new() b$quantile(0.42) b$quantile(log(0.42), log.p = TRUE, lower.tail = TRUE) b$quantile(data = matrix(c(0.1,0.2))) ## ------------------------------------------------ ## Method `Distribution$rand` ## ------------------------------------------------ b <- Binomial$new() b$rand(10) mvn <- MultivariateNormal$new() mvn$rand(5)
Abstract class that cannot be constructed directly.
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.
Use decorate or $decorate
to decorate distributions.
Returns error. Abstract classes cannot be constructed directly.
An R6 object.
packages
Packages required to be installed in order to construct the distribution.
methods
Returns the names of the available methods in this decorator.
new()
Creates a new instance of this R6 class.
DistributionDecorator$new()
decorate()
Decorates the given distribution with the methods available in this decorator.
DistributionDecorator$decorate(distribution, ...)
distribution
Distribution
Distribution to decorate.
...
ANY
Extra arguments passed down to specific decorators.
clone()
The objects of this class are cloneable with this method.
DistributionDecorator$clone(deep = FALSE)
deep
Whether to make a deep clone.
Gamma, Erich, Richard Helm, Ralph Johnson, and John Vlissides. 1994. “Design Patterns: Elements of Reusable Object-Oriented Software.” Addison-Wesley.
Abstract class that cannot be constructed directly.
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.
Returns error. Abstract classes cannot be constructed directly.
distr6::Distribution
-> DistributionWrapper
distr6::Distribution$cdf()
distr6::Distribution$confidence()
distr6::Distribution$correlation()
distr6::Distribution$getParameterValue()
distr6::Distribution$iqr()
distr6::Distribution$liesInSupport()
distr6::Distribution$liesInType()
distr6::Distribution$median()
distr6::Distribution$parameters()
distr6::Distribution$pdf()
distr6::Distribution$prec()
distr6::Distribution$print()
distr6::Distribution$quantile()
distr6::Distribution$rand()
distr6::Distribution$setParameterValue()
distr6::Distribution$stdev()
distr6::Distribution$strprint()
distr6::Distribution$summary()
distr6::Distribution$workingSupport()
new()
Creates a new instance of this R6 class.
DistributionWrapper$new( distlist = NULL, name, short_name, description, support, type, valueSupport, variateForm, parameters = NULL, outerID = NULL )
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
([param6::ParameterSet])
Optional parameters to add to the internal collection, ignored if distlist
is given.
outerID
([param6::ParameterSet])
Parameters added by the wrapper.
wrappedModels()
Returns model(s) wrapped by this wrapper.
DistributionWrapper$wrappedModels(model = NULL)
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.
clone()
The objects of this class are cloneable with this method.
DistributionWrapper$clone(deep = FALSE)
deep
Whether to make a deep clone.
Gamma, Erich, Richard Helm, Ralph Johnson, and John Vlissides. 1994. “Design Patterns: Elements of Reusable Object-Oriented Software.” Addison-Wesley.
Other wrappers:
Convolution
,
HuberizedDistribution
,
MixtureDistribution
,
ProductDistribution
,
TruncatedDistribution
,
VectorDistribution
Helper function to quickly simulate from a distribution with given parameters.
distrSimulate( n = 100, distribution = "Normal", pars = list(), simplify = TRUE, seed, ... )
distrSimulate( n = 100, distribution = "Normal", pars = list(), simplify = TRUE, seed, ... )
n |
number of points to simulate. |
distribution |
distribution to simulate from, corresponds to |
pars |
parameters to pass to |
simplify |
if |
seed |
passed to set.seed |
... |
additional optional arguments for set.seed |
If simplify
then vector of n
simulations, otherwise list of simulations and
distribution.
Parse a custom string that represents an R6 distribution
dparse(toparse)
dparse(toparse)
toparse |
|
Transform a custom (user) input to a R6 object.
This function is specially useful when you expect a user input which should
result in specific distribution. The distribution name must be the
ShortName, ClassName or Alias listed in the package, which can be found with
listDistributions()
.
Returns an R6 Distribution
dparse("N()") dparse("norm(0, sd = 2)") # lower and upper case work dparse("n(sd = 1, mean = 4)") dparse("T(df = 4)") dparse("cHiSq(df = 3)") # be careful to escape strings properly dparse("C(list('A', 'B'), c(0.5, 0.5))") dparse("Cat(elements = c('A', 'B'), probs = c(0.5, 0.5))")
dparse("N()") dparse("norm(0, sd = 2)") # lower and upper case work dparse("n(sd = 1, mean = 4)") dparse("T(df = 4)") dparse("cHiSq(df = 3)") # be careful to escape strings properly dparse("C(list('A', 'B'), c(0.5, 0.5))") dparse("Cat(elements = c('A', 'B'), probs = c(0.5, 0.5))")
Helper functions for constructing an SDistribution (with dstr
)
or VectorDistribution (with dstrs
).
dstr(d, ..., pars = list(...), decorators = NULL) dstrs(d, pars = NULL, ...)
dstr(d, ..., pars = list(...), decorators = NULL) dstrs(d, pars = NULL, ...)
d |
( |
... |
( |
pars |
( |
decorators |
( |
# Construct standard Normal and distribution dstr("Norm") # ShortName dstr("Normal") # ClassName # Construct Binomial(5, 0.1) dstr("Binomial", size = 5, prob = 0.1) # Construct decorated Gamma(2, 1) dstr("Gamma", shape = 2, rate = 1, decorators = "ExoticStatistics") # Or with a list dstr("Gamma", pars = list(shape = 2, rate = 4)) # Construct vector with dstrs # Binomial and Gamma with default parameters dstrs(c("Binom", "Gamma")) # Binomial with set parameters and Gamma with # default parameters dstrs(c("Binom", "Gamma"), list(list(size = 4), NULL)) # Binomial and Gamma with set parameters dstrs(c("Binom", "Gamma"), list(list(size = 4), list(rate = 2, shape = 3))) # Multiple Binomials dstrs("Binom", data.frame(size = 1:5, prob = 0.5))
# Construct standard Normal and distribution dstr("Norm") # ShortName dstr("Normal") # ClassName # Construct Binomial(5, 0.1) dstr("Binomial", size = 5, prob = 0.1) # Construct decorated Gamma(2, 1) dstr("Gamma", shape = 2, rate = 1, decorators = "ExoticStatistics") # Or with a list dstr("Gamma", pars = list(shape = 2, rate = 4)) # Construct vector with dstrs # Binomial and Gamma with default parameters dstrs(c("Binom", "Gamma")) # Binomial with set parameters and Gamma with # default parameters dstrs(c("Binom", "Gamma"), list(list(size = 4), NULL)) # Binomial and Gamma with set parameters dstrs(c("Binom", "Gamma"), list(list(size = 4), list(rate = 2, shape = 3))) # Multiple Binomials dstrs("Binom", data.frame(size = 1:5, prob = 0.5))
Mathematical and statistical functions for the Empirical distribution, which is commonly used in sampling such as MCMC.
The Empirical distribution is defined by the pmf,
for .
Sampling from this distribution is performed with the sample function with the elements given as the support set and uniform probabilities. Sampling is performed with replacement, which is consistent with other distributions but non-standard for Empirical distributions. Use simulateEmpiricalDistribution to sample without replacement.
The cdf and quantile assumes that the elements are supplied in an indexed order (otherwise the results are meaningless).
Returns an R6 object inheriting from class SDistribution.
The distribution is supported on .
Emp(samples = 1)
N/A
N/A
distr6::Distribution
-> distr6::SDistribution
-> Empirical
name
Full name of distribution.
short_name
Short name of distribution for printing.
description
Brief description of the distribution.
alias
Alias of the distribution.
distr6::Distribution$cdf()
distr6::Distribution$confidence()
distr6::Distribution$correlation()
distr6::Distribution$getParameterValue()
distr6::Distribution$iqr()
distr6::Distribution$liesInSupport()
distr6::Distribution$liesInType()
distr6::Distribution$median()
distr6::Distribution$parameters()
distr6::Distribution$pdf()
distr6::Distribution$prec()
distr6::Distribution$print()
distr6::Distribution$quantile()
distr6::Distribution$rand()
distr6::Distribution$stdev()
distr6::Distribution$strprint()
distr6::Distribution$summary()
distr6::Distribution$workingSupport()
new()
Creates a new instance of this R6 class.
Empirical$new(samples = NULL, decorators = NULL)
samples
(numeric())
Vector of observed samples, see examples.
decorators
(character())
Decorators to add to the distribution during construction.
Empirical$new(runif(1000))
mean()
The arithmetic mean of a (discrete) probability distribution X is the expectation
with an integration analogue for continuous distributions.
Empirical$mean(...)
...
Unused.
mode()
The mode of a probability distribution is the point at which the pdf is a local maximum, a distribution can be unimodal (one maximum) or multimodal (several maxima).
Empirical$mode(which = "all")
which
(character(1) | numeric(1)
Ignored if distribution is unimodal. Otherwise "all"
returns all modes, otherwise specifies
which mode to return.
variance()
The variance of a distribution is defined by the formula
where is the expectation of distribution X. If the distribution is multivariate the
covariance matrix is returned.
Empirical$variance(...)
...
Unused.
skewness()
The skewness of a distribution is defined by the third standardised moment,
where is the expectation of distribution X,
is the mean of the
distribution and
is the standard deviation of the distribution.
Empirical$skewness(...)
...
Unused.
kurtosis()
The kurtosis of a distribution is defined by the fourth standardised moment,
where is the expectation of distribution X,
is the mean of the
distribution and
is the standard deviation of the distribution.
Excess Kurtosis is Kurtosis - 3.
Empirical$kurtosis(excess = TRUE, ...)
excess
(logical(1))
If TRUE
(default) excess kurtosis returned.
...
Unused.
entropy()
The entropy of a (discrete) distribution is defined by
where is the pdf of distribution X, with an integration analogue for
continuous distributions.
Empirical$entropy(base = 2, ...)
base
(integer(1))
Base of the entropy logarithm, default = 2 (Shannon entropy)
...
Unused.
mgf()
The moment generating function is defined by
where X is the distribution and is the expectation of the distribution X.
Empirical$mgf(t, ...)
t
(integer(1))
t integer to evaluate function at.
...
Unused.
cf()
The characteristic function is defined by
where X is the distribution and is the expectation of the distribution X.
Empirical$cf(t, ...)
t
(integer(1))
t integer to evaluate function at.
...
Unused.
pgf()
The probability generating function is defined by
where X is the distribution and is the expectation of the distribution X.
Empirical$pgf(z, ...)
z
(integer(1))
z integer to evaluate probability generating function at.
...
Unused.
setParameterValue()
Sets the value(s) of the given parameter(s).
Empirical$setParameterValue( ..., lst = NULL, error = "warn", resolveConflicts = FALSE )
...
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.
clone()
The objects of this class are cloneable with this method.
Empirical$clone(deep = FALSE)
deep
Whether to make a deep clone.
McLaughlin, M. P. (2001). A compendium of common probability distributions (pp. 2014-01). Michael P. McLaughlin.
Other discrete distributions:
Arrdist
,
Bernoulli
,
Binomial
,
Categorical
,
Degenerate
,
DiscreteUniform
,
EmpiricalMV
,
Geometric
,
Hypergeometric
,
Logarithmic
,
Matdist
,
Multinomial
,
NegativeBinomial
,
WeightedDiscrete
Other univariate distributions:
Arcsine
,
Arrdist
,
Bernoulli
,
BetaNoncentral
,
Beta
,
Binomial
,
Categorical
,
Cauchy
,
ChiSquaredNoncentral
,
ChiSquared
,
Degenerate
,
DiscreteUniform
,
Erlang
,
Exponential
,
FDistributionNoncentral
,
FDistribution
,
Frechet
,
Gamma
,
Geometric
,
Gompertz
,
Gumbel
,
Hypergeometric
,
InverseGamma
,
Laplace
,
Logarithmic
,
Logistic
,
Loglogistic
,
Lognormal
,
Matdist
,
NegativeBinomial
,
Normal
,
Pareto
,
Poisson
,
Rayleigh
,
ShiftedLoglogistic
,
StudentTNoncentral
,
StudentT
,
Triangular
,
Uniform
,
Wald
,
Weibull
,
WeightedDiscrete
## ------------------------------------------------ ## Method `Empirical$new` ## ------------------------------------------------ Empirical$new(runif(1000))
## ------------------------------------------------ ## Method `Empirical$new` ## ------------------------------------------------ Empirical$new(runif(1000))
Mathematical and statistical functions for the EmpiricalMV distribution, which is commonly used in sampling such as MCMC.
The EmpiricalMV distribution is defined by the pmf,
for .
Sampling from this distribution is performed with the sample function with the elements given as the support set and uniform probabilities. Sampling is performed with replacement, which is consistent with other distributions but non-standard for Empirical distributions. Use simulateEmpiricalDistribution to sample without replacement.
The cdf assumes that the elements are supplied in an indexed order (otherwise the results are meaningless).
Returns an R6 object inheriting from class SDistribution.
The distribution is supported on .
EmpMV(data = data.frame(1, 1))
N/A
N/A
distr6::Distribution
-> distr6::SDistribution
-> EmpiricalMV
name
Full name of distribution.
short_name
Short name of distribution for printing.
description
Brief description of the distribution.
alias
Alias of the distribution.
distr6::Distribution$cdf()
distr6::Distribution$confidence()
distr6::Distribution$correlation()
distr6::Distribution$getParameterValue()
distr6::Distribution$iqr()
distr6::Distribution$liesInSupport()
distr6::Distribution$liesInType()
distr6::Distribution$median()
distr6::Distribution$parameters()
distr6::Distribution$pdf()
distr6::Distribution$prec()
distr6::Distribution$print()
distr6::Distribution$quantile()
distr6::Distribution$rand()
distr6::Distribution$stdev()
distr6::Distribution$strprint()
distr6::Distribution$summary()
distr6::Distribution$workingSupport()
new()
Creates a new instance of this R6 class.
EmpiricalMV$new(data = NULL, decorators = NULL)
data
[matrix]
Matrix-like object where each column is a vector of observed samples corresponding
to each variable.
decorators
(character())
Decorators to add to the distribution during construction.
EmpiricalMV$new(MultivariateNormal$new()$rand(100))
mean()
The arithmetic mean of a (discrete) probability distribution X is the expectation
with an integration analogue for continuous distributions.
EmpiricalMV$mean(...)
...
Unused.
variance()
The variance of a distribution is defined by the formula
where is the expectation of distribution X. If the distribution is multivariate the
covariance matrix is returned.
EmpiricalMV$variance(...)
...
Unused.
setParameterValue()
Sets the value(s) of the given parameter(s).
EmpiricalMV$setParameterValue( ..., lst = NULL, error = "warn", resolveConflicts = FALSE )
...
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.
clone()
The objects of this class are cloneable with this method.
EmpiricalMV$clone(deep = FALSE)
deep
Whether to make a deep clone.
McLaughlin, M. P. (2001). A compendium of common probability distributions (pp. 2014-01). Michael P. McLaughlin.
Other discrete distributions:
Arrdist
,
Bernoulli
,
Binomial
,
Categorical
,
Degenerate
,
DiscreteUniform
,
Empirical
,
Geometric
,
Hypergeometric
,
Logarithmic
,
Matdist
,
Multinomial
,
NegativeBinomial
,
WeightedDiscrete
Other multivariate distributions:
Dirichlet
,
Multinomial
,
MultivariateNormal
## ------------------------------------------------ ## Method `EmpiricalMV$new` ## ------------------------------------------------ EmpiricalMV$new(MultivariateNormal$new()$rand(100))
## ------------------------------------------------ ## Method `EmpiricalMV$new` ## ------------------------------------------------ EmpiricalMV$new(MultivariateNormal$new()$rand(100))
Mathematical and statistical functions for the Epanechnikov kernel defined by the pdf,
over the support .
The quantile function is omitted as no closed form analytic expressions could be found, decorate with FunctionImputation for numeric results.
distr6::Distribution
-> distr6::Kernel
-> Epanechnikov
name
Full name of distribution.
short_name
Short name of distribution for printing.
description
Brief description of the distribution.
distr6::Distribution$cdf()
distr6::Distribution$confidence()
distr6::Distribution$correlation()
distr6::Distribution$getParameterValue()
distr6::Distribution$iqr()
distr6::Distribution$liesInSupport()
distr6::Distribution$liesInType()
distr6::Distribution$parameters()
distr6::Distribution$pdf()
distr6::Distribution$prec()
distr6::Distribution$print()
distr6::Distribution$quantile()
distr6::Distribution$rand()
distr6::Distribution$setParameterValue()
distr6::Distribution$stdev()
distr6::Distribution$strprint()
distr6::Distribution$summary()
distr6::Distribution$workingSupport()
distr6::Kernel$initialize()
distr6::Kernel$mean()
distr6::Kernel$median()
distr6::Kernel$mode()
distr6::Kernel$skewness()
pdfSquared2Norm()
The squared 2-norm of the pdf is defined by
where X is the Distribution, is its pdf and
are the distribution support limits.
Epanechnikov$pdfSquared2Norm(x = 0, upper = Inf)
x
(numeric(1))
Amount to shift the result.
upper
(numeric(1))
Upper limit of the integral.
cdfSquared2Norm()
The squared 2-norm of the cdf is defined by
where X is the Distribution, is its pdf and
are the distribution support limits.
Epanechnikov$cdfSquared2Norm(x = 0, upper = 0)
x
(numeric(1))
Amount to shift the result.
upper
(numeric(1))
Upper limit of the integral.
variance()
The variance of a distribution is defined by the formula
where is the expectation of distribution X. If the distribution is multivariate the
covariance matrix is returned.
Epanechnikov$variance(...)
...
Unused.
clone()
The objects of this class are cloneable with this method.
Epanechnikov$clone(deep = FALSE)
deep
Whether to make a deep clone.
Other kernels:
Cosine
,
LogisticKernel
,
NormalKernel
,
Quartic
,
Sigmoid
,
Silverman
,
TriangularKernel
,
Tricube
,
Triweight
,
UniformKernel
Mathematical and statistical functions for the Erlang distribution, which is commonly used as a special case of the Gamma distribution when the shape parameter is an integer.
The Erlang distribution parameterised with shape, , and rate,
, is defined by the pdf,
for and
.
Returns an R6 object inheriting from class SDistribution.
The distribution is supported on the Positive Reals.
Erlang(shape = 1, rate = 1)
N/A
N/A
distr6::Distribution
-> distr6::SDistribution
-> Erlang
name
Full name of distribution.
short_name
Short name of distribution for printing.
description
Brief description of the distribution.
alias
Alias of the distribution.
packages
Packages required to be installed in order to construct the distribution.
distr6::Distribution$cdf()
distr6::Distribution$confidence()
distr6::Distribution$correlation()
distr6::Distribution$getParameterValue()
distr6::Distribution$iqr()
distr6::Distribution$liesInSupport()
distr6::Distribution$liesInType()
distr6::Distribution$median()
distr6::Distribution$parameters()
distr6::Distribution$pdf()
distr6::Distribution$prec()
distr6::Distribution$print()
distr6::Distribution$quantile()
distr6::Distribution$rand()
distr6::Distribution$setParameterValue()
distr6::Distribution$stdev()
distr6::Distribution$strprint()
distr6::Distribution$summary()
distr6::Distribution$workingSupport()
new()
Creates a new instance of this R6 class.
Erlang$new(shape = NULL, rate = NULL, scale = NULL, decorators = NULL)
shape
(integer(1))
Shape parameter, defined on the positive Naturals.
rate
(numeric(1))
Rate parameter of the distribution, defined on the positive Reals.
scale
numeric(1))
Scale parameter of the distribution, defined on the positive Reals. scale = 1/rate
.
If provided rate
is ignored.
decorators
(character())
Decorators to add to the distribution during construction.
mean()
The arithmetic mean of a (discrete) probability distribution X is the expectation
with an integration analogue for continuous distributions.
Erlang$mean(...)
...
Unused.
mode()
The mode of a probability distribution is the point at which the pdf is a local maximum, a distribution can be unimodal (one maximum) or multimodal (several maxima).
Erlang$mode(which = "all")
which
(character(1) | numeric(1)
Ignored if distribution is unimodal. Otherwise "all"
returns all modes, otherwise specifies
which mode to return.
variance()
The variance of a distribution is defined by the formula
where is the expectation of distribution X. If the distribution is multivariate the
covariance matrix is returned.
Erlang$variance(...)
...
Unused.
skewness()
The skewness of a distribution is defined by the third standardised moment,
where is the expectation of distribution X,
is the mean of the
distribution and
is the standard deviation of the distribution.
Erlang$skewness(...)
...
Unused.
kurtosis()
The kurtosis of a distribution is defined by the fourth standardised moment,
where is the expectation of distribution X,
is the mean of the
distribution and
is the standard deviation of the distribution.
Excess Kurtosis is Kurtosis - 3.
Erlang$kurtosis(excess = TRUE, ...)
excess
(logical(1))
If TRUE
(default) excess kurtosis returned.
...
Unused.
entropy()
The entropy of a (discrete) distribution is defined by
where is the pdf of distribution X, with an integration analogue for
continuous distributions.
Erlang$entropy(base = 2, ...)
base
(integer(1))
Base of the entropy logarithm, default = 2 (Shannon entropy)
...
Unused.
mgf()
The moment generating function is defined by
where X is the distribution and is the expectation of the distribution X.
Erlang$mgf(t, ...)
t
(integer(1))
t integer to evaluate function at.
...
Unused.
cf()
The characteristic function is defined by
where X is the distribution and is the expectation of the distribution X.
Erlang$cf(t, ...)
t
(integer(1))
t integer to evaluate function at.
...
Unused.
pgf()
The probability generating function is defined by
where X is the distribution and is the expectation of the distribution X.
Erlang$pgf(z, ...)
z
(integer(1))
z integer to evaluate probability generating function at.
...
Unused.
clone()
The objects of this class are cloneable with this method.
Erlang$clone(deep = FALSE)
deep
Whether to make a deep clone.
McLaughlin, M. P. (2001). A compendium of common probability distributions (pp. 2014-01). Michael P. McLaughlin.
Other continuous distributions:
Arcsine
,
BetaNoncentral
,
Beta
,
Cauchy
,
ChiSquaredNoncentral
,
ChiSquared
,
Dirichlet
,
Exponential
,
FDistributionNoncentral
,
FDistribution
,
Frechet
,
Gamma
,
Gompertz
,
Gumbel
,
InverseGamma
,
Laplace
,
Logistic
,
Loglogistic
,
Lognormal
,
MultivariateNormal
,
Normal
,
Pareto
,
Poisson
,
Rayleigh
,
ShiftedLoglogistic
,
StudentTNoncentral
,
StudentT
,
Triangular
,
Uniform
,
Wald
,
Weibull
Other univariate distributions:
Arcsine
,
Arrdist
,
Bernoulli
,
BetaNoncentral
,
Beta
,
Binomial
,
Categorical
,
Cauchy
,
ChiSquaredNoncentral
,
ChiSquared
,
Degenerate
,
DiscreteUniform
,
Empirical
,
Exponential
,
FDistributionNoncentral
,
FDistribution
,
Frechet
,
Gamma
,
Geometric
,
Gompertz
,
Gumbel
,
Hypergeometric
,
InverseGamma
,
Laplace
,
Logarithmic
,
Logistic
,
Loglogistic
,
Lognormal
,
Matdist
,
NegativeBinomial
,
Normal
,
Pareto
,
Poisson
,
Rayleigh
,
ShiftedLoglogistic
,
StudentTNoncentral
,
StudentT
,
Triangular
,
Uniform
,
Wald
,
Weibull
,
WeightedDiscrete
Gets the type of (excess) kurtosis
exkurtosisType(kurtosis)
exkurtosisType(kurtosis)
kurtosis |
numeric. |
Kurtosis is a measure of the tailedness of a distribution. Distributions can be compared to the Normal distribution by whether their kurtosis is higher, lower or the same as that of the Normal distribution.
A distribution with a negative excess kurtosis is called 'platykurtic', a distribution with a positive excess kurtosis is called 'leptokurtic' and a distribution with an excess kurtosis equal to zero is called 'mesokurtic'.
Returns one of 'platykurtic', 'mesokurtic' or 'leptokurtic'.
exkurtosisType(-1) exkurtosisType(0) exkurtosisType(1)
exkurtosisType(-1) exkurtosisType(0) exkurtosisType(1)
This decorator adds methods for more complex statistical methods including p-norms, survival and hazard functions and anti-derivatives. If possible analytical expressions are exploited, otherwise numerical ones are used with a message.
Numerical approximations will not work for multivariate distributions.
Decorator objects add functionality to the given Distribution object by copying methods in the decorator environment to the chosen Distribution environment.
All methods implemented in decorators try to exploit analytical results where possible, otherwise numerical results are used with a message.
distr6::DistributionDecorator
-> ExoticStatistics
cdfAntiDeriv()
The cdf anti-derivative is defined by
where X is the distribution, is the cdf of the distribution
and
are the
lower
and upper
limits of integration.
ExoticStatistics$cdfAntiDeriv(lower = NULL, upper = NULL)
lower
(numeric(1)
Lower bounds of integral.
upper
(numeric(1)
Upper bounds of integral.
survivalAntiDeriv()
The survival anti-derivative is defined by
where X is the distribution, is the survival function of the distribution
and
are the
lower
and upper
limits of integration.
ExoticStatistics$survivalAntiDeriv(lower = NULL, upper = NULL)
lower
(numeric(1)
Lower bounds of integral.
upper
(numeric(1)
Upper bounds of integral.
survival()
The survival function is defined by
where X is the distribution, is the survival function,
is the cdf
and
is the pdf.
ExoticStatistics$survival(..., log = FALSE, simplify = TRUE, data = NULL)
...
(numeric())
Points to evaluate the function at Arguments do not need
to be named. The length of each argument corresponds to the number of points to evaluate,
the number of arguments corresponds to the number of variables in the distribution.
See examples.
log
(logical(1))
If TRUE
returns the logarithm of the probabilities. Default is FALSE
.
simplify
logical(1)
If TRUE
(default) simplifies the return if possible to a numeric
, otherwise returns a
data.table::data.table.
data
array
Alternative method to specify points to evaluate. If univariate then rows correspond with number
of points to evaluate and columns correspond with number of variables to evaluate. In the special
case of VectorDistributions of multivariate distributions, then the third dimension corresponds
to the distribution in the vector to evaluate.
hazard()
The hazard function is defined by
where X is the distribution, is the survival function and
is the pdf.
ExoticStatistics$hazard(..., log = FALSE, simplify = TRUE, data = NULL)
...
(numeric())
Points to evaluate the function at Arguments do not need
to be named. The length of each argument corresponds to the number of points to evaluate,
the number of arguments corresponds to the number of variables in the distribution.
See examples.
log
(logical(1))
If TRUE
returns the logarithm of the probabilities. Default is FALSE
.
simplify
logical(1)
If TRUE
(default) simplifies the return if possible to a numeric
, otherwise returns a
data.table::data.table.
data
array
Alternative method to specify points to evaluate. If univariate then rows correspond with number
of points to evaluate and columns correspond with number of variables to evaluate. In the special
case of VectorDistributions of multivariate distributions, then the third dimension corresponds
to the distribution in the vector to evaluate.
cumHazard()
The cumulative hazard function is defined analytically by
where X is the distribution and is the survival function.
ExoticStatistics$cumHazard(..., log = FALSE, simplify = TRUE, data = NULL)
...
(numeric())
Points to evaluate the function at Arguments do not need
to be named. The length of each argument corresponds to the number of points to evaluate,
the number of arguments corresponds to the number of variables in the distribution.
See examples.
log
(logical(1))
If TRUE
returns the logarithm of the probabilities. Default is FALSE
.
simplify
logical(1)
If TRUE
(default) simplifies the return if possible to a numeric
, otherwise returns a
data.table::data.table.
data
array
Alternative method to specify points to evaluate. If univariate then rows correspond with number
of points to evaluate and columns correspond with number of variables to evaluate. In the special
case of VectorDistributions of multivariate distributions, then the third dimension corresponds
to the distribution in the vector to evaluate.
cdfPNorm()
The p-norm of the cdf is defined by
where X is the distribution, is the cdf and
are the
lower
and upper
limits of integration.
Returns NULL if distribution is not continuous.
ExoticStatistics$cdfPNorm(p = 2, lower = NULL, upper = NULL)
p
(integer(1))
Norm to evaluate.
lower
(numeric(1)
Lower bounds of integral.
upper
(numeric(1)
Upper bounds of integral.
pdfPNorm()
The p-norm of the pdf is defined by
where X is the distribution, is the pdf and
are the
lower
and upper
limits of integration.
Returns NULL if distribution is not continuous.
ExoticStatistics$pdfPNorm(p = 2, lower = NULL, upper = NULL)
p
(integer(1))
Norm to evaluate.
lower
(numeric(1)
Lower bounds of integral.
upper
(numeric(1)
Upper bounds of integral.
survivalPNorm()
The p-norm of the survival function is defined by
where X is the distribution, is the survival function and
are the
lower
and upper
limits of integration.
Returns NULL if distribution is not continuous.
ExoticStatistics$survivalPNorm(p = 2, lower = NULL, upper = NULL)
p
(integer(1))
Norm to evaluate.
lower
(numeric(1)
Lower bounds of integral.
upper
(numeric(1)
Upper bounds of integral.
clone()
The objects of this class are cloneable with this method.
ExoticStatistics$clone(deep = FALSE)
deep
Whether to make a deep clone.
Other decorators:
CoreStatistics
,
FunctionImputation
decorate(Exponential$new(), "ExoticStatistics") Exponential$new(decorators = "ExoticStatistics") ExoticStatistics$new()$decorate(Exponential$new())
decorate(Exponential$new(), "ExoticStatistics") Exponential$new(decorators = "ExoticStatistics") ExoticStatistics$new()$decorate(Exponential$new())
Mathematical and statistical functions for the Exponential distribution, which is commonly used to model inter-arrival times in a Poisson process and has the memoryless property.
The Exponential distribution parameterised with rate, , is defined by the pdf,
for .
Returns an R6 object inheriting from class SDistribution.
The distribution is supported on the Positive Reals.
Exp(rate = 1)
N/A
N/A
distr6::Distribution
-> distr6::SDistribution
-> Exponential
name
Full name of distribution.
short_name
Short name of distribution for printing.
description
Brief description of the distribution.
alias
Alias of the distribution.
packages
Packages required to be installed in order to construct the distribution.
distr6::Distribution$cdf()
distr6::Distribution$confidence()
distr6::Distribution$correlation()
distr6::Distribution$getParameterValue()
distr6::Distribution$iqr()
distr6::Distribution$liesInSupport()
distr6::Distribution$liesInType()
distr6::Distribution$parameters()
distr6::Distribution$pdf()
distr6::Distribution$prec()
distr6::Distribution$print()
distr6::Distribution$quantile()
distr6::Distribution$rand()
distr6::Distribution$setParameterValue()
distr6::Distribution$stdev()
distr6::Distribution$strprint()
distr6::Distribution$summary()
distr6::Distribution$workingSupport()
new()
Creates a new instance of this R6 class.
Exponential$new(rate = NULL, scale = NULL, decorators = NULL)
rate
(numeric(1))
Rate parameter of the distribution, defined on the positive Reals.
scale
numeric(1))
Scale parameter of the distribution, defined on the positive Reals. scale = 1/rate
.
If provided rate
is ignored.
decorators
(character())
Decorators to add to the distribution during construction.
mean()
The arithmetic mean of a (discrete) probability distribution X is the expectation
with an integration analogue for continuous distributions.
Exponential$mean(...)
...
Unused.
mode()
The mode of a probability distribution is the point at which the pdf is a local maximum, a distribution can be unimodal (one maximum) or multimodal (several maxima).
Exponential$mode(which = "all")
which
(character(1) | numeric(1)
Ignored if distribution is unimodal. Otherwise "all"
returns all modes, otherwise specifies
which mode to return.
median()
Returns the median of the distribution. If an analytical expression is available
returns distribution median, otherwise if symmetric returns self$mean
, otherwise
returns self$quantile(0.5)
.
Exponential$median()
variance()
The variance of a distribution is defined by the formula
where is the expectation of distribution X. If the distribution is multivariate the
covariance matrix is returned.
Exponential$variance(...)
...
Unused.
skewness()
The skewness of a distribution is defined by the third standardised moment,
where is the expectation of distribution X,
is the mean of the
distribution and
is the standard deviation of the distribution.
Exponential$skewness(...)
...
Unused.
kurtosis()
The kurtosis of a distribution is defined by the fourth standardised moment,
where is the expectation of distribution X,
is the mean of the
distribution and
is the standard deviation of the distribution.
Excess Kurtosis is Kurtosis - 3.
Exponential$kurtosis(excess = TRUE, ...)
excess
(logical(1))
If TRUE
(default) excess kurtosis returned.
...
Unused.
entropy()
The entropy of a (discrete) distribution is defined by
where is the pdf of distribution X, with an integration analogue for
continuous distributions.
Exponential$entropy(base = 2, ...)
base
(integer(1))
Base of the entropy logarithm, default = 2 (Shannon entropy)
...
Unused.
mgf()
The moment generating function is defined by
where X is the distribution and is the expectation of the distribution X.
Exponential$mgf(t, ...)
t
(integer(1))
t integer to evaluate function at.
...
Unused.
cf()
The characteristic function is defined by
where X is the distribution and is the expectation of the distribution X.
Exponential$cf(t, ...)
t
(integer(1))
t integer to evaluate function at.
...
Unused.
pgf()
The probability generating function is defined by
where X is the distribution and is the expectation of the distribution X.
Exponential$pgf(z, ...)
z
(integer(1))
z integer to evaluate probability generating function at.
...
Unused.
clone()
The objects of this class are cloneable with this method.
Exponential$clone(deep = FALSE)
deep
Whether to make a deep clone.
McLaughlin, M. P. (2001). A compendium of common probability distributions (pp. 2014-01). Michael P. McLaughlin.
Other continuous distributions:
Arcsine
,
BetaNoncentral
,
Beta
,
Cauchy
,
ChiSquaredNoncentral
,
ChiSquared
,
Dirichlet
,
Erlang
,
FDistributionNoncentral
,
FDistribution
,
Frechet
,
Gamma
,
Gompertz
,
Gumbel
,
InverseGamma
,
Laplace
,
Logistic
,
Loglogistic
,
Lognormal
,
MultivariateNormal
,
Normal
,
Pareto
,
Poisson
,
Rayleigh
,
ShiftedLoglogistic
,
StudentTNoncentral
,
StudentT
,
Triangular
,
Uniform
,
Wald
,
Weibull
Other univariate distributions:
Arcsine
,
Arrdist
,
Bernoulli
,
BetaNoncentral
,
Beta
,
Binomial
,
Categorical
,
Cauchy
,
ChiSquaredNoncentral
,
ChiSquared
,
Degenerate
,
DiscreteUniform
,
Empirical
,
Erlang
,
FDistributionNoncentral
,
FDistribution
,
Frechet
,
Gamma
,
Geometric
,
Gompertz
,
Gumbel
,
Hypergeometric
,
InverseGamma
,
Laplace
,
Logarithmic
,
Logistic
,
Loglogistic
,
Lognormal
,
Matdist
,
NegativeBinomial
,
Normal
,
Pareto
,
Poisson
,
Rayleigh
,
ShiftedLoglogistic
,
StudentTNoncentral
,
StudentT
,
Triangular
,
Uniform
,
Wald
,
Weibull
,
WeightedDiscrete
Mathematical and statistical functions for the 'F' distribution, which is commonly used in ANOVA testing and is the ratio of scaled Chi-Squared distributions..
The 'F' distribution parameterised with two degrees of freedom parameters, , is defined by the pdf,
for .
Returns an R6 object inheriting from class SDistribution.
The distribution is supported on the Positive Reals.
F(df1 = 1, df2 = 1)
N/A
N/A
distr6::Distribution
-> distr6::SDistribution
-> FDistribution
name
Full name of distribution.
short_name
Short name of distribution for printing.
description
Brief description of the distribution.
alias
Alias of the distribution.
packages
Packages required to be installed in order to construct the distribution.
properties
Returns distribution properties, including skewness type and symmetry.
distr6::Distribution$cdf()
distr6::Distribution$confidence()
distr6::Distribution$correlation()
distr6::Distribution$getParameterValue()
distr6::Distribution$iqr()
distr6::Distribution$liesInSupport()
distr6::Distribution$liesInType()
distr6::Distribution$median()
distr6::Distribution$parameters()
distr6::Distribution$pdf()
distr6::Distribution$prec()
distr6::Distribution$print()
distr6::Distribution$quantile()
distr6::Distribution$rand()
distr6::Distribution$setParameterValue()
distr6::Distribution$stdev()
distr6::Distribution$strprint()
distr6::Distribution$summary()
distr6::Distribution$workingSupport()
new()
Creates a new instance of this R6 class.
FDistribution$new(df1 = NULL, df2 = NULL, decorators = NULL)
df1
(numeric(1))
First degree of freedom of the distribution defined on the positive Reals.
df2
(numeric(1))
Second degree of freedom of the distribution defined on the positive Reals.
decorators
(character())
Decorators to add to the distribution during construction.
mean()
The arithmetic mean of a (discrete) probability distribution X is the expectation
with an integration analogue for continuous distributions.
FDistribution$mean(...)
...
Unused.
mode()
The mode of a probability distribution is the point at which the pdf is a local maximum, a distribution can be unimodal (one maximum) or multimodal (several maxima).
FDistribution$mode(which = "all")
which
(character(1) | numeric(1)
Ignored if distribution is unimodal. Otherwise "all"
returns all modes, otherwise specifies
which mode to return.
variance()
The variance of a distribution is defined by the formula
where is the expectation of distribution X. If the distribution is multivariate the
covariance matrix is returned.
FDistribution$variance(...)
...
Unused.
skewness()
The skewness of a distribution is defined by the third standardised moment,
where is the expectation of distribution X,
is the mean of the
distribution and
is the standard deviation of the distribution.
FDistribution$skewness(...)
...
Unused.
kurtosis()
The kurtosis of a distribution is defined by the fourth standardised moment,
where is the expectation of distribution X,
is the mean of the
distribution and
is the standard deviation of the distribution.
Excess Kurtosis is Kurtosis - 3.
FDistribution$kurtosis(excess = TRUE, ...)
excess
(logical(1))
If TRUE
(default) excess kurtosis returned.
...
Unused.
entropy()
The entropy of a (discrete) distribution is defined by
where is the pdf of distribution X, with an integration analogue for
continuous distributions.
FDistribution$entropy(base = 2, ...)
base
(integer(1))
Base of the entropy logarithm, default = 2 (Shannon entropy)
...
Unused.
mgf()
The moment generating function is defined by
where X is the distribution and is the expectation of the distribution X.
FDistribution$mgf(t, ...)
t
(integer(1))
t integer to evaluate function at.
...
Unused.
pgf()
The probability generating function is defined by
where X is the distribution and is the expectation of the distribution X.
FDistribution$pgf(z, ...)
z
(integer(1))
z integer to evaluate probability generating function at.
...
Unused.
clone()
The objects of this class are cloneable with this method.
FDistribution$clone(deep = FALSE)
deep
Whether to make a deep clone.
McLaughlin, M. P. (2001). A compendium of common probability distributions (pp. 2014-01). Michael P. McLaughlin.
Other continuous distributions:
Arcsine
,
BetaNoncentral
,
Beta
,
Cauchy
,
ChiSquaredNoncentral
,
ChiSquared
,
Dirichlet
,
Erlang
,
Exponential
,
FDistributionNoncentral
,
Frechet
,
Gamma
,
Gompertz
,
Gumbel
,
InverseGamma
,
Laplace
,
Logistic
,
Loglogistic
,
Lognormal
,
MultivariateNormal
,
Normal
,
Pareto
,
Poisson
,
Rayleigh
,
ShiftedLoglogistic
,
StudentTNoncentral
,
StudentT
,
Triangular
,
Uniform
,
Wald
,
Weibull
Other univariate distributions:
Arcsine
,
Arrdist
,
Bernoulli
,
BetaNoncentral
,
Beta
,
Binomial
,
Categorical
,
Cauchy
,
ChiSquaredNoncentral
,
ChiSquared
,
Degenerate
,
DiscreteUniform
,
Empirical
,
Erlang
,
Exponential
,
FDistributionNoncentral
,
Frechet
,
Gamma
,
Geometric
,
Gompertz
,
Gumbel
,
Hypergeometric
,
InverseGamma
,
Laplace
,
Logarithmic
,
Logistic
,
Loglogistic
,
Lognormal
,
Matdist
,
NegativeBinomial
,
Normal
,
Pareto
,
Poisson
,
Rayleigh
,
ShiftedLoglogistic
,
StudentTNoncentral
,
StudentT
,
Triangular
,
Uniform
,
Wald
,
Weibull
,
WeightedDiscrete
Mathematical and statistical functions for the Noncentral F distribution, which is commonly used in ANOVA testing and is the ratio of scaled Chi-Squared distributions.
The Noncentral F distribution parameterised with two degrees of freedom parameters, , and location,
, # nolint is defined by the pdf,
for .
Returns an R6 object inheriting from class SDistribution.
The distribution is supported on the Positive Reals.
FNC(df1 = 1, df2 = 1, location = 0)
N/A
N/A
distr6::Distribution
-> distr6::SDistribution
-> FDistributionNoncentral
name
Full name of distribution.
short_name
Short name of distribution for printing.
description
Brief description of the distribution.
alias
Alias of the distribution.
packages
Packages required to be installed in order to construct the distribution.
properties
Returns distribution properties, including skewness type and symmetry.
distr6::Distribution$cdf()
distr6::Distribution$confidence()
distr6::Distribution$correlation()
distr6::Distribution$getParameterValue()
distr6::Distribution$iqr()
distr6::Distribution$liesInSupport()
distr6::Distribution$liesInType()
distr6::Distribution$median()
distr6::Distribution$parameters()
distr6::Distribution$pdf()
distr6::Distribution$prec()
distr6::Distribution$print()
distr6::Distribution$quantile()
distr6::Distribution$rand()
distr6::Distribution$setParameterValue()
distr6::Distribution$stdev()
distr6::Distribution$strprint()
distr6::Distribution$summary()
distr6::Distribution$workingSupport()
new()
Creates a new instance of this R6 class.
FDistributionNoncentral$new( df1 = NULL, df2 = NULL, location = NULL, decorators = NULL )
df1
(numeric(1))
First degree of freedom of the distribution defined on the positive Reals.
df2
(numeric(1))
Second degree of freedom of the distribution defined on the positive Reals.
location
(numeric(1))
Location parameter, defined on the Reals.
decorators
(character())
Decorators to add to the distribution during construction.
mean()
The arithmetic mean of a (discrete) probability distribution X is the expectation
with an integration analogue for continuous distributions.
FDistributionNoncentral$mean(...)
...
Unused.
variance()
The variance of a distribution is defined by the formula
where is the expectation of distribution X. If the distribution is multivariate the
covariance matrix is returned.
FDistributionNoncentral$variance(...)
...
Unused.
clone()
The objects of this class are cloneable with this method.
FDistributionNoncentral$clone(deep = FALSE)
deep
Whether to make a deep clone.
Jordan Deenichin
McLaughlin, M. P. (2001). A compendium of common probability distributions (pp. 2014-01). Michael P. McLaughlin.
Other continuous distributions:
Arcsine
,
BetaNoncentral
,
Beta
,
Cauchy
,
ChiSquaredNoncentral
,
ChiSquared
,
Dirichlet
,
Erlang
,
Exponential
,
FDistribution
,
Frechet
,
Gamma
,
Gompertz
,
Gumbel
,
InverseGamma
,
Laplace
,
Logistic
,
Loglogistic
,
Lognormal
,
MultivariateNormal
,
Normal
,
Pareto
,
Poisson
,
Rayleigh
,
ShiftedLoglogistic
,
StudentTNoncentral
,
StudentT
,
Triangular
,
Uniform
,
Wald
,
Weibull
Other univariate distributions:
Arcsine
,
Arrdist
,
Bernoulli
,
BetaNoncentral
,
Beta
,
Binomial
,
Categorical
,
Cauchy
,
ChiSquaredNoncentral
,
ChiSquared
,
Degenerate
,
DiscreteUniform
,
Empirical
,
Erlang
,
Exponential
,
FDistribution
,
Frechet
,
Gamma
,
Geometric
,
Gompertz
,
Gumbel
,
Hypergeometric
,
InverseGamma
,
Laplace
,
Logarithmic
,
Logistic
,
Loglogistic
,
Lognormal
,
Matdist
,
NegativeBinomial
,
Normal
,
Pareto
,
Poisson
,
Rayleigh
,
ShiftedLoglogistic
,
StudentTNoncentral
,
StudentT
,
Triangular
,
Uniform
,
Wald
,
Weibull
,
WeightedDiscrete
Mathematical and statistical functions for the Frechet distribution, which is commonly used as a special case of the Generalised Extreme Value distribution.
The Frechet distribution parameterised with shape, , scale,
, and minimum,
, is defined by the pdf,
for and
.
Returns an R6 object inheriting from class SDistribution.
The distribution is supported on .
Frec(shape = 1, scale = 1, minimum = 0)
N/A
Also known as the Inverse Weibull distribution.
distr6::Distribution
-> distr6::SDistribution
-> Frechet
name
Full name of distribution.
short_name
Short name of distribution for printing.
description
Brief description of the distribution.
alias
Alias of the distribution.
packages
Packages required to be installed in order to construct the distribution.
properties
Returns distribution properties, including skewness type and symmetry.
distr6::Distribution$cdf()
distr6::Distribution$confidence()
distr6::Distribution$correlation()
distr6::Distribution$getParameterValue()
distr6::Distribution$iqr()
distr6::Distribution$liesInSupport()
distr6::Distribution$liesInType()
distr6::Distribution$parameters()
distr6::Distribution$pdf()
distr6::Distribution$prec()
distr6::Distribution$print()
distr6::Distribution$quantile()
distr6::Distribution$rand()
distr6::Distribution$setParameterValue()
distr6::Distribution$stdev()
distr6::Distribution$strprint()
distr6::Distribution$summary()
distr6::Distribution$workingSupport()
new()
Creates a new instance of this R6 class.
Frechet$new(shape = NULL, scale = NULL, minimum = NULL, decorators = NULL)
shape
(numeric(1))
Shape parameter, defined on the positive Reals.
scale
(numeric(1))
Scale parameter, defined on the positive Reals.
minimum
(numeric(1))
Minimum of the distribution, defined on the Reals.
decorators
(character())
Decorators to add to the distribution during construction.
mean()
The arithmetic mean of a (discrete) probability distribution X is the expectation
with an integration analogue for continuous distributions.
Frechet$mean(...)
...
Unused.
mode()
The mode of a probability distribution is the point at which the pdf is a local maximum, a distribution can be unimodal (one maximum) or multimodal (several maxima).
Frechet$mode(which = "all")
which
(character(1) | numeric(1)
Ignored if distribution is unimodal. Otherwise "all"
returns all modes, otherwise specifies
which mode to return.
median()
Returns the median of the distribution. If an analytical expression is available
returns distribution median, otherwise if symmetric returns self$mean
, otherwise
returns self$quantile(0.5)
.
Frechet$median()
variance()
The variance of a distribution is defined by the formula
where is the expectation of distribution X. If the distribution is multivariate the
covariance matrix is returned.
Frechet$variance(...)
...
Unused.
skewness()
The skewness of a distribution is defined by the third standardised moment,
where is the expectation of distribution X,
is the mean of the
distribution and
is the standard deviation of the distribution.
Frechet$skewness(...)
...
Unused.
kurtosis()
The kurtosis of a distribution is defined by the fourth standardised moment,
where is the expectation of distribution X,
is the mean of the
distribution and
is the standard deviation of the distribution.
Excess Kurtosis is Kurtosis - 3.
Frechet$kurtosis(excess = TRUE, ...)
excess
(logical(1))
If TRUE
(default) excess kurtosis returned.
...
Unused.
entropy()
The entropy of a (discrete) distribution is defined by
where is the pdf of distribution X, with an integration analogue for
continuous distributions.
Frechet$entropy(base = 2, ...)
base
(integer(1))
Base of the entropy logarithm, default = 2 (Shannon entropy)
...
Unused.
pgf()
The probability generating function is defined by
where X is the distribution and is the expectation of the distribution X.
Frechet$pgf(z, ...)
z
(integer(1))
z integer to evaluate probability generating function at.
...
Unused.
clone()
The objects of this class are cloneable with this method.
Frechet$clone(deep = FALSE)
deep
Whether to make a deep clone.
McLaughlin, M. P. (2001). A compendium of common probability distributions (pp. 2014-01). Michael P. McLaughlin.
Other continuous distributions:
Arcsine
,
BetaNoncentral
,
Beta
,
Cauchy
,
ChiSquaredNoncentral
,
ChiSquared
,
Dirichlet
,
Erlang
,
Exponential
,
FDistributionNoncentral
,
FDistribution
,
Gamma
,
Gompertz
,
Gumbel
,
InverseGamma
,
Laplace
,
Logistic
,
Loglogistic
,
Lognormal
,
MultivariateNormal
,
Normal
,
Pareto
,
Poisson
,
Rayleigh
,
ShiftedLoglogistic
,
StudentTNoncentral
,
StudentT
,
Triangular
,
Uniform
,
Wald
,
Weibull
Other univariate distributions:
Arcsine
,
Arrdist
,
Bernoulli
,
BetaNoncentral
,
Beta
,
Binomial
,
Categorical
,
Cauchy
,
ChiSquaredNoncentral
,
ChiSquared
,
Degenerate
,
DiscreteUniform
,
Empirical
,
Erlang
,
Exponential
,
FDistributionNoncentral
,
FDistribution
,
Gamma
,
Geometric
,
Gompertz
,
Gumbel
,
Hypergeometric
,
InverseGamma
,
Laplace
,
Logarithmic
,
Logistic
,
Loglogistic
,
Lognormal
,
Matdist
,
NegativeBinomial
,
Normal
,
Pareto
,
Poisson
,
Rayleigh
,
ShiftedLoglogistic
,
StudentTNoncentral
,
StudentT
,
Triangular
,
Uniform
,
Wald
,
Weibull
,
WeightedDiscrete
This decorator imputes missing pdf/cdf/quantile/rand methods from R6 Distributions
by using strategies dependent on which methods are already present in the distribution. Unlike
other decorators, private methods are added to the Distribution, not public methods.
Therefore the underlying public [Distribution]$pdf
, [Distribution]$pdf
,
[Distribution]$quantile
, and [Distribution]$rand
functions stay the same.
Decorator objects add functionality to the given Distribution object by copying methods in the decorator environment to the chosen Distribution environment.
All methods implemented in decorators try to exploit analytical results where possible, otherwise numerical results are used with a message.
distr6::DistributionDecorator
-> FunctionImputation
packages
Packages required to be installed in order to construct the distribution.
methods
Returns the names of the available methods in this decorator.
decorate()
Decorates the given distribution with the methods available in this decorator.
FunctionImputation$decorate(distribution, n = 1000)
distribution
Distribution
Distribution to decorate.
n
(integer(1))
Grid size for imputing functions, cannot be changed after decorating.
Generally larger n
means better accuracy but slower computation, and smaller n
means worse accuracy and faster computation.
clone()
The objects of this class are cloneable with this method.
FunctionImputation$clone(deep = FALSE)
deep
Whether to make a deep clone.
Other decorators:
CoreStatistics
,
ExoticStatistics
if (requireNamespace("GoFKernel", quietly = TRUE) && requireNamespace("pracma", quietly = TRUE)) { pdf <- function(x) ifelse(x < 1 | x > 10, 0, 1 / 10) x <- Distribution$new("Test", pdf = pdf, support = set6::Interval$new(1, 10, class = "integer"), type = set6::Naturals$new() ) decorate(x, "FunctionImputation", n = 1000) x <- Distribution$new("Test", pdf = pdf, support = set6::Interval$new(1, 10, class = "integer"), type = set6::Naturals$new(), decorators = "FunctionImputation" ) x <- Distribution$new("Test", pdf = pdf, support = set6::Interval$new(1, 10, class = "integer"), type = set6::Naturals$new() ) FunctionImputation$new()$decorate(x, n = 1000) x$pdf(1:10) x$cdf(1:10) x$quantile(0.42) x$rand(4) }
if (requireNamespace("GoFKernel", quietly = TRUE) && requireNamespace("pracma", quietly = TRUE)) { pdf <- function(x) ifelse(x < 1 | x > 10, 0, 1 / 10) x <- Distribution$new("Test", pdf = pdf, support = set6::Interval$new(1, 10, class = "integer"), type = set6::Naturals$new() ) decorate(x, "FunctionImputation", n = 1000) x <- Distribution$new("Test", pdf = pdf, support = set6::Interval$new(1, 10, class = "integer"), type = set6::Naturals$new(), decorators = "FunctionImputation" ) x <- Distribution$new("Test", pdf = pdf, support = set6::Interval$new(1, 10, class = "integer"), type = set6::Naturals$new() ) FunctionImputation$new()$decorate(x, n = 1000) x$pdf(1:10) x$cdf(1:10) x$quantile(0.42) x$rand(4) }
Mathematical and statistical functions for the Gamma distribution, which is commonly used as the prior in Bayesian modelling, the convolution of exponential distributions, and to model waiting times.
The Gamma distribution parameterised with shape, , and rate,
, is defined by the pdf,
for .
Returns an R6 object inheriting from class SDistribution.
The distribution is supported on the Positive Reals.
Gamma(shape = 1, rate = 1)
N/A
N/A
distr6::Distribution
-> distr6::SDistribution
-> Gamma
name
Full name of distribution.
short_name
Short name of distribution for printing.
description
Brief description of the distribution.
alias
Alias of the distribution.
packages
Packages required to be installed in order to construct the distribution.
distr6::Distribution$cdf()
distr6::Distribution$confidence()
distr6::Distribution$correlation()
distr6::Distribution$getParameterValue()
distr6::Distribution$iqr()
distr6::Distribution$liesInSupport()
distr6::Distribution$liesInType()
distr6::Distribution$median()
distr6::Distribution$parameters()
distr6::Distribution$pdf()
distr6::Distribution$prec()
distr6::Distribution$print()
distr6::Distribution$quantile()
distr6::Distribution$rand()
distr6::Distribution$setParameterValue()
distr6::Distribution$stdev()
distr6::Distribution$strprint()
distr6::Distribution$summary()
distr6::Distribution$workingSupport()
new()
Creates a new instance of this R6 class.
Gamma$new( shape = NULL, rate = NULL, scale = NULL, mean = NULL, decorators = NULL )
shape
(numeric(1))
Shape parameter, defined on the positive Reals.
rate
(numeric(1))
Rate parameter of the distribution, defined on the positive Reals.
scale
numeric(1))
Scale parameter of the distribution, defined on the positive Reals. scale = 1/rate
.
If provided rate
is ignored.
mean
(numeric(1))
Alternative parameterisation of the distribution, defined on the positive Reals.
If given then rate
and scale
are ignored. Related by mean = shape/rate
.
decorators
(character())
Decorators to add to the distribution during construction.
mean()
The arithmetic mean of a (discrete) probability distribution X is the expectation
with an integration analogue for continuous distributions.
Gamma$mean(...)
...
Unused.
mode()
The mode of a probability distribution is the point at which the pdf is a local maximum, a distribution can be unimodal (one maximum) or multimodal (several maxima).
Gamma$mode(which = "all")
which
(character(1) | numeric(1)
Ignored if distribution is unimodal. Otherwise "all"
returns all modes, otherwise specifies
which mode to return.
variance()
The variance of a distribution is defined by the formula
where is the expectation of distribution X. If the distribution is multivariate the
covariance matrix is returned.
Gamma$variance(...)
...
Unused.
skewness()
The skewness of a distribution is defined by the third standardised moment,
where is the expectation of distribution X,
is the mean of the
distribution and
is the standard deviation of the distribution.
Gamma$skewness(...)
...
Unused.
kurtosis()
The kurtosis of a distribution is defined by the fourth standardised moment,
where is the expectation of distribution X,
is the mean of the
distribution and
is the standard deviation of the distribution.
Excess Kurtosis is Kurtosis - 3.
Gamma$kurtosis(excess = TRUE, ...)
excess
(logical(1))
If TRUE
(default) excess kurtosis returned.
...
Unused.
entropy()
The entropy of a (discrete) distribution is defined by
where is the pdf of distribution X, with an integration analogue for
continuous distributions.
Gamma$entropy(base = 2, ...)
base
(integer(1))
Base of the entropy logarithm, default = 2 (Shannon entropy)
...
Unused.
mgf()
The moment generating function is defined by
where X is the distribution and is the expectation of the distribution X.
Gamma$mgf(t, ...)
t
(integer(1))
t integer to evaluate function at.
...
Unused.
cf()
The characteristic function is defined by
where X is the distribution and is the expectation of the distribution X.
Gamma$cf(t, ...)
t
(integer(1))
t integer to evaluate function at.
...
Unused.
pgf()
The probability generating function is defined by
where X is the distribution and is the expectation of the distribution X.
Gamma$pgf(z, ...)
z
(integer(1))
z integer to evaluate probability generating function at.
...
Unused.
clone()
The objects of this class are cloneable with this method.
Gamma$clone(deep = FALSE)
deep
Whether to make a deep clone.
McLaughlin, M. P. (2001). A compendium of common probability distributions (pp. 2014-01). Michael P. McLaughlin.
Other continuous distributions:
Arcsine
,
BetaNoncentral
,
Beta
,
Cauchy
,
ChiSquaredNoncentral
,
ChiSquared
,
Dirichlet
,
Erlang
,
Exponential
,
FDistributionNoncentral
,
FDistribution
,
Frechet
,
Gompertz
,
Gumbel
,
InverseGamma
,
Laplace
,
Logistic
,
Loglogistic
,
Lognormal
,
MultivariateNormal
,
Normal
,
Pareto
,
Poisson
,
Rayleigh
,
ShiftedLoglogistic
,
StudentTNoncentral
,
StudentT
,
Triangular
,
Uniform
,
Wald
,
Weibull
Other univariate distributions:
Arcsine
,
Arrdist
,
Bernoulli
,
BetaNoncentral
,
Beta
,
Binomial
,
Categorical
,
Cauchy
,
ChiSquaredNoncentral
,
ChiSquared
,
Degenerate
,
DiscreteUniform
,
Empirical
,
Erlang
,
Exponential
,
FDistributionNoncentral
,
FDistribution
,
Frechet
,
Geometric
,
Gompertz
,
Gumbel
,
Hypergeometric
,
InverseGamma
,
Laplace
,
Logarithmic
,
Logistic
,
Loglogistic
,
Lognormal
,
Matdist
,
NegativeBinomial
,
Normal
,
Pareto
,
Poisson
,
Rayleigh
,
ShiftedLoglogistic
,
StudentTNoncentral
,
StudentT
,
Triangular
,
Uniform
,
Wald
,
Weibull
,
WeightedDiscrete
Calculate the p-norm of any function between given limits.
generalPNorm(fun, p, lower, upper, range = NULL)
generalPNorm(fun, p, lower, upper, range = NULL)
fun |
function to calculate the p-norm of. |
p |
the pth norm to calculate |
lower |
lower bound for the integral |
upper |
upper bound for the integral |
range |
if discrete then range of the function to sum over |
The p-norm of a continuous function is given by,
where is the function support. And for a discrete function by
where is over a given range.
The p-norm is calculated numerically using the integrate
function and therefore results
are approximate only.
Returns a numeric value for the p norm of a function evaluated between given limits.
generalPNorm(Exponential$new()$pdf, 2, 0, 10)
generalPNorm(Exponential$new()$pdf, 2, 0, 10)
Mathematical and statistical functions for the Geometric distribution, which is commonly used to model the number of trials (or number of failures) before the first success.
The Geometric distribution parameterised with probability of success, , is defined by the pmf,
for probability .
The Geometric distribution is used to either model the number of trials
(trials = TRUE
) or number of failures (trials = FALSE
) before the first success.
Returns an R6 object inheriting from class SDistribution.
The distribution is supported on the Naturals (zero is included if modelling number of failures before success).
Geom(prob = 0.5, trials = FALSE)
N/A
N/A
distr6::Distribution
-> distr6::SDistribution
-> Geometric
name
Full name of distribution.
short_name
Short name of distribution for printing.
description
Brief description of the distribution.
alias
Alias of the distribution.
packages
Packages required to be installed in order to construct the distribution.
distr6::Distribution$cdf()
distr6::Distribution$confidence()
distr6::Distribution$correlation()
distr6::Distribution$getParameterValue()
distr6::Distribution$iqr()
distr6::Distribution$liesInSupport()
distr6::Distribution$liesInType()
distr6::Distribution$median()
distr6::Distribution$parameters()
distr6::Distribution$pdf()
distr6::Distribution$prec()
distr6::Distribution$print()
distr6::Distribution$quantile()
distr6::Distribution$rand()
distr6::Distribution$setParameterValue()
distr6::Distribution$stdev()
distr6::Distribution$strprint()
distr6::Distribution$summary()
distr6::Distribution$workingSupport()
new()
Creates a new instance of this R6 class.
Geometric$new(prob = NULL, qprob = NULL, trials = NULL, decorators = NULL)
prob
(numeric(1))
Probability of success.
qprob
(numeric(1))
Probability of failure. If provided then prob
is ignored. qprob = 1 - prob
.
trials
(logical(1))
If TRUE
then the distribution models the number of trials, , before the first
success. Otherwise the distribution calculates the probability of
failures before the
first success. Mathematically these are related by
.
decorators
(character())
Decorators to add to the distribution during construction.
mean()
The arithmetic mean of a (discrete) probability distribution X is the expectation
with an integration analogue for continuous distributions.
Geometric$mean(...)
...
Unused.
mode()
The mode of a probability distribution is the point at which the pdf is a local maximum, a distribution can be unimodal (one maximum) or multimodal (several maxima).
Geometric$mode(which = "all")
which
(character(1) | numeric(1)
Ignored if distribution is unimodal. Otherwise "all"
returns all modes, otherwise specifies
which mode to return.
variance()
The variance of a distribution is defined by the formula
where is the expectation of distribution X. If the distribution is multivariate the
covariance matrix is returned.
Geometric$variance(...)
...
Unused.
skewness()
The skewness of a distribution is defined by the third standardised moment,
where is the expectation of distribution X,
is the mean of the
distribution and
is the standard deviation of the distribution.
Geometric$skewness(...)
...
Unused.
kurtosis()
The kurtosis of a distribution is defined by the fourth standardised moment,
where is the expectation of distribution X,
is the mean of the
distribution and
is the standard deviation of the distribution.
Excess Kurtosis is Kurtosis - 3.
Geometric$kurtosis(excess = TRUE, ...)
excess
(logical(1))
If TRUE
(default) excess kurtosis returned.
...
Unused.
entropy()
The entropy of a (discrete) distribution is defined by
where is the pdf of distribution X, with an integration analogue for
continuous distributions.
Geometric$entropy(base = 2, ...)
base
(integer(1))
Base of the entropy logarithm, default = 2 (Shannon entropy)
...
Unused.
mgf()
The moment generating function is defined by
where X is the distribution and is the expectation of the distribution X.
Geometric$mgf(t, ...)
t
(integer(1))
t integer to evaluate function at.
...
Unused.
cf()
The characteristic function is defined by
where X is the distribution and is the expectation of the distribution X.
Geometric$cf(t, ...)
t
(integer(1))
t integer to evaluate function at.
...
Unused.
pgf()
The probability generating function is defined by
where X is the distribution and is the expectation of the distribution X.
Geometric$pgf(z, ...)
z
(integer(1))
z integer to evaluate probability generating function at.
...
Unused.
clone()
The objects of this class are cloneable with this method.
Geometric$clone(deep = FALSE)
deep
Whether to make a deep clone.
McLaughlin, M. P. (2001). A compendium of common probability distributions (pp. 2014-01). Michael P. McLaughlin.
Other discrete distributions:
Arrdist
,
Bernoulli
,
Binomial
,
Categorical
,
Degenerate
,
DiscreteUniform
,
EmpiricalMV
,
Empirical
,
Hypergeometric
,
Logarithmic
,
Matdist
,
Multinomial
,
NegativeBinomial
,
WeightedDiscrete
Other univariate distributions:
Arcsine
,
Arrdist
,
Bernoulli
,
BetaNoncentral
,
Beta
,
Binomial
,
Categorical
,
Cauchy
,
ChiSquaredNoncentral
,
ChiSquared
,
Degenerate
,
DiscreteUniform
,
Empirical
,
Erlang
,
Exponential
,
FDistributionNoncentral
,
FDistribution
,
Frechet
,
Gamma
,
Gompertz
,
Gumbel
,
Hypergeometric
,
InverseGamma
,
Laplace
,
Logarithmic
,
Logistic
,
Loglogistic
,
Lognormal
,
Matdist
,
NegativeBinomial
,
Normal
,
Pareto
,
Poisson
,
Rayleigh
,
ShiftedLoglogistic
,
StudentTNoncentral
,
StudentT
,
Triangular
,
Uniform
,
Wald
,
Weibull
,
WeightedDiscrete
Mathematical and statistical functions for the Gompertz distribution, which is commonly used in survival analysis particularly to model adult mortality rates..
The Gompertz distribution parameterised with shape, , and scale,
, is defined by the pdf,
for .
Returns an R6 object inheriting from class SDistribution.
The distribution is supported on the Non-Negative Reals.
Gomp(shape = 1, scale = 1)
N/A
N/A
distr6::Distribution
-> distr6::SDistribution
-> Gompertz
name
Full name of distribution.
short_name
Short name of distribution for printing.
description
Brief description of the distribution.
alias
Alias of the distribution.
packages
Packages required to be installed in order to construct the distribution.
distr6::Distribution$cdf()
distr6::Distribution$confidence()
distr6::Distribution$correlation()
distr6::Distribution$getParameterValue()
distr6::Distribution$iqr()
distr6::Distribution$liesInSupport()
distr6::Distribution$liesInType()
distr6::Distribution$parameters()
distr6::Distribution$pdf()
distr6::Distribution$prec()
distr6::Distribution$print()
distr6::Distribution$quantile()
distr6::Distribution$rand()
distr6::Distribution$setParameterValue()
distr6::Distribution$stdev()
distr6::Distribution$strprint()
distr6::Distribution$summary()
distr6::Distribution$workingSupport()
new()
Creates a new instance of this R6 class.
Gompertz$new(shape = NULL, scale = NULL, decorators = NULL)
shape
(numeric(1))
Shape parameter, defined on the positive Reals.
scale
(numeric(1))
Scale parameter, defined on the positive Reals.
decorators
(character())
Decorators to add to the distribution during construction.
median()
Returns the median of the distribution. If an analytical expression is available
returns distribution median, otherwise if symmetric returns self$mean
, otherwise
returns self$quantile(0.5)
.
Gompertz$median()
pgf()
The probability generating function is defined by
where X is the distribution and is the expectation of the distribution X.
Gompertz$pgf(z, ...)
z
(integer(1))
z integer to evaluate probability generating function at.
...
Unused.
clone()
The objects of this class are cloneable with this method.
Gompertz$clone(deep = FALSE)
deep
Whether to make a deep clone.
McLaughlin, M. P. (2001). A compendium of common probability distributions (pp. 2014-01). Michael P. McLaughlin.
Other continuous distributions:
Arcsine
,
BetaNoncentral
,
Beta
,
Cauchy
,
ChiSquaredNoncentral
,
ChiSquared
,
Dirichlet
,
Erlang
,
Exponential
,
FDistributionNoncentral
,
FDistribution
,
Frechet
,
Gamma
,
Gumbel
,
InverseGamma
,
Laplace
,
Logistic
,
Loglogistic
,
Lognormal
,
MultivariateNormal
,
Normal
,
Pareto
,
Poisson
,
Rayleigh
,
ShiftedLoglogistic
,
StudentTNoncentral
,
StudentT
,
Triangular
,
Uniform
,
Wald
,
Weibull
Other univariate distributions:
Arcsine
,
Arrdist
,
Bernoulli
,
BetaNoncentral
,
Beta
,
Binomial
,
Categorical
,
Cauchy
,
ChiSquaredNoncentral
,
ChiSquared
,
Degenerate
,
DiscreteUniform
,
Empirical
,
Erlang
,
Exponential
,
FDistributionNoncentral
,
FDistribution
,
Frechet
,
Gamma
,
Geometric
,
Gumbel
,
Hypergeometric
,
InverseGamma
,
Laplace
,
Logarithmic
,
Logistic
,
Loglogistic
,
Lognormal
,
Matdist
,
NegativeBinomial
,
Normal
,
Pareto
,
Poisson
,
Rayleigh
,
ShiftedLoglogistic
,
StudentTNoncentral
,
StudentT
,
Triangular
,
Uniform
,
Wald
,
Weibull
,
WeightedDiscrete
Simple wrapper around d$getParameterValue(p) and d$setParameterValue(lst).
gprm(d, p) sprm(d, lst)
gprm(d, p) sprm(d, lst)
d |
( |
p |
( |
lst |
( |
d <- dstr("Norm") gprm(d, "mean") gprm(d, c("mean", "var")) sprm(d, list(mean = 1, var = 3)) gprm(d, c("mean", "sd"))
d <- dstr("Norm") gprm(d, "mean") gprm(d, c("mean", "var")) sprm(d, list(mean = 1, var = 3)) gprm(d, c("mean", "sd"))
Mathematical and statistical functions for the Gumbel distribution, which is commonly used to model the maximum (or minimum) of a number of samples of different distributions, and is a special case of the Generalised Extreme Value distribution.
The Gumbel distribution parameterised with location, , and scale,
, is defined by the pdf,
for ,
and
.
Returns an R6 object inheriting from class SDistribution.
The distribution is supported on the Reals.
Gumb(location = 0, scale = 1)
N/A
N/A
distr6::Distribution
-> distr6::SDistribution
-> Gumbel
name
Full name of distribution.
short_name
Short name of distribution for printing.
description
Brief description of the distribution.
alias
Alias of the distribution.
packages
Packages required to be installed in order to construct the distribution.
distr6::Distribution$cdf()
distr6::Distribution$confidence()
distr6::Distribution$correlation()
distr6::Distribution$getParameterValue()
distr6::Distribution$iqr()
distr6::Distribution$liesInSupport()
distr6::Distribution$liesInType()
distr6::Distribution$parameters()
distr6::Distribution$pdf()
distr6::Distribution$prec()
distr6::Distribution$print()
distr6::Distribution$quantile()
distr6::Distribution$rand()
distr6::Distribution$setParameterValue()
distr6::Distribution$stdev()
distr6::Distribution$strprint()
distr6::Distribution$summary()
distr6::Distribution$workingSupport()
new()
Creates a new instance of this R6 class.
Gumbel$new(location = NULL, scale = NULL, decorators = NULL)
location
(numeric(1))
Location parameter defined on the Reals.
scale
(numeric(1))
Scale parameter defined on the positive Reals.
decorators
(character())
Decorators to add to the distribution during construction.
mean()
The arithmetic mean of a (discrete) probability distribution X is the expectation
with an integration analogue for continuous distributions.
Gumbel$mean(...)
...
Unused.
mode()
The mode of a probability distribution is the point at which the pdf is a local maximum, a distribution can be unimodal (one maximum) or multimodal (several maxima).
Gumbel$mode(which = "all")
which
(character(1) | numeric(1)
Ignored if distribution is unimodal. Otherwise "all"
returns all modes, otherwise specifies
which mode to return.
median()
Returns the median of the distribution. If an analytical expression is available
returns distribution median, otherwise if symmetric returns self$mean
, otherwise
returns self$quantile(0.5)
.
Gumbel$median()
variance()
The variance of a distribution is defined by the formula
where is the expectation of distribution X. If the distribution is multivariate the
covariance matrix is returned.
Gumbel$variance(...)
...
Unused.
skewness()
The skewness of a distribution is defined by the third standardised moment,
where is the expectation of distribution X,
is the mean of the
distribution and
is the standard deviation of the distribution.
Apery's Constant to 16 significant figures is used in the calculation.
Gumbel$skewness(...)
...
Unused.
kurtosis()
The kurtosis of a distribution is defined by the fourth standardised moment,
where is the expectation of distribution X,
is the mean of the
distribution and
is the standard deviation of the distribution.
Excess Kurtosis is Kurtosis - 3.
Gumbel$kurtosis(excess = TRUE, ...)
excess
(logical(1))
If TRUE
(default) excess kurtosis returned.
...
Unused.
entropy()
The entropy of a (discrete) distribution is defined by
where is the pdf of distribution X, with an integration analogue for
continuous distributions.
Gumbel$entropy(base = 2, ...)
base
(integer(1))
Base of the entropy logarithm, default = 2 (Shannon entropy)
...
Unused.
mgf()
The moment generating function is defined by
where X is the distribution and is the expectation of the distribution X.
Gumbel$mgf(t, ...)
t
(integer(1))
t integer to evaluate function at.
...
Unused.
cf()
The characteristic function is defined by
where X is the distribution and is the expectation of the distribution X.
pracma::gammaz()
is used in this function to allow complex inputs.
Gumbel$cf(t, ...)
t
(integer(1))
t integer to evaluate function at.
...
Unused.
pgf()
The probability generating function is defined by
where X is the distribution and is the expectation of the distribution X.
Gumbel$pgf(z, ...)
z
(integer(1))
z integer to evaluate probability generating function at.
...
Unused.
clone()
The objects of this class are cloneable with this method.
Gumbel$clone(deep = FALSE)
deep
Whether to make a deep clone.
McLaughlin, M. P. (2001). A compendium of common probability distributions (pp. 2014-01). Michael P. McLaughlin.
Other continuous distributions:
Arcsine
,
BetaNoncentral
,
Beta
,
Cauchy
,
ChiSquaredNoncentral
,
ChiSquared
,
Dirichlet
,
Erlang
,
Exponential
,
FDistributionNoncentral
,
FDistribution
,
Frechet
,
Gamma
,
Gompertz
,
InverseGamma
,
Laplace
,
Logistic
,
Loglogistic
,
Lognormal
,
MultivariateNormal
,
Normal
,
Pareto
,
Poisson
,
Rayleigh
,
ShiftedLoglogistic
,
StudentTNoncentral
,
StudentT
,
Triangular
,
Uniform
,
Wald
,
Weibull
Other univariate distributions:
Arcsine
,
Arrdist
,
Bernoulli
,
BetaNoncentral
,
Beta
,
Binomial
,
Categorical
,
Cauchy
,
ChiSquaredNoncentral
,
ChiSquared
,
Degenerate
,
DiscreteUniform
,
Empirical
,
Erlang
,
Exponential
,
FDistributionNoncentral
,
FDistribution
,
Frechet
,
Gamma
,
Geometric
,
Gompertz
,
Hypergeometric
,
InverseGamma
,
Laplace
,
Logarithmic
,
Logistic
,
Loglogistic
,
Lognormal
,
Matdist
,
NegativeBinomial
,
Normal
,
Pareto
,
Poisson
,
Rayleigh
,
ShiftedLoglogistic
,
StudentTNoncentral
,
StudentT
,
Triangular
,
Uniform
,
Wald
,
Weibull
,
WeightedDiscrete
S3 functionality to huberize an R6 distribution.
huberize(x, lower, upper)
huberize(x, lower, upper)
x |
distribution to huberize. |
lower |
lower limit for huberization. |
upper |
upper limit for huberization. |
A wrapper for huberizing any probability distribution at given limits.
The pdf and cdf of the distribution are required for this wrapper, if unavailable decorate with FunctionImputation first.
Huberizes a distribution at lower and upper limits, using the formula
where f_H is the pdf of the truncated distribution H = Huberize(X, lower, upper) and
/
is the pdf/cdf of the original distribution.
distr6::Distribution
-> distr6::DistributionWrapper
-> HuberizedDistribution
properties
Returns distribution properties, including skewness type and symmetry.
distr6::Distribution$cdf()
distr6::Distribution$confidence()
distr6::Distribution$correlation()
distr6::Distribution$getParameterValue()
distr6::Distribution$iqr()
distr6::Distribution$liesInSupport()
distr6::Distribution$liesInType()
distr6::Distribution$median()
distr6::Distribution$parameters()
distr6::Distribution$pdf()
distr6::Distribution$prec()
distr6::Distribution$print()
distr6::Distribution$quantile()
distr6::Distribution$rand()
distr6::Distribution$setParameterValue()
distr6::Distribution$stdev()
distr6::Distribution$strprint()
distr6::Distribution$summary()
distr6::Distribution$workingSupport()
distr6::DistributionWrapper$wrappedModels()
new()
Creates a new instance of this R6 class.
HuberizedDistribution$new(distribution, lower = NULL, upper = NULL)
distribution
([Distribution])
Distribution to wrap.
lower
(numeric(1))
Lower limit to huberize the distribution at. If NULL
then the lower bound of
the Distribution is used.
upper
(numeric(1))
Upper limit to huberize the distribution at. If NULL
then the upper bound of
the Distribution is used.
HuberizedDistribution$new( Binomial$new(prob = 0.5, size = 10), lower = 2, upper = 4 ) # alternate constructor huberize(Binomial$new(), lower = 2, upper = 4)
clone()
The objects of this class are cloneable with this method.
HuberizedDistribution$clone(deep = FALSE)
deep
Whether to make a deep clone.
Other wrappers:
Convolution
,
DistributionWrapper
,
MixtureDistribution
,
ProductDistribution
,
TruncatedDistribution
,
VectorDistribution
## ------------------------------------------------ ## Method `HuberizedDistribution$new` ## ------------------------------------------------ HuberizedDistribution$new( Binomial$new(prob = 0.5, size = 10), lower = 2, upper = 4 ) # alternate constructor huberize(Binomial$new(), lower = 2, upper = 4)
## ------------------------------------------------ ## Method `HuberizedDistribution$new` ## ------------------------------------------------ HuberizedDistribution$new( Binomial$new(prob = 0.5, size = 10), lower = 2, upper = 4 ) # alternate constructor huberize(Binomial$new(), lower = 2, upper = 4)
Mathematical and statistical functions for the Hypergeometric distribution, which is commonly used to model the number of successes out of a population containing a known number of possible successes, for example the number of red balls from an urn or red, blue and yellow balls.
The Hypergeometric distribution parameterised with population size, , number of possible successes,
, and number of draws from the distribution,
, is defined by the pmf,
for ,
and
is the combination (or binomial coefficient) function.
Returns an R6 object inheriting from class SDistribution.
The distribution is supported on .
Hyper(size = 50, successes = 5, draws = 10)
N/A
N/A
distr6::Distribution
-> distr6::SDistribution
-> Hypergeometric
name
Full name of distribution.
short_name
Short name of distribution for printing.
description
Brief description of the distribution.
alias
Alias of the distribution.
packages
Packages required to be installed in order to construct the distribution.
properties
Returns distribution properties, including skewness type and symmetry.
distr6::Distribution$cdf()
distr6::Distribution$confidence()
distr6::Distribution$correlation()
distr6::Distribution$getParameterValue()
distr6::Distribution$iqr()
distr6::Distribution$liesInSupport()
distr6::Distribution$liesInType()
distr6::Distribution$median()
distr6::Distribution$parameters()
distr6::Distribution$pdf()
distr6::Distribution$prec()
distr6::Distribution$print()
distr6::Distribution$quantile()
distr6::Distribution$rand()
distr6::Distribution$stdev()
distr6::Distribution$strprint()
distr6::Distribution$summary()
distr6::Distribution$workingSupport()
new()
Creates a new instance of this R6 class.
Hypergeometric$new( size = NULL, successes = NULL, failures = NULL, draws = NULL, decorators = NULL )
size
(integer(1))
Population size. Defined on positive Naturals.
successes
(integer(1))
Number of population successes. Defined on positive Naturals.
failures
(integer(1))
Number of population failures. failures = size - successes
. If given then successes
is ignored. Defined on positive Naturals.
draws
(integer(1))
Number of draws from the distribution, defined on the positive Naturals.
decorators
(character())
Decorators to add to the distribution during construction.
mean()
The arithmetic mean of a (discrete) probability distribution X is the expectation
with an integration analogue for continuous distributions.
Hypergeometric$mean(...)
...
Unused.
mode()
The mode of a probability distribution is the point at which the pdf is a local maximum, a distribution can be unimodal (one maximum) or multimodal (several maxima).
Hypergeometric$mode(which = "all")
which
(character(1) | numeric(1)
Ignored if distribution is unimodal. Otherwise "all"
returns all modes, otherwise specifies
which mode to return.
variance()
The variance of a distribution is defined by the formula
where is the expectation of distribution X. If the distribution is multivariate the
covariance matrix is returned.
Hypergeometric$variance(...)
...
Unused.
skewness()
The skewness of a distribution is defined by the third standardised moment,
where is the expectation of distribution X,
is the mean of the
distribution and
is the standard deviation of the distribution.
Hypergeometric$skewness(...)
...
Unused.
kurtosis()
The kurtosis of a distribution is defined by the fourth standardised moment,
where is the expectation of distribution X,
is the mean of the
distribution and
is the standard deviation of the distribution.
Excess Kurtosis is Kurtosis - 3.
Hypergeometric$kurtosis(excess = TRUE, ...)
excess
(logical(1))
If TRUE
(default) excess kurtosis returned.
...
Unused.
setParameterValue()
Sets the value(s) of the given parameter(s).
Hypergeometric$setParameterValue( ..., lst = list(...), error = "warn", resolveConflicts = FALSE )
...
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.
clone()
The objects of this class are cloneable with this method.
Hypergeometric$clone(deep = FALSE)
deep
Whether to make a deep clone.
McLaughlin, M. P. (2001). A compendium of common probability distributions (pp. 2014-01). Michael P. McLaughlin.
Other discrete distributions:
Arrdist
,
Bernoulli
,
Binomial
,
Categorical
,
Degenerate
,
DiscreteUniform
,
EmpiricalMV
,
Empirical
,
Geometric
,
Logarithmic
,
Matdist
,
Multinomial
,
NegativeBinomial
,
WeightedDiscrete
Other univariate distributions:
Arcsine
,
Arrdist
,
Bernoulli
,
BetaNoncentral
,
Beta
,
Binomial
,
Categorical
,
Cauchy
,
ChiSquaredNoncentral
,
ChiSquared
,
Degenerate
,
DiscreteUniform
,
Empirical
,
Erlang
,
Exponential
,
FDistributionNoncentral
,
FDistribution
,
Frechet
,
Gamma
,
Geometric
,
Gompertz
,
Gumbel
,
InverseGamma
,
Laplace
,
Logarithmic
,
Logistic
,
Loglogistic
,
Lognormal
,
Matdist
,
NegativeBinomial
,
Normal
,
Pareto
,
Poisson
,
Rayleigh
,
ShiftedLoglogistic
,
StudentTNoncentral
,
StudentT
,
Triangular
,
Uniform
,
Wald
,
Weibull
,
WeightedDiscrete
Mathematical and statistical functions for the Inverse Gamma distribution, which is commonly used in Bayesian statistics as the posterior distribution from the unknown variance in a Normal distribution.
The Inverse Gamma distribution parameterised with shape, , and scale,
, is defined by the pdf,
for , where
is the gamma function.
Returns an R6 object inheriting from class SDistribution.
The distribution is supported on the Positive Reals.
InvGamma(shape = 1, scale = 1)
N/A
N/A
distr6::Distribution
-> distr6::SDistribution
-> InverseGamma
name
Full name of distribution.
short_name
Short name of distribution for printing.
description
Brief description of the distribution.
alias
Alias of the distribution.
packages
Packages required to be installed in order to construct the distribution.
distr6::Distribution$cdf()
distr6::Distribution$confidence()
distr6::Distribution$correlation()
distr6::Distribution$getParameterValue()
distr6::Distribution$iqr()
distr6::Distribution$liesInSupport()
distr6::Distribution$liesInType()
distr6::Distribution$median()
distr6::Distribution$parameters()
distr6::Distribution$pdf()
distr6::Distribution$prec()
distr6::Distribution$print()
distr6::Distribution$quantile()
distr6::Distribution$rand()
distr6::Distribution$setParameterValue()
distr6::Distribution$stdev()
distr6::Distribution$strprint()
distr6::Distribution$summary()
distr6::Distribution$workingSupport()
new()
Creates a new instance of this R6 class.
InverseGamma$new(shape = NULL, scale = NULL, decorators = NULL)
shape
(numeric(1))
Shape parameter, defined on the positive Reals.
scale
(numeric(1))
Scale parameter, defined on the positive Reals.
decorators
(character())
Decorators to add to the distribution during construction.
mean()
The arithmetic mean of a (discrete) probability distribution X is the expectation
with an integration analogue for continuous distributions.
InverseGamma$mean(...)
...
Unused.
mode()
The mode of a probability distribution is the point at which the pdf is a local maximum, a distribution can be unimodal (one maximum) or multimodal (several maxima).
InverseGamma$mode(which = "all")
which
(character(1) | numeric(1)
Ignored if distribution is unimodal. Otherwise "all"
returns all modes, otherwise specifies
which mode to return.
variance()
The variance of a distribution is defined by the formula
where is the expectation of distribution X. If the distribution is multivariate the
covariance matrix is returned.
InverseGamma$variance(...)
...
Unused.
skewness()
The skewness of a distribution is defined by the third standardised moment,
where is the expectation of distribution X,
is the mean of the
distribution and
is the standard deviation of the distribution.
InverseGamma$skewness(...)
...
Unused.
kurtosis()
The kurtosis of a distribution is defined by the fourth standardised moment,
where is the expectation of distribution X,
is the mean of the
distribution and
is the standard deviation of the distribution.
Excess Kurtosis is Kurtosis - 3.
InverseGamma$kurtosis(excess = TRUE, ...)
excess
(logical(1))
If TRUE
(default) excess kurtosis returned.
...
Unused.
entropy()
The entropy of a (discrete) distribution is defined by
where is the pdf of distribution X, with an integration analogue for
continuous distributions.
InverseGamma$entropy(base = 2, ...)
base
(integer(1))
Base of the entropy logarithm, default = 2 (Shannon entropy)
...
Unused.
mgf()
The moment generating function is defined by
where X is the distribution and is the expectation of the distribution X.
InverseGamma$mgf(t, ...)
t
(integer(1))
t integer to evaluate function at.
...
Unused.
pgf()
The probability generating function is defined by
where X is the distribution and is the expectation of the distribution X.
InverseGamma$pgf(z, ...)
z
(integer(1))
z integer to evaluate probability generating function at.
...
Unused.
clone()
The objects of this class are cloneable with this method.
InverseGamma$clone(deep = FALSE)
deep
Whether to make a deep clone.
McLaughlin, M. P. (2001). A compendium of common probability distributions (pp. 2014-01). Michael P. McLaughlin.
Other continuous distributions:
Arcsine
,
BetaNoncentral
,
Beta
,
Cauchy
,
ChiSquaredNoncentral
,
ChiSquared
,
Dirichlet
,
Erlang
,
Exponential
,
FDistributionNoncentral
,
FDistribution
,
Frechet
,
Gamma
,
Gompertz
,
Gumbel
,
Laplace
,
Logistic
,
Loglogistic
,
Lognormal
,
MultivariateNormal
,
Normal
,
Pareto
,
Poisson
,
Rayleigh
,
ShiftedLoglogistic
,
StudentTNoncentral
,
StudentT
,
Triangular
,
Uniform
,
Wald
,
Weibull
Other univariate distributions:
Arcsine
,
Arrdist
,
Bernoulli
,
BetaNoncentral
,
Beta
,
Binomial
,
Categorical
,
Cauchy
,
ChiSquaredNoncentral
,
ChiSquared
,
Degenerate
,
DiscreteUniform
,
Empirical
,
Erlang
,
Exponential
,
FDistributionNoncentral
,
FDistribution
,
Frechet
,
Gamma
,
Geometric
,
Gompertz
,
Gumbel
,
Hypergeometric
,
Laplace
,
Logarithmic
,
Logistic
,
Loglogistic
,
Lognormal
,
Matdist
,
NegativeBinomial
,
Normal
,
Pareto
,
Poisson
,
Rayleigh
,
ShiftedLoglogistic
,
StudentTNoncentral
,
StudentT
,
Triangular
,
Uniform
,
Wald
,
Weibull
,
WeightedDiscrete
Abstract class that cannot be constructed directly.
Returns error. Abstract classes cannot be constructed directly.
distr6::Distribution
-> Kernel
package
Deprecated, use $packages
instead.
packages
Packages required to be installed in order to construct the distribution.
distr6::Distribution$cdf()
distr6::Distribution$confidence()
distr6::Distribution$correlation()
distr6::Distribution$getParameterValue()
distr6::Distribution$iqr()
distr6::Distribution$liesInSupport()
distr6::Distribution$liesInType()
distr6::Distribution$parameters()
distr6::Distribution$pdf()
distr6::Distribution$prec()
distr6::Distribution$print()
distr6::Distribution$quantile()
distr6::Distribution$rand()
distr6::Distribution$setParameterValue()
distr6::Distribution$stdev()
distr6::Distribution$strprint()
distr6::Distribution$summary()
distr6::Distribution$workingSupport()
new()
Creates a new instance of this R6 class.
Kernel$new(decorators = NULL, support = Interval$new(-1, 1))
decorators
(character())
Decorators to add to the distribution during construction.
support
[set6::Set]
Support of the distribution.
mode()
Calculates the mode of the distribution.
Kernel$mode(which = "all")
which
(character(1) | numeric(1)
Ignored if distribution is unimodal. Otherwise "all"
returns all modes, otherwise specifies
which mode to return.
mean()
Calculates the mean (expectation) of the distribution.
Kernel$mean(...)
...
Unused.
median()
Calculates the median of the distribution.
Kernel$median()
pdfSquared2Norm()
The squared 2-norm of the pdf is defined by
where X is the Distribution, is its pdf and
are the distribution support limits.
Kernel$pdfSquared2Norm(x = 0, upper = Inf)
x
(numeric(1))
Amount to shift the result.
upper
(numeric(1))
Upper limit of the integral.
cdfSquared2Norm()
The squared 2-norm of the cdf is defined by
where X is the Distribution, is its pdf and
are the distribution support limits.
Kernel$cdfSquared2Norm(x = 0, upper = Inf)
x
(numeric(1))
Amount to shift the result.
upper
(numeric(1))
Upper limit of the integral.
skewness()
The skewness of a distribution is defined by the third standardised moment,
where is the expectation of distribution X,
is the mean of the
distribution and
is the standard deviation of the distribution.
Kernel$skewness(...)
...
Unused.
clone()
The objects of this class are cloneable with this method.
Kernel$clone(deep = FALSE)
deep
Whether to make a deep clone.
Mathematical and statistical functions for the Laplace distribution, which is commonly used in signal processing and finance.
The Laplace distribution parameterised with mean, , and scale,
, is defined by the pdf,
for and
.
Returns an R6 object inheriting from class SDistribution.
The distribution is supported on the Reals.
Lap(mean = 0, scale = 1)
N/A
N/A
distr6::Distribution
-> distr6::SDistribution
-> Laplace
name
Full name of distribution.
short_name
Short name of distribution for printing.
description
Brief description of the distribution.
alias
Alias of the distribution.
packages
Packages required to be installed in order to construct the distribution.
distr6::Distribution$cdf()
distr6::Distribution$confidence()
distr6::Distribution$correlation()
distr6::Distribution$getParameterValue()
distr6::Distribution$iqr()
distr6::Distribution$liesInSupport()
distr6::Distribution$liesInType()
distr6::Distribution$median()
distr6::Distribution$parameters()
distr6::Distribution$pdf()
distr6::Distribution$prec()
distr6::Distribution$print()
distr6::Distribution$quantile()
distr6::Distribution$rand()
distr6::Distribution$setParameterValue()
distr6::Distribution$stdev()
distr6::Distribution$strprint()
distr6::Distribution$summary()
distr6::Distribution$workingSupport()
new()
Creates a new instance of this R6 class.
Laplace$new(mean = NULL, scale = NULL, var = NULL, decorators = NULL)
mean
(numeric(1))
Mean of the distribution, defined on the Reals.
scale
(numeric(1))
Scale parameter, defined on the positive Reals.
var
(numeric(1))
Variance of the distribution, defined on the positive Reals. var = 2*scale^2
.
If var
is provided then scale
is ignored.
decorators
(character())
Decorators to add to the distribution during construction.
mean()
The arithmetic mean of a (discrete) probability distribution X is the expectation
with an integration analogue for continuous distributions.
Laplace$mean(...)
...
Unused.
mode()
The mode of a probability distribution is the point at which the pdf is a local maximum, a distribution can be unimodal (one maximum) or multimodal (several maxima).
Laplace$mode(which = "all")
which
(character(1) | numeric(1)
Ignored if distribution is unimodal. Otherwise "all"
returns all modes, otherwise specifies
which mode to return.
variance()
The variance of a distribution is defined by the formula
where is the expectation of distribution X. If the distribution is multivariate the
covariance matrix is returned.
Laplace$variance(...)
...
Unused.
skewness()
The skewness of a distribution is defined by the third standardised moment,
where is the expectation of distribution X,
is the mean of the
distribution and
is the standard deviation of the distribution.
Laplace$skewness(...)
...
Unused.
kurtosis()
The kurtosis of a distribution is defined by the fourth standardised moment,
where is the expectation of distribution X,
is the mean of the
distribution and
is the standard deviation of the distribution.
Excess Kurtosis is Kurtosis - 3.
Laplace$kurtosis(excess = TRUE, ...)
excess
(logical(1))
If TRUE
(default) excess kurtosis returned.
...
Unused.
entropy()
The entropy of a (discrete) distribution is defined by
where is the pdf of distribution X, with an integration analogue for
continuous distributions.
Laplace$entropy(base = 2, ...)
base
(integer(1))
Base of the entropy logarithm, default = 2 (Shannon entropy)
...
Unused.
mgf()
The moment generating function is defined by
where X is the distribution and is the expectation of the distribution X.
Laplace$mgf(t, ...)
t
(integer(1))
t integer to evaluate function at.
...
Unused.
cf()
The characteristic function is defined by
where X is the distribution and is the expectation of the distribution X.
Laplace$cf(t, ...)
t
(integer(1))
t integer to evaluate function at.
...
Unused.
pgf()
The probability generating function is defined by
where X is the distribution and is the expectation of the distribution X.
Laplace$pgf(z, ...)
z
(integer(1))
z integer to evaluate probability generating function at.
...
Unused.
clone()
The objects of this class are cloneable with this method.
Laplace$clone(deep = FALSE)
deep
Whether to make a deep clone.
McLaughlin, M. P. (2001). A compendium of common probability distributions (pp. 2014-01). Michael P. McLaughlin.
Other continuous distributions:
Arcsine
,
BetaNoncentral
,
Beta
,
Cauchy
,
ChiSquaredNoncentral
,
ChiSquared
,
Dirichlet
,
Erlang
,
Exponential
,
FDistributionNoncentral
,
FDistribution
,
Frechet
,
Gamma
,
Gompertz
,
Gumbel
,
InverseGamma
,
Logistic
,
Loglogistic
,
Lognormal
,
MultivariateNormal
,
Normal
,
Pareto
,
Poisson
,
Rayleigh
,
ShiftedLoglogistic
,
StudentTNoncentral
,
StudentT
,
Triangular
,
Uniform
,
Wald
,
Weibull
Other univariate distributions:
Arcsine
,
Arrdist
,
Bernoulli
,
BetaNoncentral
,
Beta
,
Binomial
,
Categorical
,
Cauchy
,
ChiSquaredNoncentral
,
ChiSquared
,
Degenerate
,
DiscreteUniform
,
Empirical
,
Erlang
,
Exponential
,
FDistributionNoncentral
,
FDistribution
,
Frechet
,
Gamma
,
Geometric
,
Gompertz
,
Gumbel
,
Hypergeometric
,
InverseGamma
,
Logarithmic
,
Logistic
,
Loglogistic
,
Lognormal
,
Matdist
,
NegativeBinomial
,
Normal
,
Pareto
,
Poisson
,
Rayleigh
,
ShiftedLoglogistic
,
StudentTNoncentral
,
StudentT
,
Triangular
,
Uniform
,
Wald
,
Weibull
,
WeightedDiscrete
Gets the number of distributions in an object inheriting from VectorDistribution.
## S3 method for class 'VectorDistribution' length(x)
## S3 method for class 'VectorDistribution' length(x)
x |
One of six plots can be selected to be superimposed in the plotting window, including: pdf, cdf, quantile, survival, hazard and cumulative hazard.
## S3 method for class 'Distribution' lines(x, fun, npoints = 3000, ...)
## S3 method for class 'Distribution' lines(x, fun, npoints = 3000, ...)
x |
|
fun |
vector of functions to plot, one or more of: "pdf","cdf","quantile", "survival", "hazard", and "cumhazard"; partial matching available. |
npoints |
number of evaluation points. |
... |
graphical parameters. |
Unlike the plot.Distribution
function, no internal checks are performed
to ensure that the added plot makes sense in the context of the current plotting window.
Therefore this function assumes that the current plot is of the same value support, see examples.
Chengyang Gao, Runlong Yu and Shuhan Liu
plot.Distribution
for plotting a distr6
object.
plot(Normal$new(mean = 2), "pdf") lines(Normal$new(mean = 3), "pdf", col = "red", lwd = 2) ## Not run: # The code below gives examples of how not to use this function. # Different value supports plot(Binomial$new(), "cdf") lines(Normal$new(), "cdf") # Different functions plot(Binomial$new(), "pdf") lines(Binomial$new(), "cdf") # Too many functions plot(Binomial$new(), c("pdf", "cdf")) lines(Binomial$new(), "cdf") ## End(Not run)
plot(Normal$new(mean = 2), "pdf") lines(Normal$new(mean = 3), "pdf", col = "red", lwd = 2) ## Not run: # The code below gives examples of how not to use this function. # Different value supports plot(Binomial$new(), "cdf") lines(Normal$new(), "cdf") # Different functions plot(Binomial$new(), "pdf") lines(Binomial$new(), "cdf") # Too many functions plot(Binomial$new(), c("pdf", "cdf")) lines(Binomial$new(), "cdf") ## End(Not run)
Lists decorators that can decorate an R6 Distribution.
listDecorators(simplify = TRUE)
listDecorators(simplify = TRUE)
simplify |
logical. If |
Either a list of characters (if simplify
is TRUE
) or a list of
DistributionDecorator classes.
listDecorators() listDecorators(FALSE)
listDecorators() listDecorators(FALSE)
Lists distr6 distributions in a data.table or a character vector, can be filtered by traits, implemented package, and tags.
listDistributions(simplify = FALSE, filter = NULL)
listDistributions(simplify = FALSE, filter = NULL)
simplify |
logical. If FALSE (default) returns distributions with traits as a data.table, otherwise returns distribution names as characters. |
filter |
list to filter distributions by. See examples. |
Either a list of characters (if simplify
is TRUE) or a data.table of
SDistribution
s and their traits.
listDistributions() # Filter list listDistributions(filter = list(VariateForm = "univariate")) # Filter is case-insensitive listDistributions(filter = list(VaLuESupport = "discrete")) # Multiple filters listDistributions(filter = list(VaLuESupport = "discrete", package = "extraDistr"))
listDistributions() # Filter list listDistributions(filter = list(VariateForm = "univariate")) # Filter is case-insensitive listDistributions(filter = list(VaLuESupport = "discrete")) # Multiple filters listDistributions(filter = list(VaLuESupport = "discrete", package = "extraDistr"))
Lists all implemented kernels in distr6.
listKernels(simplify = FALSE)
listKernels(simplify = FALSE)
simplify |
logical. If FALSE (default) returns kernels with support as a data.table, otherwise returns kernel names as characters. |
Either a list of characters (if simplify
is TRUE) or a data.table of
Kernel
s and their traits.
listKernels()
listKernels()
Lists wrappers that can wrap an R6 Distribution.
listWrappers(simplify = TRUE)
listWrappers(simplify = TRUE)
simplify |
logical. If TRUE (default) returns results as characters, otherwise as R6 classes. |
Either a list of characters (if simplify
is TRUE
) or a list of Wrapper
classes.
listWrappers() listWrappers(TRUE)
listWrappers() listWrappers(TRUE)
Mathematical and statistical functions for the Logarithmic distribution, which
is commonly used to model consumer purchase habits in economics and is derived from the Maclaurin series expansion of .
The Logarithmic distribution parameterised with a parameter, , is defined by the pmf,
for .
Returns an R6 object inheriting from class SDistribution.
The distribution is supported on .
Log(theta = 0.5)
N/A
N/A
distr6::Distribution
-> distr6::SDistribution
-> Logarithmic
name
Full name of distribution.
short_name
Short name of distribution for printing.
description
Brief description of the distribution.
alias
Alias of the distribution.
packages
Packages required to be installed in order to construct the distribution.
distr6::Distribution$cdf()
distr6::Distribution$confidence()
distr6::Distribution$correlation()
distr6::Distribution$getParameterValue()
distr6::Distribution$iqr()
distr6::Distribution$liesInSupport()
distr6::Distribution$liesInType()
distr6::Distribution$median()
distr6::Distribution$parameters()
distr6::Distribution$pdf()
distr6::Distribution$prec()
distr6::Distribution$print()
distr6::Distribution$quantile()
distr6::Distribution$rand()
distr6::Distribution$setParameterValue()
distr6::Distribution$stdev()
distr6::Distribution$strprint()
distr6::Distribution$summary()
distr6::Distribution$workingSupport()
new()
Creates a new instance of this R6 class.
Logarithmic$new(theta = NULL, decorators = NULL)
theta
(numeric(1))
Theta parameter defined as a probability between 0
and 1
.
decorators
(character())
Decorators to add to the distribution during construction.
mean()
The arithmetic mean of a (discrete) probability distribution X is the expectation
with an integration analogue for continuous distributions.
Logarithmic$mean(...)
...
Unused.
mode()
The mode of a probability distribution is the point at which the pdf is a local maximum, a distribution can be unimodal (one maximum) or multimodal (several maxima).
Logarithmic$mode(which = "all")
which
(character(1) | numeric(1)
Ignored if distribution is unimodal. Otherwise "all"
returns all modes, otherwise specifies
which mode to return.
variance()
The variance of a distribution is defined by the formula
where is the expectation of distribution X. If the distribution is multivariate the
covariance matrix is returned.
Logarithmic$variance(...)
...
Unused.
skewness()
The skewness of a distribution is defined by the third standardised moment,
where is the expectation of distribution X,
is the mean of the
distribution and
is the standard deviation of the distribution.
Logarithmic$skewness(...)
...
Unused.
kurtosis()
The kurtosis of a distribution is defined by the fourth standardised moment,
where is the expectation of distribution X,
is the mean of the
distribution and
is the standard deviation of the distribution.
Excess Kurtosis is Kurtosis - 3.
Logarithmic$kurtosis(excess = TRUE, ...)
excess
(logical(1))
If TRUE
(default) excess kurtosis returned.
...
Unused.
mgf()
The moment generating function is defined by
where X is the distribution and is the expectation of the distribution X.
Logarithmic$mgf(t, ...)
t
(integer(1))
t integer to evaluate function at.
...
Unused.
cf()
The characteristic function is defined by
where X is the distribution and is the expectation of the distribution X.
Logarithmic$cf(t, ...)
t
(integer(1))
t integer to evaluate function at.
...
Unused.
pgf()
The probability generating function is defined by
where X is the distribution and is the expectation of the distribution X.
Logarithmic$pgf(z, ...)
z
(integer(1))
z integer to evaluate probability generating function at.
...
Unused.
clone()
The objects of this class are cloneable with this method.
Logarithmic$clone(deep = FALSE)
deep
Whether to make a deep clone.
McLaughlin, M. P. (2001). A compendium of common probability distributions (pp. 2014-01). Michael P. McLaughlin.
Other discrete distributions:
Arrdist
,
Bernoulli
,
Binomial
,
Categorical
,
Degenerate
,
DiscreteUniform
,
EmpiricalMV
,
Empirical
,
Geometric
,
Hypergeometric
,
Matdist
,
Multinomial
,
NegativeBinomial
,
WeightedDiscrete
Other univariate distributions:
Arcsine
,
Arrdist
,
Bernoulli
,
BetaNoncentral
,
Beta
,
Binomial
,
Categorical
,
Cauchy
,
ChiSquaredNoncentral
,
ChiSquared
,
Degenerate
,
DiscreteUniform
,
Empirical
,
Erlang
,
Exponential
,
FDistributionNoncentral
,
FDistribution
,
Frechet
,
Gamma
,
Geometric
,
Gompertz
,
Gumbel
,
Hypergeometric
,
InverseGamma
,
Laplace
,
Logistic
,
Loglogistic
,
Lognormal
,
Matdist
,
NegativeBinomial
,
Normal
,
Pareto
,
Poisson
,
Rayleigh
,
ShiftedLoglogistic
,
StudentTNoncentral
,
StudentT
,
Triangular
,
Uniform
,
Wald
,
Weibull
,
WeightedDiscrete
Mathematical and statistical functions for the Logistic distribution, which is commonly used in logistic regression and feedforward neural networks.
The Logistic distribution parameterised with mean, , and scale,
, is defined by the pdf,
for and
.
Returns an R6 object inheriting from class SDistribution.
The distribution is supported on the Reals.
Logis(mean = 0, scale = 1)
N/A
N/A
distr6::Distribution
-> distr6::SDistribution
-> Logistic
name
Full name of distribution.
short_name
Short name of distribution for printing.
description
Brief description of the distribution.
alias
Alias of the distribution.
packages
Packages required to be installed in order to construct the distribution.
distr6::Distribution$cdf()
distr6::Distribution$confidence()
distr6::Distribution$correlation()
distr6::Distribution$getParameterValue()
distr6::Distribution$iqr()
distr6::Distribution$liesInSupport()
distr6::Distribution$liesInType()
distr6::Distribution$median()
distr6::Distribution$parameters()
distr6::Distribution$pdf()
distr6::Distribution$prec()
distr6::Distribution$print()
distr6::Distribution$quantile()
distr6::Distribution$rand()
distr6::Distribution$setParameterValue()
distr6::Distribution$stdev()
distr6::Distribution$strprint()
distr6::Distribution$summary()
distr6::Distribution$workingSupport()
new()
Creates a new instance of this R6 class.
Logistic$new(mean = NULL, scale = NULL, sd = NULL, decorators = NULL)
mean
(numeric(1))
Mean of the distribution, defined on the Reals.
scale
(numeric(1))
Scale parameter, defined on the positive Reals.
sd
(numeric(1))
Standard deviation of the distribution as an alternate scale parameter,
sd = scale*pi/sqrt(3)
. If given then scale
is ignored.
decorators
(character())
Decorators to add to the distribution during construction.
mean()
The arithmetic mean of a (discrete) probability distribution X is the expectation
with an integration analogue for continuous distributions.
Logistic$mean(...)
...
Unused.
mode()
The mode of a probability distribution is the point at which the pdf is a local maximum, a distribution can be unimodal (one maximum) or multimodal (several maxima).
Logistic$mode(which = "all")
which
(character(1) | numeric(1)
Ignored if distribution is unimodal. Otherwise "all"
returns all modes, otherwise specifies
which mode to return.
variance()
The variance of a distribution is defined by the formula
where is the expectation of distribution X. If the distribution is multivariate the
covariance matrix is returned.
Logistic$variance(...)
...
Unused.
skewness()
The skewness of a distribution is defined by the third standardised moment,
where is the expectation of distribution X,
is the mean of the
distribution and
is the standard deviation of the distribution.
Logistic$skewness(...)
...
Unused.
kurtosis()
The kurtosis of a distribution is defined by the fourth standardised moment,
where is the expectation of distribution X,
is the mean of the
distribution and
is the standard deviation of the distribution.
Excess Kurtosis is Kurtosis - 3.
Logistic$kurtosis(excess = TRUE, ...)
excess
(logical(1))
If TRUE
(default) excess kurtosis returned.
...
Unused.
entropy()
The entropy of a (discrete) distribution is defined by
where is the pdf of distribution X, with an integration analogue for
continuous distributions.
Logistic$entropy(base = 2, ...)
base
(integer(1))
Base of the entropy logarithm, default = 2 (Shannon entropy)
...
Unused.
mgf()
The moment generating function is defined by
where X is the distribution and is the expectation of the distribution X.
Logistic$mgf(t, ...)
t
(integer(1))
t integer to evaluate function at.
...
Unused.
cf()
The characteristic function is defined by
where X is the distribution and is the expectation of the distribution X.
Logistic$cf(t, ...)
t
(integer(1))
t integer to evaluate function at.
...
Unused.
pgf()
The probability generating function is defined by
where X is the distribution and is the expectation of the distribution X.
Logistic$pgf(z, ...)
z
(integer(1))
z integer to evaluate probability generating function at.
...
Unused.
clone()
The objects of this class are cloneable with this method.
Logistic$clone(deep = FALSE)
deep
Whether to make a deep clone.
McLaughlin, M. P. (2001). A compendium of common probability distributions (pp. 2014-01). Michael P. McLaughlin.
Other continuous distributions:
Arcsine
,
BetaNoncentral
,
Beta
,
Cauchy
,
ChiSquaredNoncentral
,
ChiSquared
,
Dirichlet
,
Erlang
,
Exponential
,
FDistributionNoncentral
,
FDistribution
,
Frechet
,
Gamma
,
Gompertz
,
Gumbel
,
InverseGamma
,
Laplace
,
Loglogistic
,
Lognormal
,
MultivariateNormal
,
Normal
,
Pareto
,
Poisson
,
Rayleigh
,
ShiftedLoglogistic
,
StudentTNoncentral
,
StudentT
,
Triangular
,
Uniform
,
Wald
,
Weibull
Other univariate distributions:
Arcsine
,
Arrdist
,
Bernoulli
,
BetaNoncentral
,
Beta
,
Binomial
,
Categorical
,
Cauchy
,
ChiSquaredNoncentral
,
ChiSquared
,
Degenerate
,
DiscreteUniform
,
Empirical
,
Erlang
,
Exponential
,
FDistributionNoncentral
,
FDistribution
,
Frechet
,
Gamma
,
Geometric
,
Gompertz
,
Gumbel
,
Hypergeometric
,
InverseGamma
,
Laplace
,
Logarithmic
,
Loglogistic
,
Lognormal
,
Matdist
,
NegativeBinomial
,
Normal
,
Pareto
,
Poisson
,
Rayleigh
,
ShiftedLoglogistic
,
StudentTNoncentral
,
StudentT
,
Triangular
,
Uniform
,
Wald
,
Weibull
,
WeightedDiscrete
Mathematical and statistical functions for the LogisticKernel kernel defined by the pdf,
over the support .
distr6::Distribution
-> distr6::Kernel
-> LogisticKernel
name
Full name of distribution.
short_name
Short name of distribution for printing.
description
Brief description of the distribution.
distr6::Distribution$cdf()
distr6::Distribution$confidence()
distr6::Distribution$correlation()
distr6::Distribution$getParameterValue()
distr6::Distribution$iqr()
distr6::Distribution$liesInSupport()
distr6::Distribution$liesInType()
distr6::Distribution$parameters()
distr6::Distribution$pdf()
distr6::Distribution$prec()
distr6::Distribution$print()
distr6::Distribution$quantile()
distr6::Distribution$rand()
distr6::Distribution$setParameterValue()
distr6::Distribution$stdev()
distr6::Distribution$strprint()
distr6::Distribution$summary()
distr6::Distribution$workingSupport()
distr6::Kernel$mean()
distr6::Kernel$median()
distr6::Kernel$mode()
distr6::Kernel$skewness()
new()
Creates a new instance of this R6 class.
LogisticKernel$new(decorators = NULL)
decorators
(character())
Decorators to add to the distribution during construction.
pdfSquared2Norm()
The squared 2-norm of the pdf is defined by
where X is the Distribution, is its pdf and
are the distribution support limits.
LogisticKernel$pdfSquared2Norm(x = 0, upper = Inf)
x
(numeric(1))
Amount to shift the result.
upper
(numeric(1))
Upper limit of the integral.
cdfSquared2Norm()
The squared 2-norm of the cdf is defined by
where X is the Distribution, is its pdf and
are the distribution support limits.
LogisticKernel$cdfSquared2Norm(x = 0, upper = 0)
x
(numeric(1))
Amount to shift the result.
upper
(numeric(1))
Upper limit of the integral.
variance()
The variance of a distribution is defined by the formula
where is the expectation of distribution X. If the distribution is multivariate the
covariance matrix is returned.
LogisticKernel$variance(...)
...
Unused.
clone()
The objects of this class are cloneable with this method.
LogisticKernel$clone(deep = FALSE)
deep
Whether to make a deep clone.
Other kernels:
Cosine
,
Epanechnikov
,
NormalKernel
,
Quartic
,
Sigmoid
,
Silverman
,
TriangularKernel
,
Tricube
,
Triweight
,
UniformKernel
Mathematical and statistical functions for the Log-Logistic distribution, which is commonly used in survival analysis for its non-monotonic hazard as well as in economics.
The Log-Logistic distribution parameterised with shape, , and scale,
is defined by the pdf,
for .
Returns an R6 object inheriting from class SDistribution.
The distribution is supported on the non-negative Reals.
LLogis(scale = 1, shape = 1)
N/A
Also known as the Fisk distribution.
distr6::Distribution
-> distr6::SDistribution
-> Loglogistic
name
Full name of distribution.
short_name
Short name of distribution for printing.
description
Brief description of the distribution.
alias
Alias of the distribution.
packages
Packages required to be installed in order to construct the distribution.
distr6::Distribution$cdf()
distr6::Distribution$confidence()
distr6::Distribution$correlation()
distr6::Distribution$getParameterValue()
distr6::Distribution$iqr()
distr6::Distribution$liesInSupport()
distr6::Distribution$liesInType()
distr6::Distribution$parameters()
distr6::Distribution$pdf()
distr6::Distribution$prec()
distr6::Distribution$print()
distr6::Distribution$quantile()
distr6::Distribution$rand()
distr6::Distribution$setParameterValue()
distr6::Distribution$stdev()
distr6::Distribution$strprint()
distr6::Distribution$summary()
distr6::Distribution$workingSupport()
new()
Creates a new instance of this R6 class.
Loglogistic$new(scale = NULL, shape = NULL, rate = NULL, decorators = NULL)
scale
(numeric(1))
Scale parameter, defined on the positive Reals.
shape
(numeric(1))
Shape parameter, defined on the positive Reals.
rate
(numeric(1))
Alternate scale parameter, rate = 1/scale
. If given then scale
is ignored.
decorators
(character())
Decorators to add to the distribution during construction.
mean()
The arithmetic mean of a (discrete) probability distribution X is the expectation
with an integration analogue for continuous distributions.
Loglogistic$mean(...)
...
Unused.
mode()
The mode of a probability distribution is the point at which the pdf is a local maximum, a distribution can be unimodal (one maximum) or multimodal (several maxima).
Loglogistic$mode(which = "all")
which
(character(1) | numeric(1)
Ignored if distribution is unimodal. Otherwise "all"
returns all modes, otherwise specifies
which mode to return.
median()
Returns the median of the distribution. If an analytical expression is available
returns distribution median, otherwise if symmetric returns self$mean
, otherwise
returns self$quantile(0.5)
.
Loglogistic$median()
variance()
The variance of a distribution is defined by the formula
where is the expectation of distribution X. If the distribution is multivariate the
covariance matrix is returned.
Loglogistic$variance(...)
...
Unused.
skewness()
The skewness of a distribution is defined by the third standardised moment,
where is the expectation of distribution X,
is the mean of the
distribution and
is the standard deviation of the distribution.
Loglogistic$skewness(...)
...
Unused.
kurtosis()
The kurtosis of a distribution is defined by the fourth standardised moment,
where is the expectation of distribution X,
is the mean of the
distribution and
is the standard deviation of the distribution.
Excess Kurtosis is Kurtosis - 3.
Loglogistic$kurtosis(excess = TRUE, ...)
excess
(logical(1))
If TRUE
(default) excess kurtosis returned.
...
Unused.
pgf()
The probability generating function is defined by
where X is the distribution and is the expectation of the distribution X.
Loglogistic$pgf(z, ...)
z
(integer(1))
z integer to evaluate probability generating function at.
...
Unused.
clone()
The objects of this class are cloneable with this method.
Loglogistic$clone(deep = FALSE)
deep
Whether to make a deep clone.
McLaughlin, M. P. (2001). A compendium of common probability distributions (pp. 2014-01). Michael P. McLaughlin.
Other continuous distributions:
Arcsine
,
BetaNoncentral
,
Beta
,
Cauchy
,
ChiSquaredNoncentral
,
ChiSquared
,
Dirichlet
,
Erlang
,
Exponential
,
FDistributionNoncentral
,
FDistribution
,
Frechet
,
Gamma
,
Gompertz
,
Gumbel
,
InverseGamma
,
Laplace
,
Logistic
,
Lognormal
,
MultivariateNormal
,
Normal
,
Pareto
,
Poisson
,
Rayleigh
,
ShiftedLoglogistic
,
StudentTNoncentral
,
StudentT
,
Triangular
,
Uniform
,
Wald
,
Weibull
Other univariate distributions:
Arcsine
,
Arrdist
,
Bernoulli
,
BetaNoncentral
,
Beta
,
Binomial
,
Categorical
,
Cauchy
,
ChiSquaredNoncentral
,
ChiSquared
,
Degenerate
,
DiscreteUniform
,
Empirical
,
Erlang
,
Exponential
,
FDistributionNoncentral
,
FDistribution
,
Frechet
,
Gamma
,
Geometric
,
Gompertz
,
Gumbel
,
Hypergeometric
,
InverseGamma
,
Laplace
,
Logarithmic
,
Logistic
,
Lognormal
,
Matdist
,
NegativeBinomial
,
Normal
,
Pareto
,
Poisson
,
Rayleigh
,
ShiftedLoglogistic
,
StudentTNoncentral
,
StudentT
,
Triangular
,
Uniform
,
Wald
,
Weibull
,
WeightedDiscrete
Mathematical and statistical functions for the Log-Normal distribution, which is commonly used to model many natural phenomena as a result of growth driven by small percentage changes.
The Log-Normal distribution parameterised with logmean, , and logvar,
, is defined by the pdf,
for and
.
Returns an R6 object inheriting from class SDistribution.
The distribution is supported on the Positive Reals.
Lnorm(meanlog = 0, varlog = 1)
N/A
Also known as the Log-Gaussian distribution.
distr6::Distribution
-> distr6::SDistribution
-> Lognormal
name
Full name of distribution.
short_name
Short name of distribution for printing.
description
Brief description of the distribution.
alias
Alias of the distribution.
packages
Packages required to be installed in order to construct the distribution.
distr6::Distribution$cdf()
distr6::Distribution$confidence()
distr6::Distribution$correlation()
distr6::Distribution$getParameterValue()
distr6::Distribution$iqr()
distr6::Distribution$liesInSupport()
distr6::Distribution$liesInType()
distr6::Distribution$parameters()
distr6::Distribution$pdf()
distr6::Distribution$prec()
distr6::Distribution$print()
distr6::Distribution$quantile()
distr6::Distribution$rand()
distr6::Distribution$setParameterValue()
distr6::Distribution$stdev()
distr6::Distribution$strprint()
distr6::Distribution$summary()
distr6::Distribution$workingSupport()
new()
Creates a new instance of this R6 class.
Lognormal$new( meanlog = NULL, varlog = NULL, sdlog = NULL, preclog = NULL, mean = NULL, var = NULL, sd = NULL, prec = NULL, decorators = NULL )
meanlog
(numeric(1))
Mean of the distribution on the log scale, defined on the Reals.
varlog
(numeric(1))
Variance of the distribution on the log scale, defined on the positive Reals.
sdlog
(numeric(1))
Standard deviation of the distribution on the log scale, defined on the positive Reals.
. If preclog
missing and sdlog
given then all other parameters
except meanlog
are ignored.
preclog
(numeric(1))
Precision of the distribution on the log scale, defined on the positive Reals.
. If given then all other parameters except meanlog
are ignored.
mean
(numeric(1))
Mean of the distribution on the natural scale, defined on the positive Reals.
var
(numeric(1))
Variance of the distribution on the natural scale, defined on the positive Reals.
sd
(numeric(1))
Standard deviation of the distribution on the natural scale, defined on the positive Reals.
. If prec
missing and sd
given then all other parameters except
mean
are ignored.
prec
(numeric(1))
Precision of the distribution on the natural scale, defined on the Reals.
. If given then all other parameters except mean
are ignored.
decorators
(character())
Decorators to add to the distribution during construction.
Lognormal$new(var = 2, mean = 1) Lognormal$new(meanlog = 2, preclog = 5)
mean()
The arithmetic mean of a (discrete) probability distribution X is the expectation
with an integration analogue for continuous distributions.
Lognormal$mean(...)
...
Unused.
mode()
The mode of a probability distribution is the point at which the pdf is a local maximum, a distribution can be unimodal (one maximum) or multimodal (several maxima).
Lognormal$mode(which = "all")
which
(character(1) | numeric(1)
Ignored if distribution is unimodal. Otherwise "all"
returns all modes, otherwise specifies
which mode to return.
...
Unused.
median()
Returns the median of the distribution. If an analytical expression is available
returns distribution median, otherwise if symmetric returns self$mean
, otherwise
returns self$quantile(0.5)
.
Lognormal$median()
variance()
The variance of a distribution is defined by the formula
where is the expectation of distribution X. If the distribution is multivariate the
covariance matrix is returned.
Lognormal$variance(...)
...
Unused.
skewness()
The skewness of a distribution is defined by the third standardised moment,
where is the expectation of distribution X,
is the mean of the
distribution and
is the standard deviation of the distribution.
Lognormal$skewness(...)
...
Unused.
kurtosis()
The kurtosis of a distribution is defined by the fourth standardised moment,
where is the expectation of distribution X,
is the mean of the
distribution and
is the standard deviation of the distribution.
Excess Kurtosis is Kurtosis - 3.
Lognormal$kurtosis(excess = TRUE, ...)
excess
(logical(1))
If TRUE
(default) excess kurtosis returned.
...
Unused.
entropy()
The entropy of a (discrete) distribution is defined by
where is the pdf of distribution X, with an integration analogue for
continuous distributions.
Lognormal$entropy(base = 2, ...)
base
(integer(1))
Base of the entropy logarithm, default = 2 (Shannon entropy)
...
Unused.
mgf()
The moment generating function is defined by
where X is the distribution and is the expectation of the distribution X.
Lognormal$mgf(t, ...)
t
(integer(1))
t integer to evaluate function at.
...
Unused.
pgf()
The probability generating function is defined by
where X is the distribution and is the expectation of the distribution X.
Lognormal$pgf(z, ...)
z
(integer(1))
z integer to evaluate probability generating function at.
...
Unused.
clone()
The objects of this class are cloneable with this method.
Lognormal$clone(deep = FALSE)
deep
Whether to make a deep clone.
McLaughlin, M. P. (2001). A compendium of common probability distributions (pp. 2014-01). Michael P. McLaughlin.
Other continuous distributions:
Arcsine
,
BetaNoncentral
,
Beta
,
Cauchy
,
ChiSquaredNoncentral
,
ChiSquared
,
Dirichlet
,
Erlang
,
Exponential
,
FDistributionNoncentral
,
FDistribution
,
Frechet
,
Gamma
,
Gompertz
,
Gumbel
,
InverseGamma
,
Laplace
,
Logistic
,
Loglogistic
,
MultivariateNormal
,
Normal
,
Pareto
,
Poisson
,
Rayleigh
,
ShiftedLoglogistic
,
StudentTNoncentral
,
StudentT
,
Triangular
,
Uniform
,
Wald
,
Weibull
Other univariate distributions:
Arcsine
,
Arrdist
,
Bernoulli
,
BetaNoncentral
,
Beta
,
Binomial
,
Categorical
,
Cauchy
,
ChiSquaredNoncentral
,
ChiSquared
,
Degenerate
,
DiscreteUniform
,
Empirical
,
Erlang
,
Exponential
,
FDistributionNoncentral
,
FDistribution
,
Frechet
,
Gamma
,
Geometric
,
Gompertz
,
Gumbel
,
Hypergeometric
,
InverseGamma
,
Laplace
,
Logarithmic
,
Logistic
,
Loglogistic
,
Matdist
,
NegativeBinomial
,
Normal
,
Pareto
,
Poisson
,
Rayleigh
,
ShiftedLoglogistic
,
StudentTNoncentral
,
StudentT
,
Triangular
,
Uniform
,
Wald
,
Weibull
,
WeightedDiscrete
## ------------------------------------------------ ## Method `Lognormal$new` ## ------------------------------------------------ Lognormal$new(var = 2, mean = 1) Lognormal$new(meanlog = 2, preclog = 5)
## ------------------------------------------------ ## Method `Lognormal$new` ## ------------------------------------------------ Lognormal$new(var = 2, mean = 1) Lognormal$new(meanlog = 2, preclog = 5)
Helper function to lapply over the given distribution list, and make the
short_name
s unique.
makeUniqueDistributions(distlist)
makeUniqueDistributions(distlist)
distlist |
list of Distributions. |
The short_name
s are made unique by suffixing each with a consecutive
number so that the names are no longer duplicated.
The list of inputted distributions except with the short_name
s manipulated as
necessary to make them unique.
makeUniqueDistributions(list(Binomial$new(), Binomial$new()))
makeUniqueDistributions(list(Binomial$new(), Binomial$new()))
Mathematical and statistical functions for the Matdist distribution, which is commonly used in vectorised empirical estimators such as Kaplan-Meier.
The Matdist distribution is defined by the pmf,
for .
This is a special case distribution in distr6 which is technically a vectorised distribution
but is treated as if it is not. Therefore we only allow evaluation of all functions at
the same value, e.g. $pdf(1:2)
evaluates all samples at '1' and '2'.
Sampling from this distribution is performed with the sample function with the elements given as the x values and the pdf as the probabilities. The cdf and quantile assume that the elements are supplied in an indexed order (otherwise the results are meaningless).
Returns an R6 object inheriting from class SDistribution.
The distribution is supported on .
Matdist(matrix(0.5, 2, 2, dimnames = list(NULL, 1:2)))
N/A
N/A
distr6::Distribution
-> distr6::SDistribution
-> Matdist
name
Full name of distribution.
short_name
Short name of distribution for printing.
description
Brief description of the distribution.
alias
Alias of the distribution.
properties
Returns distribution properties, including skewness type and symmetry.
distr6::Distribution$cdf()
distr6::Distribution$confidence()
distr6::Distribution$correlation()
distr6::Distribution$getParameterValue()
distr6::Distribution$iqr()
distr6::Distribution$liesInSupport()
distr6::Distribution$liesInType()
distr6::Distribution$parameters()
distr6::Distribution$pdf()
distr6::Distribution$prec()
distr6::Distribution$print()
distr6::Distribution$quantile()
distr6::Distribution$rand()
distr6::Distribution$setParameterValue()
distr6::Distribution$stdev()
distr6::Distribution$summary()
distr6::Distribution$workingSupport()
new()
Creates a new instance of this R6 class.
Matdist$new(pdf = NULL, cdf = NULL, decorators = NULL)
pdf
numeric()
Probability mass function for corresponding samples, should be same length x
.
If cdf
is not given then calculated as cumsum(pdf)
.
cdf
numeric()
Cumulative distribution function for corresponding samples, should be same length x
. If
given then pdf
calculated as difference of cdf
s.
decorators
(character())
Decorators to add to the distribution during construction.
x
numeric()
Data samples, must be ordered in ascending order.
strprint()
Printable string representation of the Distribution
. Primarily used internally.
Matdist$strprint(n = 2)
n
(integer(1))
Ignored.
mean()
The arithmetic mean of a (discrete) probability distribution X is the expectation
with an integration analogue for continuous distributions. If distribution is improper (F(Inf) != 1, then E_X(x) = Inf).
Matdist$mean(...)
...
Unused.
median()
Returns the median of the distribution. If an analytical expression is available
returns distribution median, otherwise if symmetric returns self$mean
, otherwise
returns self$quantile(0.5)
.
Matdist$median()
mode()
The mode of a probability distribution is the point at which the pdf is a local maximum, a distribution can be unimodal (one maximum) or multimodal (several maxima).
Matdist$mode(which = 1)
which
(character(1) | numeric(1)
Ignored if distribution is unimodal. Otherwise "all"
returns all modes, otherwise specifies
which mode to return.
variance()
The variance of a distribution is defined by the formula
where is the expectation of distribution X. If the distribution is multivariate the
covariance matrix is returned.
If distribution is improper (F(Inf) != 1, then var_X(x) = Inf).
Matdist$variance(...)
...
Unused.
skewness()
The skewness of a distribution is defined by the third standardised moment,
where is the expectation of distribution X,
is the mean of the
distribution and
is the standard deviation of the distribution.
If distribution is improper (F(Inf) != 1, then sk_X(x) = Inf).
Matdist$skewness(...)
...
Unused.
kurtosis()
The kurtosis of a distribution is defined by the fourth standardised moment,
where is the expectation of distribution X,
is the mean of the
distribution and
is the standard deviation of the distribution.
Excess Kurtosis is Kurtosis - 3.
If distribution is improper (F(Inf) != 1, then k_X(x) = Inf).
Matdist$kurtosis(excess = TRUE, ...)
excess
(logical(1))
If TRUE
(default) excess kurtosis returned.
...
Unused.
entropy()
The entropy of a (discrete) distribution is defined by
where is the pdf of distribution X, with an integration analogue for
continuous distributions.
If distribution is improper then entropy is Inf.
Matdist$entropy(base = 2, ...)
base
(integer(1))
Base of the entropy logarithm, default = 2 (Shannon entropy)
...
Unused.
mgf()
The moment generating function is defined by
where X is the distribution and is the expectation of the distribution X.
If distribution is improper (F(Inf) != 1, then mgf_X(x) = Inf).
Matdist$mgf(t, ...)
t
(integer(1))
t integer to evaluate function at.
...
Unused.
cf()
The characteristic function is defined by
where X is the distribution and is the expectation of the distribution X.
If distribution is improper (F(Inf) != 1, then cf_X(x) = Inf).
Matdist$cf(t, ...)
t
(integer(1))
t integer to evaluate function at.
...
Unused.
pgf()
The probability generating function is defined by
where X is the distribution and is the expectation of the distribution X.
If distribution is improper (F(Inf) != 1, then pgf_X(x) = Inf).
Matdist$pgf(z, ...)
z
(integer(1))
z integer to evaluate probability generating function at.
...
Unused.
clone()
The objects of this class are cloneable with this method.
Matdist$clone(deep = FALSE)
deep
Whether to make a deep clone.
McLaughlin, M. P. (2001). A compendium of common probability distributions (pp. 2014-01). Michael P. McLaughlin.
Other discrete distributions:
Arrdist
,
Bernoulli
,
Binomial
,
Categorical
,
Degenerate
,
DiscreteUniform
,
EmpiricalMV
,
Empirical
,
Geometric
,
Hypergeometric
,
Logarithmic
,
Multinomial
,
NegativeBinomial
,
WeightedDiscrete
Other univariate distributions:
Arcsine
,
Arrdist
,
Bernoulli
,
BetaNoncentral
,
Beta
,
Binomial
,
Categorical
,
Cauchy
,
ChiSquaredNoncentral
,
ChiSquared
,
Degenerate
,
DiscreteUniform
,
Empirical
,
Erlang
,
Exponential
,
FDistributionNoncentral
,
FDistribution
,
Frechet
,
Gamma
,
Geometric
,
Gompertz
,
Gumbel
,
Hypergeometric
,
InverseGamma
,
Laplace
,
Logarithmic
,
Logistic
,
Loglogistic
,
Lognormal
,
NegativeBinomial
,
Normal
,
Pareto
,
Poisson
,
Rayleigh
,
ShiftedLoglogistic
,
StudentTNoncentral
,
StudentT
,
Triangular
,
Uniform
,
Wald
,
Weibull
,
WeightedDiscrete
x <- Matdist$new(pdf = matrix(0.5, 3, 2, dimnames = list(NULL, 1:2))) Matdist$new(cdf = matrix(c(0.5, 1), 3, 2, TRUE, dimnames = list(NULL, 1:2))) # equivalently # d/p/q/r x$pdf(1:5) x$cdf(1:5) # Assumes ordered in construction x$quantile(0.42) # Assumes ordered in construction x$rand(10) # Statistics x$mean() x$variance() summary(x)
x <- Matdist$new(pdf = matrix(0.5, 3, 2, dimnames = list(NULL, 1:2))) Matdist$new(cdf = matrix(c(0.5, 1), 3, 2, TRUE, dimnames = list(NULL, 1:2))) # equivalently # d/p/q/r x$pdf(1:5) x$cdf(1:5) # Assumes ordered in construction x$quantile(0.42) # Assumes ordered in construction x$rand(10) # Statistics x$mean() x$variance() summary(x)
Given m
matrix distributions distributions of length N
,
creates a new Matdist by summing over the weighted cdfs. Note that this
method does not create a MixtureDistribution but a new Matdist.
Assumes Matrix distributions have the same number of columns, otherwise use
mixturiseVector(lapply(mds, as.VectorDistribution))
.
mixMatrix(mds, weights = "uniform")
mixMatrix(mds, weights = "uniform")
mds |
|
weights |
|
This method returns a new Matdist which is less flexible than a
MixtureDistribution which has parameters (i.e. weights
) that can be
updated after construction.
Also works for Arrdists, where we convert these to Matdists, based on the
which.curve
initialization parameter.
m1 <- as.Distribution( t(apply(matrix(runif(25), 5, 5, FALSE, list(NULL, 1:5)), 1, function(x) x / sum(x))), fun = "pdf" ) m2 <- as.Distribution( t(apply(matrix(runif(25), 5, 5, FALSE, list(NULL, 1:5)), 1, function(x) x / sum(x))), fun = "pdf" ) # uniform mixing m3 <- mixMatrix(list(m1, m2)) # un-uniform mixing m4 <- mixMatrix(list(m1, m2), weights = c(0.1, 0.9)) m1$cdf(3) m2$cdf(3) m3$cdf(3) m4$cdf(3)
m1 <- as.Distribution( t(apply(matrix(runif(25), 5, 5, FALSE, list(NULL, 1:5)), 1, function(x) x / sum(x))), fun = "pdf" ) m2 <- as.Distribution( t(apply(matrix(runif(25), 5, 5, FALSE, list(NULL, 1:5)), 1, function(x) x / sum(x))), fun = "pdf" ) # uniform mixing m3 <- mixMatrix(list(m1, m2)) # un-uniform mixing m4 <- mixMatrix(list(m1, m2), weights = c(0.1, 0.9)) m1$cdf(3) m2$cdf(3) m3$cdf(3) m4$cdf(3)
Wrapper used to construct a mixture of two or more distributions.
A mixture distribution is defined by
#nolint
where is the cdf of the mixture distribution,
are
independent distributions, and
are weights for the mixture.
distr6::Distribution
-> distr6::DistributionWrapper
-> distr6::VectorDistribution
-> MixtureDistribution
distr6::Distribution$confidence()
distr6::Distribution$correlation()
distr6::Distribution$iqr()
distr6::Distribution$liesInSupport()
distr6::Distribution$liesInType()
distr6::Distribution$parameters()
distr6::Distribution$prec()
distr6::Distribution$print()
distr6::Distribution$setParameterValue()
distr6::Distribution$stdev()
distr6::Distribution$summary()
distr6::Distribution$workingSupport()
distr6::VectorDistribution$cf()
distr6::VectorDistribution$entropy()
distr6::VectorDistribution$getParameterValue()
distr6::VectorDistribution$kurtosis()
distr6::VectorDistribution$mean()
distr6::VectorDistribution$median()
distr6::VectorDistribution$mgf()
distr6::VectorDistribution$mode()
distr6::VectorDistribution$pgf()
distr6::VectorDistribution$skewness()
distr6::VectorDistribution$variance()
distr6::VectorDistribution$wrappedModels()
new()
Creates a new instance of this R6 class.
MixtureDistribution$new( distlist = NULL, weights = "uniform", distribution = NULL, params = NULL, shared_params = NULL, name = NULL, short_name = NULL, decorators = NULL, vecdist = NULL, ids = NULL )
distlist
(list())
List of Distributions.
weights
(character(1)|numeric())
Weights to use in the resulting mixture. If all distributions are weighted equally then
"uniform"
provides a much faster implementation, otherwise a vector of length equal
to the number of wrapped distributions, this is automatically scaled internally.
distribution
(character(1))
Should be supplied with params
and optionally shared_params
as an alternative to distlist
.
Much faster implementation when only one class of distribution is being wrapped. distribution
is the full name of one of the distributions in listDistributions()
, or "Distribution"
if
constructing custom distributions. See examples in VectorDistribution.
params
(list()|data.frame())
Parameters in the individual distributions for use with distribution
. Can be supplied as a list,
where each element is the list of parameters to set in the distribution, or as an object
coercable to data.frame
, where each column is a parameter and each row is a distribution.
See examples in VectorDistribution.
shared_params
(list())
If any parameters are shared when using the distribution
constructor, this provides a much faster
implementation to list and query them together. See examples in VectorDistribution.
name
(character(1))
Optional name of wrapped distribution.
short_name
(character(1))
Optional short name/ID of wrapped distribution.
decorators
(character())
Decorators to add to the distribution during construction.
vecdist
VectorDistribution
Alternative constructor to directly create this object from an object inheriting from
VectorDistribution.
ids
(character())
Optional ids for wrapped distributions in vector, should be unique and of same length as
the number of distributions.
MixtureDistribution$new(list(Binomial$new(prob = 0.5, size = 10), Binomial$new()), weights = c(0.2, 0.8) )
strprint()
Printable string representation of the MixtureDistribution
. Primarily used internally.
MixtureDistribution$strprint(n = 10)
n
(integer(1))
Number of distributions to include when printing.
pdf()
Probability density function of the mixture distribution. Computed by
where is the vector of weights and
are the pdfs of the wrapped
distributions.
Note that as this class inherits from VectorDistribution, it is possible to evaluate the distributions at different points, but that this is not the usual use-case for mixture distributions.
MixtureDistribution$pdf(..., log = FALSE, simplify = TRUE, data = NULL)
...
(numeric())
Points to evaluate the function at Arguments do not need
to be named. The length of each argument corresponds to the number of points to evaluate,
the number of arguments corresponds to the number of variables in the distribution.
See examples.
log
(logical(1))
If TRUE
returns the logarithm of the probabilities. Default is FALSE
.
simplify
logical(1)
If TRUE
(default) simplifies the return if possible to a numeric
, otherwise returns a
data.table::data.table.
data
array
Alternative method to specify points to evaluate. If univariate then rows correspond with number
of points to evaluate and columns correspond with number of variables to evaluate. In the special
case of VectorDistributions of multivariate distributions, then the third dimension corresponds
to the distribution in the vector to evaluate.
m <- MixtureDistribution$new(list(Binomial$new(prob = 0.5, size = 10), Binomial$new()), weights = c(0.2, 0.8) ) m$pdf(1:5) m$pdf(1) # also possible but unlikely to be used m$pdf(1, 2)
cdf()
Cumulative distribution function of the mixture distribution. Computed by
where is the vector of weights and
are the cdfs of the wrapped
distributions.
MixtureDistribution$cdf( ..., lower.tail = TRUE, log.p = FALSE, simplify = TRUE, data = NULL )
...
(numeric())
Points to evaluate the function at Arguments do not need
to be named. The length of each argument corresponds to the number of points to evaluate,
the number of arguments corresponds to the number of variables in the distribution.
See examples.
@examples
m <- MixtureDistribution$new(list(Binomial$new(prob = 0.5, size = 10), Binomial$new()),
weights = c(0.2, 0.8)
)
m$cdf(1:5)
lower.tail
(logical(1))
If TRUE
(default), probabilities are X <= x
, otherwise, P(X > x)
.
log.p
(logical(1))
If TRUE
returns the logarithm of the probabilities. Default is FALSE
.
simplify
logical(1)
If TRUE
(default) simplifies the return if possible to a numeric
, otherwise returns a
data.table::data.table.
data
array
Alternative method to specify points to evaluate. If univariate then rows correspond with number
of points to evaluate and columns correspond with number of variables to evaluate. In the special
case of VectorDistributions of multivariate distributions, then the third dimension corresponds
to the distribution in the vector to evaluate.
quantile()
The quantile function is not implemented for mixture distributions.
MixtureDistribution$quantile( ..., lower.tail = TRUE, log.p = FALSE, simplify = TRUE, data = NULL )
...
(numeric())
Points to evaluate the function at Arguments do not need
to be named. The length of each argument corresponds to the number of points to evaluate,
the number of arguments corresponds to the number of variables in the distribution.
See examples.
lower.tail
(logical(1))
If TRUE
(default), probabilities are X <= x
, otherwise, P(X > x)
.
log.p
(logical(1))
If TRUE
returns the logarithm of the probabilities. Default is FALSE
.
simplify
logical(1)
If TRUE
(default) simplifies the return if possible to a numeric
, otherwise returns a
data.table::data.table.
data
array
Alternative method to specify points to evaluate. If univariate then rows correspond with number
of points to evaluate and columns correspond with number of variables to evaluate. In the special
case of VectorDistributions of multivariate distributions, then the third dimension corresponds
to the distribution in the vector to evaluate.
rand()
Simulation function for mixture distributions. Samples are drawn from a mixture by first sampling Multinomial(probs = weights, size = n), then sampling each distribution according to the samples from the Multinomial, and finally randomly permuting these draws.
MixtureDistribution$rand(n, simplify = TRUE)
n
(numeric(1))
Number of points to simulate from the distribution. If length greater than , then
n <- length(n)
,
simplify
logical(1)
If TRUE
(default) simplifies the return if possible to a numeric
, otherwise returns a
data.table::data.table.
m <- MixtureDistribution$new(distribution = "Normal", params = data.frame(mean = 1:2, sd = 1)) m$rand(5)
clone()
The objects of this class are cloneable with this method.
MixtureDistribution$clone(deep = FALSE)
deep
Whether to make a deep clone.
Other wrappers:
Convolution
,
DistributionWrapper
,
HuberizedDistribution
,
ProductDistribution
,
TruncatedDistribution
,
VectorDistribution
## ------------------------------------------------ ## Method `MixtureDistribution$new` ## ------------------------------------------------ MixtureDistribution$new(list(Binomial$new(prob = 0.5, size = 10), Binomial$new()), weights = c(0.2, 0.8) ) ## ------------------------------------------------ ## Method `MixtureDistribution$pdf` ## ------------------------------------------------ m <- MixtureDistribution$new(list(Binomial$new(prob = 0.5, size = 10), Binomial$new()), weights = c(0.2, 0.8) ) m$pdf(1:5) m$pdf(1) # also possible but unlikely to be used m$pdf(1, 2) ## ------------------------------------------------ ## Method `MixtureDistribution$rand` ## ------------------------------------------------ m <- MixtureDistribution$new(distribution = "Normal", params = data.frame(mean = 1:2, sd = 1)) m$rand(5)
## ------------------------------------------------ ## Method `MixtureDistribution$new` ## ------------------------------------------------ MixtureDistribution$new(list(Binomial$new(prob = 0.5, size = 10), Binomial$new()), weights = c(0.2, 0.8) ) ## ------------------------------------------------ ## Method `MixtureDistribution$pdf` ## ------------------------------------------------ m <- MixtureDistribution$new(list(Binomial$new(prob = 0.5, size = 10), Binomial$new()), weights = c(0.2, 0.8) ) m$pdf(1:5) m$pdf(1) # also possible but unlikely to be used m$pdf(1, 2) ## ------------------------------------------------ ## Method `MixtureDistribution$rand` ## ------------------------------------------------ m <- MixtureDistribution$new(distribution = "Normal", params = data.frame(mean = 1:2, sd = 1)) m$rand(5)
Given m
vector distributions of length N
, creates a single vector
distribution consisting of n
mixture distributions mixing the m
vectors.
mixturiseVector(vecdists, weights = "uniform")
mixturiseVector(vecdists, weights = "uniform")
vecdists |
|
weights |
|
Let and
then the
mixturiseVector
function creates the vector distribution
where
D3N = m(D1N, D2N, wN)
where m
is a mixture distribution with weights wN
.
## Not run: v1 <- VectorDistribution$new(distribution = "Binomial", params = data.frame(size = 1:2)) v2 <- VectorDistribution$new(distribution = "Binomial", params = data.frame(size = 3:4)) mv1 <- mixturiseVector(list(v1, v2)) # equivalently mv2 <- VectorDistribution$new(list( MixtureDistribution$new(distribution = "Binomial", params = data.frame(size = c(1, 3))), MixtureDistribution$new(distribution = "Binomial", params = data.frame(size = c(2, 4))) )) mv1$pdf(1:5) mv2$pdf(1:5) ## End(Not run)
## Not run: v1 <- VectorDistribution$new(distribution = "Binomial", params = data.frame(size = 1:2)) v2 <- VectorDistribution$new(distribution = "Binomial", params = data.frame(size = 3:4)) mv1 <- mixturiseVector(list(v1, v2)) # equivalently mv2 <- VectorDistribution$new(list( MixtureDistribution$new(distribution = "Binomial", params = data.frame(size = c(1, 3))), MixtureDistribution$new(distribution = "Binomial", params = data.frame(size = c(2, 4))) )) mv1$pdf(1:5) mv2$pdf(1:5) ## End(Not run)
Mathematical and statistical functions for the Multinomial distribution, which is commonly used to extend the binomial distribution to multiple variables, for example to model the rolls of multiple dice multiple times.
The Multinomial distribution parameterised with number of trials, , and probabilities of success,
, is defined by the pmf,
for and
.
Returns an R6 object inheriting from class SDistribution.
The distribution is supported on .
Multinom(size = 10, probs = c(0.5, 0.5))
cdf
and quantile
are
omitted as no closed form analytic expression could be found, decorate with FunctionImputation
for a numerical imputation.
N/A
distr6::Distribution
-> distr6::SDistribution
-> Multinomial
name
Full name of distribution.
short_name
Short name of distribution for printing.
description
Brief description of the distribution.
alias
Alias of the distribution.
packages
Packages required to be installed in order to construct the distribution.
properties
Returns distribution properties, including skewness type and symmetry.
distr6::Distribution$cdf()
distr6::Distribution$confidence()
distr6::Distribution$correlation()
distr6::Distribution$getParameterValue()
distr6::Distribution$iqr()
distr6::Distribution$liesInSupport()
distr6::Distribution$liesInType()
distr6::Distribution$median()
distr6::Distribution$parameters()
distr6::Distribution$pdf()
distr6::Distribution$prec()
distr6::Distribution$print()
distr6::Distribution$quantile()
distr6::Distribution$rand()
distr6::Distribution$stdev()
distr6::Distribution$strprint()
distr6::Distribution$summary()
distr6::Distribution$workingSupport()
new()
Creates a new instance of this R6 class.
Multinomial$new(size = NULL, probs = NULL, decorators = NULL)
size
(integer(1))
Number of trials, defined on the positive Naturals.
probs
(numeric())
Vector of probabilities. Automatically normalised by
probs = probs/sum(probs)
.
decorators
(character())
Decorators to add to the distribution during construction.
mean()
The arithmetic mean of a (discrete) probability distribution X is the expectation
with an integration analogue for continuous distributions.
Multinomial$mean(...)
...
Unused.
variance()
The variance of a distribution is defined by the formula
where is the expectation of distribution X. If the distribution is multivariate the
covariance matrix is returned.
Multinomial$variance(...)
...
Unused.
skewness()
The skewness of a distribution is defined by the third standardised moment,
where is the expectation of distribution X,
is the mean of the
distribution and
is the standard deviation of the distribution.
Multinomial$skewness(...)
...
Unused.
kurtosis()
The kurtosis of a distribution is defined by the fourth standardised moment,
where is the expectation of distribution X,
is the mean of the
distribution and
is the standard deviation of the distribution.
Excess Kurtosis is Kurtosis - 3.
Multinomial$kurtosis(excess = TRUE, ...)
excess
(logical(1))
If TRUE
(default) excess kurtosis returned.
...
Unused.
entropy()
The entropy of a (discrete) distribution is defined by
where is the pdf of distribution X, with an integration analogue for
continuous distributions.
Multinomial$entropy(base = 2, ...)
base
(integer(1))
Base of the entropy logarithm, default = 2 (Shannon entropy)
...
Unused.
mgf()
The moment generating function is defined by
where X is the distribution and is the expectation of the distribution X.
Multinomial$mgf(t, ...)
t
(integer(1))
t integer to evaluate function at.
...
Unused.
cf()
The characteristic function is defined by
where X is the distribution and is the expectation of the distribution X.
Multinomial$cf(t, ...)
t
(integer(1))
t integer to evaluate function at.
...
Unused.
pgf()
The probability generating function is defined by
where X is the distribution and is the expectation of the distribution X.
Multinomial$pgf(z, ...)
z
(integer(1))
z integer to evaluate probability generating function at.
...
Unused.
setParameterValue()
Sets the value(s) of the given parameter(s).
Multinomial$setParameterValue( ..., lst = list(...), error = "warn", resolveConflicts = FALSE )
...
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.
clone()
The objects of this class are cloneable with this method.
Multinomial$clone(deep = FALSE)
deep
Whether to make a deep clone.
McLaughlin, M. P. (2001). A compendium of common probability distributions (pp. 2014-01). Michael P. McLaughlin.
Other discrete distributions:
Arrdist
,
Bernoulli
,
Binomial
,
Categorical
,
Degenerate
,
DiscreteUniform
,
EmpiricalMV
,
Empirical
,
Geometric
,
Hypergeometric
,
Logarithmic
,
Matdist
,
NegativeBinomial
,
WeightedDiscrete
Other multivariate distributions:
Dirichlet
,
EmpiricalMV
,
MultivariateNormal
Mathematical and statistical functions for the Multivariate Normal distribution, which is commonly used to generalise the Normal distribution to higher dimensions, and is commonly associated with Gaussian Processes.
The Multivariate Normal distribution parameterised with mean, , and covariance matrix,
, is defined by the pdf,
for and
.
Sampling is performed via the Cholesky decomposition using chol.
Number of variables cannot be changed after construction.
Returns an R6 object inheriting from class SDistribution.
The distribution is supported on the Reals and only when the covariance matrix is positive-definite.
MultiNorm(mean = rep(0, 2), cov = c(1, 0, 0, 1))
cdf
and quantile
are
omitted as no closed form analytic expression could be found, decorate with FunctionImputation
for a numerical imputation.
N/A
distr6::Distribution
-> distr6::SDistribution
-> MultivariateNormal
name
Full name of distribution.
short_name
Short name of distribution for printing.
description
Brief description of the distribution.
alias
Alias of the distribution.
properties
Returns distribution properties, including skewness type and symmetry.
distr6::Distribution$cdf()
distr6::Distribution$confidence()
distr6::Distribution$correlation()
distr6::Distribution$iqr()
distr6::Distribution$liesInSupport()
distr6::Distribution$liesInType()
distr6::Distribution$median()
distr6::Distribution$parameters()
distr6::Distribution$pdf()
distr6::Distribution$prec()
distr6::Distribution$print()
distr6::Distribution$quantile()
distr6::Distribution$rand()
distr6::Distribution$stdev()
distr6::Distribution$strprint()
distr6::Distribution$summary()
distr6::Distribution$workingSupport()
new()
Creates a new instance of this R6 class. Number of variables cannot be changed after construction.
MultivariateNormal$new( mean = rep(0, 2), cov = c(1, 0, 0, 1), prec = NULL, decorators = NULL )
mean
(numeric())
Vector of means, defined on the Reals.
cov
(matrix()|vector())
Covariance of the distribution, either given as a matrix or vector coerced to a
matrix via matrix(cov, nrow = K, byrow = FALSE)
. Must be semi-definite.
prec
(matrix()|vector())
Precision of the distribution, inverse of the covariance matrix. If supplied then cov
is
ignored. Given as a matrix or vector coerced to a
matrix via matrix(cov, nrow = K, byrow = FALSE)
. Must be semi-definite.
decorators
(character())
Decorators to add to the distribution during construction.
mean()
The arithmetic mean of a (discrete) probability distribution X is the expectation
with an integration analogue for continuous distributions.
MultivariateNormal$mean(...)
...
Unused.
mode()
The mode of a probability distribution is the point at which the pdf is a local maximum, a distribution can be unimodal (one maximum) or multimodal (several maxima).
MultivariateNormal$mode(which = "all")
which
(character(1) | numeric(1)
Ignored if distribution is unimodal. Otherwise "all"
returns all modes, otherwise specifies
which mode to return.
variance()
The variance of a distribution is defined by the formula
where is the expectation of distribution X. If the distribution is multivariate the
covariance matrix is returned.
MultivariateNormal$variance(...)
...
Unused.
entropy()
The entropy of a (discrete) distribution is defined by
where is the pdf of distribution X, with an integration analogue for
continuous distributions.
MultivariateNormal$entropy(base = 2, ...)
base
(integer(1))
Base of the entropy logarithm, default = 2 (Shannon entropy)
...
Unused.
mgf()
The moment generating function is defined by
where X is the distribution and is the expectation of the distribution X.
MultivariateNormal$mgf(t, ...)
t
(integer(1))
t integer to evaluate function at.
...
Unused.
cf()
The characteristic function is defined by
where X is the distribution and is the expectation of the distribution X.
MultivariateNormal$cf(t, ...)
t
(integer(1))
t integer to evaluate function at.
...
Unused.
pgf()
The probability generating function is defined by
where X is the distribution and is the expectation of the distribution X.
MultivariateNormal$pgf(z, ...)
z
(integer(1))
z integer to evaluate probability generating function at.
...
Unused.
getParameterValue()
Returns the value of the supplied parameter.
MultivariateNormal$getParameterValue(id, error = "warn")
id
character()
id of parameter support to return.
error
(character(1))
If "warn"
then returns a warning on error, otherwise breaks if "stop"
.
setParameterValue()
Sets the value(s) of the given parameter(s).
MultivariateNormal$setParameterValue( ..., lst = list(...), error = "warn", resolveConflicts = FALSE )
...
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.
clone()
The objects of this class are cloneable with this method.
MultivariateNormal$clone(deep = FALSE)
deep
Whether to make a deep clone.
McLaughlin, M. P. (2001). A compendium of common probability distributions (pp. 2014-01). Michael P. McLaughlin.
Gentle, J.E. (2009). Computational Statistics. Statistics and Computing. New York: Springer. pp. 315–316. doi:10.1007/978-0-387-98144-4. ISBN 978-0-387-98143-7.
Other continuous distributions:
Arcsine
,
BetaNoncentral
,
Beta
,
Cauchy
,
ChiSquaredNoncentral
,
ChiSquared
,
Dirichlet
,
Erlang
,
Exponential
,
FDistributionNoncentral
,
FDistribution
,
Frechet
,
Gamma
,
Gompertz
,
Gumbel
,
InverseGamma
,
Laplace
,
Logistic
,
Loglogistic
,
Lognormal
,
Normal
,
Pareto
,
Poisson
,
Rayleigh
,
ShiftedLoglogistic
,
StudentTNoncentral
,
StudentT
,
Triangular
,
Uniform
,
Wald
,
Weibull
Other multivariate distributions:
Dirichlet
,
EmpiricalMV
,
Multinomial
Mathematical and statistical functions for the Negative Binomial distribution, which is commonly used to model the number of successes, trials or failures before a given number of failures or successes.
The Negative Binomial distribution parameterised with number of failures before successes, , and probability of success,
, is defined by the pmf,
for and probability
, where
is the combination (or binomial coefficient) function.
The Negative Binomial distribution can refer to one of four distributions (forms):
The number of failures before K successes (fbs)
The number of successes before K failures (sbf)
The number of trials before K failures (tbf)
The number of trials before K successes (tbs)
For each we refer to the number of K successes/failures as the size
parameter.
Returns an R6 object inheriting from class SDistribution.
The distribution is supported on (for fbs and sbf) or
(for tbf and tbs) (see below).
NBinom(size = 10, prob = 0.5, form = "fbs")
N/A
N/A
distr6::Distribution
-> distr6::SDistribution
-> NegativeBinomial
name
Full name of distribution.
short_name
Short name of distribution for printing.
description
Brief description of the distribution.
alias
Alias of the distribution.
packages
Packages required to be installed in order to construct the distribution.
properties
Returns distribution properties, including skewness type and symmetry.
distr6::Distribution$cdf()
distr6::Distribution$confidence()
distr6::Distribution$correlation()
distr6::Distribution$getParameterValue()
distr6::Distribution$iqr()
distr6::Distribution$liesInSupport()
distr6::Distribution$liesInType()
distr6::Distribution$median()
distr6::Distribution$parameters()
distr6::Distribution$pdf()
distr6::Distribution$prec()
distr6::Distribution$print()
distr6::Distribution$quantile()
distr6::Distribution$rand()
distr6::Distribution$setParameterValue()
distr6::Distribution$stdev()
distr6::Distribution$strprint()
distr6::Distribution$summary()
distr6::Distribution$workingSupport()
new()
Creates a new instance of this R6 class.
NegativeBinomial$new( size = NULL, prob = NULL, qprob = NULL, mean = NULL, form = NULL, decorators = NULL )
size
(integer(1))
Number of trials/successes.
prob
(numeric(1))
Probability of success.
qprob
(numeric(1))
Probability of failure. If provided then prob
is ignored. qprob = 1 - prob
.
mean
(numeric(1))
Mean of distribution, alternative to prob
and qprob
.
form
character(1))
Form of the distribution, cannot be changed after construction. Options are to model
the number of,
"fbs"
- Failures before successes.
"sbf"
- Successes before failures.
"tbf"
- Trials before failures.
"tbs"
- Trials before successes.
Use $description
to see the Negative Binomial form.
decorators
(character())
Decorators to add to the distribution during construction.
mean()
The arithmetic mean of a (discrete) probability distribution X is the expectation
with an integration analogue for continuous distributions.
NegativeBinomial$mean(...)
...
Unused.
mode()
The mode of a probability distribution is the point at which the pdf is a local maximum, a distribution can be unimodal (one maximum) or multimodal (several maxima).
NegativeBinomial$mode(which = "all")
which
(character(1) | numeric(1)
Ignored if distribution is unimodal. Otherwise "all"
returns all modes, otherwise specifies
which mode to return.
variance()
The variance of a distribution is defined by the formula
where is the expectation of distribution X. If the distribution is multivariate the
covariance matrix is returned.
NegativeBinomial$variance(...)
...
Unused.
skewness()
The skewness of a distribution is defined by the third standardised moment,
where is the expectation of distribution X,
is the mean of the
distribution and
is the standard deviation of the distribution.
NegativeBinomial$skewness(...)
...
Unused.
kurtosis()
The kurtosis of a distribution is defined by the fourth standardised moment,
where is the expectation of distribution X,
is the mean of the
distribution and
is the standard deviation of the distribution.
Excess Kurtosis is Kurtosis - 3.
NegativeBinomial$kurtosis(excess = TRUE, ...)
excess
(logical(1))
If TRUE
(default) excess kurtosis returned.
...
Unused.
mgf()
The moment generating function is defined by
where X is the distribution and is the expectation of the distribution X.
NegativeBinomial$mgf(t, ...)
t
(integer(1))
t integer to evaluate function at.
...
Unused.
cf()
The characteristic function is defined by
where X is the distribution and is the expectation of the distribution X.
NegativeBinomial$cf(t, ...)
t
(integer(1))
t integer to evaluate function at.
...
Unused.
pgf()
The probability generating function is defined by
where X is the distribution and is the expectation of the distribution X.
NegativeBinomial$pgf(z, ...)
z
(integer(1))
z integer to evaluate probability generating function at.
...
Unused.
clone()
The objects of this class are cloneable with this method.
NegativeBinomial$clone(deep = FALSE)
deep
Whether to make a deep clone.
McLaughlin, M. P. (2001). A compendium of common probability distributions (pp. 2014-01). Michael P. McLaughlin.
Other discrete distributions:
Arrdist
,
Bernoulli
,
Binomial
,
Categorical
,
Degenerate
,
DiscreteUniform
,
EmpiricalMV
,
Empirical
,
Geometric
,
Hypergeometric
,
Logarithmic
,
Matdist
,
Multinomial
,
WeightedDiscrete
Other univariate distributions:
Arcsine
,
Arrdist
,
Bernoulli
,
BetaNoncentral
,
Beta
,
Binomial
,
Categorical
,
Cauchy
,
ChiSquaredNoncentral
,
ChiSquared
,
Degenerate
,
DiscreteUniform
,
Empirical
,
Erlang
,
Exponential
,
FDistributionNoncentral
,
FDistribution
,
Frechet
,
Gamma
,
Geometric
,
Gompertz
,
Gumbel
,
Hypergeometric
,
InverseGamma
,
Laplace
,
Logarithmic
,
Logistic
,
Loglogistic
,
Lognormal
,
Matdist
,
Normal
,
Pareto
,
Poisson
,
Rayleigh
,
ShiftedLoglogistic
,
StudentTNoncentral
,
StudentT
,
Triangular
,
Uniform
,
Wald
,
Weibull
,
WeightedDiscrete
Mathematical and statistical functions for the Normal distribution, which is commonly used in significance testing, for representing models with a bell curve, and as a result of the central limit theorem.
The Normal distribution parameterised with variance, , and mean,
, is defined by the pdf,
for and
.
Returns an R6 object inheriting from class SDistribution.
The distribution is supported on the Reals.
Norm(mean = 0, var = 1)
N/A
Also known as the Gaussian distribution.
distr6::Distribution
-> distr6::SDistribution
-> Normal
name
Full name of distribution.
short_name
Short name of distribution for printing.
description
Brief description of the distribution.
alias
Alias of the distribution.
packages
Packages required to be installed in order to construct the distribution.
distr6::Distribution$cdf()
distr6::Distribution$confidence()
distr6::Distribution$correlation()
distr6::Distribution$getParameterValue()
distr6::Distribution$iqr()
distr6::Distribution$liesInSupport()
distr6::Distribution$liesInType()
distr6::Distribution$median()
distr6::Distribution$parameters()
distr6::Distribution$pdf()
distr6::Distribution$prec()
distr6::Distribution$print()
distr6::Distribution$quantile()
distr6::Distribution$rand()
distr6::Distribution$setParameterValue()
distr6::Distribution$stdev()
distr6::Distribution$strprint()
distr6::Distribution$summary()
distr6::Distribution$workingSupport()
new()
Creates a new instance of this R6 class.
Normal$new(mean = NULL, var = NULL, sd = NULL, prec = NULL, decorators = NULL)
mean
(numeric(1))
Mean of the distribution, defined on the Reals.
var
(numeric(1))
Variance of the distribution, defined on the positive Reals.
sd
(numeric(1))
Standard deviation of the distribution, defined on the positive Reals. sd = sqrt(var)
.
If provided then var
ignored.
prec
(numeric(1))
Precision of the distribution, defined on the positive Reals. prec = 1/var
.
If provided then var
ignored.
decorators
(character())
Decorators to add to the distribution during construction.
mean()
The arithmetic mean of a (discrete) probability distribution X is the expectation
with an integration analogue for continuous distributions.
Normal$mean(...)
...
Unused.
mode()
The mode of a probability distribution is the point at which the pdf is a local maximum, a distribution can be unimodal (one maximum) or multimodal (several maxima).
Normal$mode(which = "all")
which
(character(1) | numeric(1)
Ignored if distribution is unimodal. Otherwise "all"
returns all modes, otherwise specifies
which mode to return.
variance()
The variance of a distribution is defined by the formula
where is the expectation of distribution X. If the distribution is multivariate the
covariance matrix is returned.
Normal$variance(...)
...
Unused.
skewness()
The skewness of a distribution is defined by the third standardised moment,
where is the expectation of distribution X,
is the mean of the
distribution and
is the standard deviation of the distribution.
Normal$skewness(...)
...
Unused.
kurtosis()
The kurtosis of a distribution is defined by the fourth standardised moment,
where is the expectation of distribution X,
is the mean of the
distribution and
is the standard deviation of the distribution.
Excess Kurtosis is Kurtosis - 3.
Normal$kurtosis(excess = TRUE, ...)
excess
(logical(1))
If TRUE
(default) excess kurtosis returned.
...
Unused.
entropy()
The entropy of a (discrete) distribution is defined by
where is the pdf of distribution X, with an integration analogue for
continuous distributions.
Normal$entropy(base = 2, ...)
base
(integer(1))
Base of the entropy logarithm, default = 2 (Shannon entropy)
...
Unused.
mgf()
The moment generating function is defined by
where X is the distribution and is the expectation of the distribution X.
Normal$mgf(t, ...)
t
(integer(1))
t integer to evaluate function at.
...
Unused.
cf()
The characteristic function is defined by
where X is the distribution and is the expectation of the distribution X.
Normal$cf(t, ...)
t
(integer(1))
t integer to evaluate function at.
...
Unused.
pgf()
The probability generating function is defined by
where X is the distribution and is the expectation of the distribution X.
Normal$pgf(z, ...)
z
(integer(1))
z integer to evaluate probability generating function at.
...
Unused.
clone()
The objects of this class are cloneable with this method.
Normal$clone(deep = FALSE)
deep
Whether to make a deep clone.
McLaughlin, M. P. (2001). A compendium of common probability distributions (pp. 2014-01). Michael P. McLaughlin.
Other continuous distributions:
Arcsine
,
BetaNoncentral
,
Beta
,
Cauchy
,
ChiSquaredNoncentral
,
ChiSquared
,
Dirichlet
,
Erlang
,
Exponential
,
FDistributionNoncentral
,
FDistribution
,
Frechet
,
Gamma
,
Gompertz
,
Gumbel
,
InverseGamma
,
Laplace
,
Logistic
,
Loglogistic
,
Lognormal
,
MultivariateNormal
,
Pareto
,
Poisson
,
Rayleigh
,
ShiftedLoglogistic
,
StudentTNoncentral
,
StudentT
,
Triangular
,
Uniform
,
Wald
,
Weibull
Other univariate distributions:
Arcsine
,
Arrdist
,
Bernoulli
,
BetaNoncentral
,
Beta
,
Binomial
,
Categorical
,
Cauchy
,
ChiSquaredNoncentral
,
ChiSquared
,
Degenerate
,
DiscreteUniform
,
Empirical
,
Erlang
,
Exponential
,
FDistributionNoncentral
,
FDistribution
,
Frechet
,
Gamma
,
Geometric
,
Gompertz
,
Gumbel
,
Hypergeometric
,
InverseGamma
,
Laplace
,
Logarithmic
,
Logistic
,
Loglogistic
,
Lognormal
,
Matdist
,
NegativeBinomial
,
Pareto
,
Poisson
,
Rayleigh
,
ShiftedLoglogistic
,
StudentTNoncentral
,
StudentT
,
Triangular
,
Uniform
,
Wald
,
Weibull
,
WeightedDiscrete
Mathematical and statistical functions for the NormalKernel kernel defined by the pdf,
over the support .
We use the erf
and erfinv
error and inverse error functions from
pracma.
distr6::Distribution
-> distr6::Kernel
-> NormalKernel
name
Full name of distribution.
short_name
Short name of distribution for printing.
description
Brief description of the distribution.
packages
Packages required to be installed in order to construct the distribution.
distr6::Distribution$cdf()
distr6::Distribution$confidence()
distr6::Distribution$correlation()
distr6::Distribution$getParameterValue()
distr6::Distribution$iqr()
distr6::Distribution$liesInSupport()
distr6::Distribution$liesInType()
distr6::Distribution$parameters()
distr6::Distribution$pdf()
distr6::Distribution$prec()
distr6::Distribution$print()
distr6::Distribution$quantile()
distr6::Distribution$rand()
distr6::Distribution$setParameterValue()
distr6::Distribution$stdev()
distr6::Distribution$strprint()
distr6::Distribution$summary()
distr6::Distribution$workingSupport()
distr6::Kernel$cdfSquared2Norm()
distr6::Kernel$mean()
distr6::Kernel$median()
distr6::Kernel$mode()
distr6::Kernel$skewness()
new()
Creates a new instance of this R6 class.
NormalKernel$new(decorators = NULL)
decorators
(character())
Decorators to add to the distribution during construction.
pdfSquared2Norm()
The squared 2-norm of the pdf is defined by
where X is the Distribution, is its pdf and
are the distribution support limits.
NormalKernel$pdfSquared2Norm(x = 0, upper = Inf)
x
(numeric(1))
Amount to shift the result.
upper
(numeric(1))
Upper limit of the integral.
variance()
The variance of a distribution is defined by the formula
where is the expectation of distribution X. If the distribution is multivariate the
covariance matrix is returned.
NormalKernel$variance(...)
...
Unused.
clone()
The objects of this class are cloneable with this method.
NormalKernel$clone(deep = FALSE)
deep
Whether to make a deep clone.
Other kernels:
Cosine
,
Epanechnikov
,
LogisticKernel
,
Quartic
,
Sigmoid
,
Silverman
,
TriangularKernel
,
Tricube
,
Triweight
,
UniformKernel
Mathematical and statistical functions for the Pareto distribution, which is commonly used in Economics to model the distribution of wealth and the 80-20 rule.
The Pareto distribution parameterised with shape, , and scale,
, is defined by the pdf,
for .
Currently this is implemented as the Type I Pareto distribution, other types will be added in the future. Characteristic function is omitted as no suitable incomplete gamma function with complex inputs implementation could be found.
Returns an R6 object inheriting from class SDistribution.
The distribution is supported on .
Pare(shape = 1, scale = 1)
N/A
N/A
distr6::Distribution
-> distr6::SDistribution
-> Pareto
name
Full name of distribution.
short_name
Short name of distribution for printing.
description
Brief description of the distribution.
alias
Alias of the distribution.
packages
Packages required to be installed in order to construct the distribution.
properties
Returns distribution properties, including skewness type and symmetry.
distr6::Distribution$cdf()
distr6::Distribution$confidence()
distr6::Distribution$correlation()
distr6::Distribution$getParameterValue()
distr6::Distribution$iqr()
distr6::Distribution$liesInSupport()
distr6::Distribution$liesInType()
distr6::Distribution$parameters()
distr6::Distribution$pdf()
distr6::Distribution$prec()
distr6::Distribution$print()
distr6::Distribution$quantile()
distr6::Distribution$rand()
distr6::Distribution$setParameterValue()
distr6::Distribution$stdev()
distr6::Distribution$strprint()
distr6::Distribution$summary()
distr6::Distribution$workingSupport()
new()
Creates a new instance of this R6 class.
Pareto$new(shape = NULL, scale = NULL, decorators = NULL)
shape
(numeric(1))
Shape parameter, defined on the positive Reals.
scale
(numeric(1))
Scale parameter, defined on the positive Reals.
decorators
(character())
Decorators to add to the distribution during construction.
mean()
The arithmetic mean of a (discrete) probability distribution X is the expectation
with an integration analogue for continuous distributions.
Pareto$mean(...)
...
Unused.
mode()
The mode of a probability distribution is the point at which the pdf is a local maximum, a distribution can be unimodal (one maximum) or multimodal (several maxima).
Pareto$mode(which = "all")
which
(character(1) | numeric(1)
Ignored if distribution is unimodal. Otherwise "all"
returns all modes, otherwise specifies
which mode to return.
median()
Returns the median of the distribution. If an analytical expression is available
returns distribution median, otherwise if symmetric returns self$mean
, otherwise
returns self$quantile(0.5)
.
Pareto$median()
variance()
The variance of a distribution is defined by the formula
where is the expectation of distribution X. If the distribution is multivariate the
covariance matrix is returned.
Pareto$variance(...)
...
Unused.
skewness()
The skewness of a distribution is defined by the third standardised moment,
where is the expectation of distribution X,
is the mean of the
distribution and
is the standard deviation of the distribution.
Pareto$skewness(...)
...
Unused.
kurtosis()
The kurtosis of a distribution is defined by the fourth standardised moment,
where is the expectation of distribution X,
is the mean of the
distribution and
is the standard deviation of the distribution.
Excess Kurtosis is Kurtosis - 3.
Pareto$kurtosis(excess = TRUE, ...)
excess
(logical(1))
If TRUE
(default) excess kurtosis returned.
...
Unused.
entropy()
The entropy of a (discrete) distribution is defined by
where is the pdf of distribution X, with an integration analogue for
continuous distributions.
Pareto$entropy(base = 2, ...)
base
(integer(1))
Base of the entropy logarithm, default = 2 (Shannon entropy)
...
Unused.
mgf()
The moment generating function is defined by
where X is the distribution and is the expectation of the distribution X.
Pareto$mgf(t, ...)
t
(integer(1))
t integer to evaluate function at.
...
Unused.
pgf()
The probability generating function is defined by
where X is the distribution and is the expectation of the distribution X.
Pareto$pgf(z, ...)
z
(integer(1))
z integer to evaluate probability generating function at.
...
Unused.
clone()
The objects of this class are cloneable with this method.
Pareto$clone(deep = FALSE)
deep
Whether to make a deep clone.
McLaughlin, M. P. (2001). A compendium of common probability distributions (pp. 2014-01). Michael P. McLaughlin.
Other continuous distributions:
Arcsine
,
BetaNoncentral
,
Beta
,
Cauchy
,
ChiSquaredNoncentral
,
ChiSquared
,
Dirichlet
,
Erlang
,
Exponential
,
FDistributionNoncentral
,
FDistribution
,
Frechet
,
Gamma
,
Gompertz
,
Gumbel
,
InverseGamma
,
Laplace
,
Logistic
,
Loglogistic
,
Lognormal
,
MultivariateNormal
,
Normal
,
Poisson
,
Rayleigh
,
ShiftedLoglogistic
,
StudentTNoncentral
,
StudentT
,
Triangular
,
Uniform
,
Wald
,
Weibull
Other univariate distributions:
Arcsine
,
Arrdist
,
Bernoulli
,
BetaNoncentral
,
Beta
,
Binomial
,
Categorical
,
Cauchy
,
ChiSquaredNoncentral
,
ChiSquared
,
Degenerate
,
DiscreteUniform
,
Empirical
,
Erlang
,
Exponential
,
FDistributionNoncentral
,
FDistribution
,
Frechet
,
Gamma
,
Geometric
,
Gompertz
,
Gumbel
,
Hypergeometric
,
InverseGamma
,
Laplace
,
Logarithmic
,
Logistic
,
Loglogistic
,
Lognormal
,
Matdist
,
NegativeBinomial
,
Normal
,
Poisson
,
Rayleigh
,
ShiftedLoglogistic
,
StudentTNoncentral
,
StudentT
,
Triangular
,
Uniform
,
Wald
,
Weibull
,
WeightedDiscrete
Six plots, which can be selected with fun
are available for discrete and
continuous univariate distributions: pdf, cdf, quantile, survival, hazard and cumulative
hazard. By default, the first two are plotted side by side.
## S3 method for class 'Distribution' plot( x, fun = c("pdf", "cdf"), npoints = 3000, plot = TRUE, ask = FALSE, arrange = TRUE, ... )
## S3 method for class 'Distribution' plot( x, fun = c("pdf", "cdf"), npoints = 3000, plot = TRUE, ask = FALSE, arrange = TRUE, ... )
x |
|
fun |
vector of functions to plot, one or more of: "pdf","cdf","quantile", "survival", "hazard", "cumhazard", and "all"; partial matching available. |
npoints |
number of evaluation points. |
plot |
logical; if TRUE (default), figures are displayed in the plot window; otherwise a
|
ask |
logical; if TRUE, the user is asked before each plot, see |
arrange |
logical; if TRUE (default), margins are automatically adjusted with
|
... |
graphical parameters, see details. |
The evaluation points are calculated using inverse transform on a uniform grid between 0 and 1
with length given by npoints
. Therefore any distribution without an analytical quantile
method will first need to be imputed with the FunctionImputation decorator.
The order that the functions are supplied to fun
determines the order in which they are
plotted, however this is ignored if ask
is TRUE
. If ask
is TRUE
then
arrange
is ignored. For maximum flexibility in plotting layouts, set arrange
and
ask
to FALSE
.
The graphical parameters passed to ...
can either apply to all plots or selected plots.
If parameters in par
are prefixed with the plotted function name, then
the parameter only applies to that function, otherwise it applies to them all. See examples for
a clearer description.
Chengyang Gao, Runlong Yu and Shuhan Liu
## Not run: # Plot pdf and cdf of Normal plot(Normal$new()) # Colour both plots red plot(Normal$new(), col = "red") # Change the colours of individual plotted functions plot(Normal$new(), pdf_col = "red", cdf_col = "green") # Interactive plotting in order - par still works here plot(Geometric$new(), fun = "all", ask = TRUE, pdf_col = "black", cdf_col = "red", quantile_col = "blue", survival_col = "purple", hazard_col = "brown", cumhazard_col = "yellow" ) # Return plotting structure x <- plot(Gamma$new(), plot = FALSE) ## End(Not run)
## Not run: # Plot pdf and cdf of Normal plot(Normal$new()) # Colour both plots red plot(Normal$new(), col = "red") # Change the colours of individual plotted functions plot(Normal$new(), pdf_col = "red", cdf_col = "green") # Interactive plotting in order - par still works here plot(Geometric$new(), fun = "all", ask = TRUE, pdf_col = "black", cdf_col = "red", quantile_col = "blue", survival_col = "purple", hazard_col = "brown", cumhazard_col = "yellow" ) # Return plotting structure x <- plot(Gamma$new(), plot = FALSE) ## End(Not run)
Helper function to more easily plot a Matdist.
## S3 method for class 'Matdist' plot(x, fun = c("pdf", "cdf", "survival", "hazard", "cumhazard"), ...)
## S3 method for class 'Matdist' plot(x, fun = c("pdf", "cdf", "survival", "hazard", "cumhazard"), ...)
x |
|
fun |
function to plot, one of: "pdf","cdf", "survival", "hazard", "cumhazard". |
... |
Other parameters passed to matplot. |
Essentially just a wrapper around matplot.
plot.Distribution plot.VectorDistribution
## Not run: pdf <- runif(200) mat <- matrix(pdf, 20, 10) mat <- t(apply(mat, 1, function(x) x / sum(x))) colnames(mat) <- 1:10 d <- as.Distribution(mat, fun = "pdf") plot(d, "pdf", xlab = "x", ylab = "p(x)") plot(d, "cdf", xlab = "x", ylab = "F(x)") plot(d, "survival", xlab = "x", ylab = "S(x)") plot(d, "hazard", xlab = "x", ylab = "h(x)") plot(d, "cumhazard", xlab = "x", ylab = "H(x)") ## End(Not run)
## Not run: pdf <- runif(200) mat <- matrix(pdf, 20, 10) mat <- t(apply(mat, 1, function(x) x / sum(x))) colnames(mat) <- 1:10 d <- as.Distribution(mat, fun = "pdf") plot(d, "pdf", xlab = "x", ylab = "p(x)") plot(d, "cdf", xlab = "x", ylab = "F(x)") plot(d, "survival", xlab = "x", ylab = "S(x)") plot(d, "hazard", xlab = "x", ylab = "h(x)") plot(d, "cumhazard", xlab = "x", ylab = "H(x)") ## End(Not run)
Helper function to more easily plot distributions inside a VectorDistribution.
## S3 method for class 'VectorDistribution' plot(x, fun = "pdf", topn, ind, cols, ...)
## S3 method for class 'VectorDistribution' plot(x, fun = "pdf", topn, ind, cols, ...)
x |
|
fun |
function to plot, one of: "pdf","cdf","quantile", "survival", "hazard", "cumhazard". |
topn |
|
ind |
|
cols |
|
... |
Other parameters passed to plot.Distribution. |
If topn
and ind
are both missing then all distributions are plotted if there are 10 or less
in the vector, otherwise the function will error.
## Not run: # Plot pdf of Normal distribution vd <- VectorDistribution$new(list(Normal$new(), Normal$new(mean = 2))) plot(vd) plot(vd, fun = "surv") plot(vd, fun = "quantile", ylim = c(-4, 4), col = c("blue", "purple")) ## End(Not run)
## Not run: # Plot pdf of Normal distribution vd <- VectorDistribution$new(list(Normal$new(), Normal$new(mean = 2))) plot(vd) plot(vd, fun = "surv") plot(vd, fun = "quantile", ylim = c(-4, 4), col = c("blue", "purple")) ## End(Not run)
Mathematical and statistical functions for the Poisson distribution, which is commonly used to model the number of events occurring in at a constant, independent rate over an interval of time or space.
The Poisson distribution parameterised with arrival rate, , is defined by the pmf,
for > 0.
Returns an R6 object inheriting from class SDistribution.
The distribution is supported on the Naturals.
Pois(rate = 1)
N/A
N/A
distr6::Distribution
-> distr6::SDistribution
-> Poisson
name
Full name of distribution.
short_name
Short name of distribution for printing.
description
Brief description of the distribution.
alias
Alias of the distribution.
packages
Packages required to be installed in order to construct the distribution.
distr6::Distribution$cdf()
distr6::Distribution$confidence()
distr6::Distribution$correlation()
distr6::Distribution$getParameterValue()
distr6::Distribution$iqr()
distr6::Distribution$liesInSupport()
distr6::Distribution$liesInType()
distr6::Distribution$median()
distr6::Distribution$parameters()
distr6::Distribution$pdf()
distr6::Distribution$prec()
distr6::Distribution$print()
distr6::Distribution$quantile()
distr6::Distribution$rand()
distr6::Distribution$setParameterValue()
distr6::Distribution$stdev()
distr6::Distribution$strprint()
distr6::Distribution$summary()
distr6::Distribution$workingSupport()
new()
Creates a new instance of this R6 class.
Poisson$new(rate = NULL, decorators = NULL)
rate
(numeric(1))
Rate parameter of the distribution, defined on the positive Reals.
decorators
(character())
Decorators to add to the distribution during construction.
mean()
The arithmetic mean of a (discrete) probability distribution X is the expectation
with an integration analogue for continuous distributions.
Poisson$mean(...)
...
Unused.
mode()
The mode of a probability distribution is the point at which the pdf is a local maximum, a distribution can be unimodal (one maximum) or multimodal (several maxima).
Poisson$mode(which = "all")
which
(character(1) | numeric(1)
Ignored if distribution is unimodal. Otherwise "all"
returns all modes, otherwise specifies
which mode to return.
variance()
The variance of a distribution is defined by the formula
where is the expectation of distribution X. If the distribution is multivariate the
covariance matrix is returned.
Poisson$variance(...)
...
Unused.
skewness()
The skewness of a distribution is defined by the third standardised moment,
where is the expectation of distribution X,
is the mean of the
distribution and
is the standard deviation of the distribution.
Poisson$skewness(...)
...
Unused.
kurtosis()
The kurtosis of a distribution is defined by the fourth standardised moment,
where is the expectation of distribution X,
is the mean of the
distribution and
is the standard deviation of the distribution.
Excess Kurtosis is Kurtosis - 3.
Poisson$kurtosis(excess = TRUE, ...)
excess
(logical(1))
If TRUE
(default) excess kurtosis returned.
...
Unused.
mgf()
The moment generating function is defined by
where X is the distribution and is the expectation of the distribution X.
Poisson$mgf(t, ...)
t
(integer(1))
t integer to evaluate function at.
...
Unused.
cf()
The characteristic function is defined by
where X is the distribution and is the expectation of the distribution X.
Poisson$cf(t, ...)
t
(integer(1))
t integer to evaluate function at.
...
Unused.
pgf()
The probability generating function is defined by
where X is the distribution and is the expectation of the distribution X.
Poisson$pgf(z, ...)
z
(integer(1))
z integer to evaluate probability generating function at.
...
Unused.
clone()
The objects of this class are cloneable with this method.
Poisson$clone(deep = FALSE)
deep
Whether to make a deep clone.
McLaughlin, M. P. (2001). A compendium of common probability distributions (pp. 2014-01). Michael P. McLaughlin.
Other continuous distributions:
Arcsine
,
BetaNoncentral
,
Beta
,
Cauchy
,
ChiSquaredNoncentral
,
ChiSquared
,
Dirichlet
,
Erlang
,
Exponential
,
FDistributionNoncentral
,
FDistribution
,
Frechet
,
Gamma
,
Gompertz
,
Gumbel
,
InverseGamma
,
Laplace
,
Logistic
,
Loglogistic
,
Lognormal
,
MultivariateNormal
,
Normal
,
Pareto
,
Rayleigh
,
ShiftedLoglogistic
,
StudentTNoncentral
,
StudentT
,
Triangular
,
Uniform
,
Wald
,
Weibull
Other univariate distributions:
Arcsine
,
Arrdist
,
Bernoulli
,
BetaNoncentral
,
Beta
,
Binomial
,
Categorical
,
Cauchy
,
ChiSquaredNoncentral
,
ChiSquared
,
Degenerate
,
DiscreteUniform
,
Empirical
,
Erlang
,
Exponential
,
FDistributionNoncentral
,
FDistribution
,
Frechet
,
Gamma
,
Geometric
,
Gompertz
,
Gumbel
,
Hypergeometric
,
InverseGamma
,
Laplace
,
Logarithmic
,
Logistic
,
Loglogistic
,
Lognormal
,
Matdist
,
NegativeBinomial
,
Normal
,
Pareto
,
Rayleigh
,
ShiftedLoglogistic
,
StudentTNoncentral
,
StudentT
,
Triangular
,
Uniform
,
Wald
,
Weibull
,
WeightedDiscrete
A wrapper for creating the product distribution of multiple independent probability distributions.
## S3 method for class 'Distribution' x * y
## S3 method for class 'Distribution' x * y
x , y
|
A product distribution is defined by
#nolint
where is the cdf of the product distribution and
are
independent distributions.
distr6::Distribution
-> distr6::DistributionWrapper
-> distr6::VectorDistribution
-> ProductDistribution
distr6::Distribution$confidence()
distr6::Distribution$correlation()
distr6::Distribution$iqr()
distr6::Distribution$liesInSupport()
distr6::Distribution$liesInType()
distr6::Distribution$parameters()
distr6::Distribution$prec()
distr6::Distribution$print()
distr6::Distribution$setParameterValue()
distr6::Distribution$stdev()
distr6::Distribution$summary()
distr6::Distribution$workingSupport()
distr6::VectorDistribution$cf()
distr6::VectorDistribution$entropy()
distr6::VectorDistribution$getParameterValue()
distr6::VectorDistribution$kurtosis()
distr6::VectorDistribution$mean()
distr6::VectorDistribution$median()
distr6::VectorDistribution$mgf()
distr6::VectorDistribution$mode()
distr6::VectorDistribution$pgf()
distr6::VectorDistribution$rand()
distr6::VectorDistribution$skewness()
distr6::VectorDistribution$variance()
distr6::VectorDistribution$wrappedModels()
new()
Creates a new instance of this R6 class.
ProductDistribution$new( distlist = NULL, distribution = NULL, params = NULL, shared_params = NULL, name = NULL, short_name = NULL, decorators = NULL, vecdist = NULL, ids = NULL )
distlist
(list())
List of Distributions.
distribution
(character(1))
Should be supplied with params
and optionally shared_params
as an alternative to distlist
.
Much faster implementation when only one class of distribution is being wrapped. distribution
is the full name of one of the distributions in listDistributions()
, or "Distribution"
if
constructing custom distributions. See examples in VectorDistribution.
params
(list()|data.frame())
Parameters in the individual distributions for use with distribution
. Can be supplied as a list,
where each element is the list of parameters to set in the distribution, or as an object
coercable to data.frame
, where each column is a parameter and each row is a distribution.
See examples in VectorDistribution.
shared_params
(list())
If any parameters are shared when using the distribution
constructor, this provides a much faster
implementation to list and query them together. See examples in VectorDistribution.
name
(character(1))
Optional name of wrapped distribution.
short_name
(character(1))
Optional short name/ID of wrapped distribution.
decorators
(character())
Decorators to add to the distribution during construction.
vecdist
VectorDistribution
Alternative constructor to directly create this object from an object inheriting from
VectorDistribution.
ids
(character())
Optional ids for wrapped distributions in vector, should be unique and of same length as
the number of distributions.
\dontrun{ ProductDistribution$new(list(Binomial$new( prob = 0.5, size = 10 ), Normal$new(mean = 15))) ProductDistribution$new( distribution = "Binomial", params = list( list(prob = 0.1, size = 2), list(prob = 0.6, size = 4), list(prob = 0.2, size = 6) ) ) # Equivalently ProductDistribution$new( distribution = "Binomial", params = data.table::data.table(prob = c(0.1, 0.6, 0.2), size = c(2, 4, 6)) ) }
strprint()
Printable string representation of the ProductDistribution
. Primarily used internally.
ProductDistribution$strprint(n = 10)
n
(integer(1))
Number of distributions to include when printing.
pdf()
Probability density function of the product distribution. Computed by
where are the pdfs of the wrapped distributions.
ProductDistribution$pdf(..., log = FALSE, simplify = TRUE, data = NULL)
...
(numeric())
Points to evaluate the function at Arguments do not need
to be named. The length of each argument corresponds to the number of points to evaluate,
the number of arguments corresponds to the number of variables in the distribution.
See examples.
log
(logical(1))
If TRUE
returns the logarithm of the probabilities. Default is FALSE
.
simplify
logical(1)
If TRUE
(default) simplifies the return if possible to a numeric
, otherwise returns a
data.table::data.table.
data
array
Alternative method to specify points to evaluate. If univariate then rows correspond with number
of points to evaluate and columns correspond with number of variables to evaluate. In the special
case of VectorDistributions of multivariate distributions, then the third dimension corresponds
to the distribution in the vector to evaluate.
p <- ProductDistribution$new(list( Binomial$new(prob = 0.5, size = 10), Binomial$new())) p$pdf(1:5) p$pdf(1, 2) p$pdf(1:2)
cdf()
Cumulative distribution function of the product distribution. Computed by
where are the cdfs of the wrapped distributions.
ProductDistribution$cdf( ..., lower.tail = TRUE, log.p = FALSE, simplify = TRUE, data = NULL )
...
(numeric())
Points to evaluate the function at Arguments do not need
to be named. The length of each argument corresponds to the number of points to evaluate,
the number of arguments corresponds to the number of variables in the distribution.
See examples.
lower.tail
(logical(1))
If TRUE
(default), probabilities are X <= x
, otherwise, P(X > x)
.
log.p
(logical(1))
If TRUE
returns the logarithm of the probabilities. Default is FALSE
.
simplify
logical(1)
If TRUE
(default) simplifies the return if possible to a numeric
, otherwise returns a
data.table::data.table.
data
array
Alternative method to specify points to evaluate. If univariate then rows correspond with number
of points to evaluate and columns correspond with number of variables to evaluate. In the special
case of VectorDistributions of multivariate distributions, then the third dimension corresponds
to the distribution in the vector to evaluate.
p <- ProductDistribution$new(list( Binomial$new(prob = 0.5, size = 10), Binomial$new())) p$cdf(1:5) p$cdf(1, 2) p$cdf(1:2)
quantile()
The quantile function is not implemented for product distributions.
ProductDistribution$quantile( ..., lower.tail = TRUE, log.p = FALSE, simplify = TRUE, data = NULL )
...
(numeric())
Points to evaluate the function at Arguments do not need
to be named. The length of each argument corresponds to the number of points to evaluate,
the number of arguments corresponds to the number of variables in the distribution.
See examples.
lower.tail
(logical(1))
If TRUE
(default), probabilities are X <= x
, otherwise, P(X > x)
.
log.p
(logical(1))
If TRUE
returns the logarithm of the probabilities. Default is FALSE
.
simplify
logical(1)
If TRUE
(default) simplifies the return if possible to a numeric
, otherwise returns a
data.table::data.table.
data
array
Alternative method to specify points to evaluate. If univariate then rows correspond with number
of points to evaluate and columns correspond with number of variables to evaluate. In the special
case of VectorDistributions of multivariate distributions, then the third dimension corresponds
to the distribution in the vector to evaluate.
clone()
The objects of this class are cloneable with this method.
ProductDistribution$clone(deep = FALSE)
deep
Whether to make a deep clone.
Other wrappers:
Convolution
,
DistributionWrapper
,
HuberizedDistribution
,
MixtureDistribution
,
TruncatedDistribution
,
VectorDistribution
## ------------------------------------------------ ## Method `ProductDistribution$new` ## ------------------------------------------------ ## Not run: ProductDistribution$new(list(Binomial$new( prob = 0.5, size = 10 ), Normal$new(mean = 15))) ProductDistribution$new( distribution = "Binomial", params = list( list(prob = 0.1, size = 2), list(prob = 0.6, size = 4), list(prob = 0.2, size = 6) ) ) # Equivalently ProductDistribution$new( distribution = "Binomial", params = data.table::data.table(prob = c(0.1, 0.6, 0.2), size = c(2, 4, 6)) ) ## End(Not run) ## ------------------------------------------------ ## Method `ProductDistribution$pdf` ## ------------------------------------------------ p <- ProductDistribution$new(list( Binomial$new(prob = 0.5, size = 10), Binomial$new())) p$pdf(1:5) p$pdf(1, 2) p$pdf(1:2) ## ------------------------------------------------ ## Method `ProductDistribution$cdf` ## ------------------------------------------------ p <- ProductDistribution$new(list( Binomial$new(prob = 0.5, size = 10), Binomial$new())) p$cdf(1:5) p$cdf(1, 2) p$cdf(1:2) Normal$new() * Binomial$new()
## ------------------------------------------------ ## Method `ProductDistribution$new` ## ------------------------------------------------ ## Not run: ProductDistribution$new(list(Binomial$new( prob = 0.5, size = 10 ), Normal$new(mean = 15))) ProductDistribution$new( distribution = "Binomial", params = list( list(prob = 0.1, size = 2), list(prob = 0.6, size = 4), list(prob = 0.2, size = 6) ) ) # Equivalently ProductDistribution$new( distribution = "Binomial", params = data.table::data.table(prob = c(0.1, 0.6, 0.2), size = c(2, 4, 6)) ) ## End(Not run) ## ------------------------------------------------ ## Method `ProductDistribution$pdf` ## ------------------------------------------------ p <- ProductDistribution$new(list( Binomial$new(prob = 0.5, size = 10), Binomial$new())) p$pdf(1:5) p$pdf(1, 2) p$pdf(1:2) ## ------------------------------------------------ ## Method `ProductDistribution$cdf` ## ------------------------------------------------ p <- ProductDistribution$new(list( Binomial$new(prob = 0.5, size = 10), Binomial$new())) p$cdf(1:5) p$cdf(1, 2) p$cdf(1:2) Normal$new() * Binomial$new()
Quantile-quantile plots are used to compare a "theoretical" or empirical distribution to a reference distribution. They can also compare the quantiles of two reference distributions.
qqplot(x, y, npoints = 3000, idline = TRUE, plot = TRUE, ...)
qqplot(x, y, npoints = 3000, idline = TRUE, plot = TRUE, ...)
x |
|
y |
|
npoints |
number of evaluation points. |
idline |
logical; if TRUE (default), the line |
plot |
logical; if TRUE (default), figures are displayed in the plot window; otherwise a data.table::data.table of points and calculated values is returned. |
... |
graphical parameters. |
If x
or y
are given as numeric vectors then they are first passed to the
Empirical distribution. The Empirical distribution is a discrete distribution so quantiles
are equivalent to the the Type 1 method in quantile
.
Chijing Zeng
plot.Distribution
for plotting a distr6
object.
qqplot(Normal$new(mean = 15, sd = sqrt(30)), ChiSquared$new(df = 15)) qqplot(rt(200, df = 5), rt(300, df = 5), main = "QQ-Plot", xlab = "t-200", ylab = "t-300" ) qqplot(Normal$new(mean = 2), rnorm(100, mean = 3))
qqplot(Normal$new(mean = 15, sd = sqrt(30)), ChiSquared$new(df = 15)) qqplot(rt(200, df = 5), rt(300, df = 5), main = "QQ-Plot", xlab = "t-200", ylab = "t-300" ) qqplot(Normal$new(mean = 2), rnorm(100, mean = 3))
Mathematical and statistical functions for the Quartic kernel defined by the pdf,
over the support .
Quantile is omitted as no closed form analytic expression could be found, decorate with FunctionImputation for numeric results.
distr6::Distribution
-> distr6::Kernel
-> Quartic
name
Full name of distribution.
short_name
Short name of distribution for printing.
description
Brief description of the distribution.
distr6::Distribution$cdf()
distr6::Distribution$confidence()
distr6::Distribution$correlation()
distr6::Distribution$getParameterValue()
distr6::Distribution$iqr()
distr6::Distribution$liesInSupport()
distr6::Distribution$liesInType()
distr6::Distribution$parameters()
distr6::Distribution$pdf()
distr6::Distribution$prec()
distr6::Distribution$print()
distr6::Distribution$quantile()
distr6::Distribution$rand()
distr6::Distribution$setParameterValue()
distr6::Distribution$stdev()
distr6::Distribution$strprint()
distr6::Distribution$summary()
distr6::Distribution$workingSupport()
distr6::Kernel$initialize()
distr6::Kernel$mean()
distr6::Kernel$median()
distr6::Kernel$mode()
distr6::Kernel$skewness()
pdfSquared2Norm()
The squared 2-norm of the pdf is defined by
where X is the Distribution, is its pdf and
are the distribution support limits.
Quartic$pdfSquared2Norm(x = 0, upper = Inf)
x
(numeric(1))
Amount to shift the result.
upper
(numeric(1))
Upper limit of the integral.
cdfSquared2Norm()
The squared 2-norm of the cdf is defined by
where X is the Distribution, is its pdf and
are the distribution support limits.
Quartic$cdfSquared2Norm(x = 0, upper = 0)
x
(numeric(1))
Amount to shift the result.
upper
(numeric(1))
Upper limit of the integral.
variance()
The variance of a distribution is defined by the formula
where is the expectation of distribution X. If the distribution is multivariate the
covariance matrix is returned.
Quartic$variance(...)
...
Unused.
clone()
The objects of this class are cloneable with this method.
Quartic$clone(deep = FALSE)
deep
Whether to make a deep clone.
Other kernels:
Cosine
,
Epanechnikov
,
LogisticKernel
,
NormalKernel
,
Sigmoid
,
Silverman
,
TriangularKernel
,
Tricube
,
Triweight
,
UniformKernel
Mathematical and statistical functions for the Rayleigh distribution, which is commonly used to model random complex numbers..
The Rayleigh distribution parameterised with mode (or scale), , is defined by the pdf,
for .
Returns an R6 object inheriting from class SDistribution.
The distribution is supported on .
Rayl(mode = 1)
N/A
N/A
distr6::Distribution
-> distr6::SDistribution
-> Rayleigh
name
Full name of distribution.
short_name
Short name of distribution for printing.
description
Brief description of the distribution.
alias
Alias of the distribution.
packages
Packages required to be installed in order to construct the distribution.
distr6::Distribution$cdf()
distr6::Distribution$confidence()
distr6::Distribution$correlation()
distr6::Distribution$getParameterValue()
distr6::Distribution$iqr()
distr6::Distribution$liesInSupport()
distr6::Distribution$liesInType()
distr6::Distribution$parameters()
distr6::Distribution$pdf()
distr6::Distribution$prec()
distr6::Distribution$print()
distr6::Distribution$quantile()
distr6::Distribution$rand()
distr6::Distribution$setParameterValue()
distr6::Distribution$stdev()
distr6::Distribution$strprint()
distr6::Distribution$summary()
distr6::Distribution$workingSupport()
new()
Creates a new instance of this R6 class.
Rayleigh$new(mode = NULL, decorators = NULL)
mode
(numeric(1))
Mode of the distribution, defined on the positive Reals. Scale parameter.
decorators
(character())
Decorators to add to the distribution during construction.
mean()
The arithmetic mean of a (discrete) probability distribution X is the expectation
with an integration analogue for continuous distributions.
Rayleigh$mean(...)
...
Unused.
mode()
The mode of a probability distribution is the point at which the pdf is a local maximum, a distribution can be unimodal (one maximum) or multimodal (several maxima).
Rayleigh$mode(which = "all")
which
(character(1) | numeric(1)
Ignored if distribution is unimodal. Otherwise "all"
returns all modes, otherwise specifies
which mode to return.
median()
Returns the median of the distribution. If an analytical expression is available
returns distribution median, otherwise if symmetric returns self$mean
, otherwise
returns self$quantile(0.5)
.
Rayleigh$median()
variance()
The variance of a distribution is defined by the formula
where is the expectation of distribution X. If the distribution is multivariate the
covariance matrix is returned.
Rayleigh$variance(...)
...
Unused.
skewness()
The skewness of a distribution is defined by the third standardised moment,
where is the expectation of distribution X,
is the mean of the
distribution and
is the standard deviation of the distribution.
Rayleigh$skewness(...)
...
Unused.
kurtosis()
The kurtosis of a distribution is defined by the fourth standardised moment,
where is the expectation of distribution X,
is the mean of the
distribution and
is the standard deviation of the distribution.
Excess Kurtosis is Kurtosis - 3.
Rayleigh$kurtosis(excess = TRUE, ...)
excess
(logical(1))
If TRUE
(default) excess kurtosis returned.
...
Unused.
entropy()
The entropy of a (discrete) distribution is defined by
where is the pdf of distribution X, with an integration analogue for
continuous distributions.
Rayleigh$entropy(base = 2, ...)
base
(integer(1))
Base of the entropy logarithm, default = 2 (Shannon entropy)
...
Unused.
pgf()
The probability generating function is defined by
where X is the distribution and is the expectation of the distribution X.
Rayleigh$pgf(z, ...)
z
(integer(1))
z integer to evaluate probability generating function at.
...
Unused.
clone()
The objects of this class are cloneable with this method.
Rayleigh$clone(deep = FALSE)
deep
Whether to make a deep clone.
McLaughlin, M. P. (2001). A compendium of common probability distributions (pp. 2014-01). Michael P. McLaughlin.
Other continuous distributions:
Arcsine
,
BetaNoncentral
,
Beta
,
Cauchy
,
ChiSquaredNoncentral
,
ChiSquared
,
Dirichlet
,
Erlang
,
Exponential
,
FDistributionNoncentral
,
FDistribution
,
Frechet
,
Gamma
,
Gompertz
,
Gumbel
,
InverseGamma
,
Laplace
,
Logistic
,
Loglogistic
,
Lognormal
,
MultivariateNormal
,
Normal
,
Pareto
,
Poisson
,
ShiftedLoglogistic
,
StudentTNoncentral
,
StudentT
,
Triangular
,
Uniform
,
Wald
,
Weibull
Other univariate distributions:
Arcsine
,
Arrdist
,
Bernoulli
,
BetaNoncentral
,
Beta
,
Binomial
,
Categorical
,
Cauchy
,
ChiSquaredNoncentral
,
ChiSquared
,
Degenerate
,
DiscreteUniform
,
Empirical
,
Erlang
,
Exponential
,
FDistributionNoncentral
,
FDistribution
,
Frechet
,
Gamma
,
Geometric
,
Gompertz
,
Gumbel
,
Hypergeometric
,
InverseGamma
,
Laplace
,
Logarithmic
,
Logistic
,
Loglogistic
,
Lognormal
,
Matdist
,
NegativeBinomial
,
Normal
,
Pareto
,
Poisson
,
ShiftedLoglogistic
,
StudentTNoncentral
,
StudentT
,
Triangular
,
Uniform
,
Wald
,
Weibull
,
WeightedDiscrete
Replicates a constructed distribution into either a
VectorDistribution (class = "vector"
)
ProductDistribution (class = "product"
)
MixtureDistribution (class = "mixture"
)
If the distribution is not a custom Distribution then uses the more efficient
distribution/params
constructor, otherwise uses distlist
.
## S3 method for class 'Distribution' rep(x, times, class = c("vector", "product", "mixture"), ...)
## S3 method for class 'Distribution' rep(x, times, class = c("vector", "product", "mixture"), ...)
x |
|
times |
|
class |
|
... |
Additional arguments, currently unused. |
rep(Binomial$new(), 10) rep(Gamma$new(), 2, class = "product")
rep(Binomial$new(), 10) rep(Gamma$new(), 2, class = "product")
Abstract class that cannot be constructed directly.
Returns error. Abstract classes cannot be constructed directly.
distr6::Distribution
-> SDistribution
package
Deprecated, use $packages
instead.
packages
Packages required to be installed in order to construct the distribution.
distr6::Distribution$cdf()
distr6::Distribution$confidence()
distr6::Distribution$correlation()
distr6::Distribution$getParameterValue()
distr6::Distribution$iqr()
distr6::Distribution$liesInSupport()
distr6::Distribution$liesInType()
distr6::Distribution$median()
distr6::Distribution$parameters()
distr6::Distribution$pdf()
distr6::Distribution$prec()
distr6::Distribution$print()
distr6::Distribution$quantile()
distr6::Distribution$rand()
distr6::Distribution$setParameterValue()
distr6::Distribution$stdev()
distr6::Distribution$strprint()
distr6::Distribution$summary()
distr6::Distribution$workingSupport()
new()
Creates a new instance of this R6 class.
SDistribution$new( decorators, support, type, symmetry = c("asymmetric", "symmetric") )
decorators
(character())
Decorators to add to the distribution during construction.
support
[set6::Set]
Support of the distribution.
type
[set6::Set]
Type of the distribution.
symmetry
character(1)
Distribution symmetry type, default "asymmetric".
clone()
The objects of this class are cloneable with this method.
SDistribution$clone(deep = FALSE)
deep
Whether to make a deep clone.
Mathematical and statistical functions for the Shifted Log-Logistic distribution, which is commonly used in survival analysis for its non-monotonic hazard as well as in economics, a generalised variant of Loglogistic.
The Shifted Log-Logistic distribution parameterised with shape, , scale,
, and location,
, is defined by the pdf,
for and
.
Returns an R6 object inheriting from class SDistribution.
The distribution is supported on the non-negative Reals.
ShiftLLogis(scale = 1, shape = 1, location = 0)
N/A
N/A
distr6::Distribution
-> distr6::SDistribution
-> ShiftedLoglogistic
name
Full name of distribution.
short_name
Short name of distribution for printing.
description
Brief description of the distribution.
alias
Alias of the distribution.
packages
Packages required to be installed in order to construct the distribution.
properties
Returns distribution properties, including skewness type and symmetry.
distr6::Distribution$cdf()
distr6::Distribution$confidence()
distr6::Distribution$correlation()
distr6::Distribution$getParameterValue()
distr6::Distribution$iqr()
distr6::Distribution$liesInSupport()
distr6::Distribution$liesInType()
distr6::Distribution$parameters()
distr6::Distribution$pdf()
distr6::Distribution$prec()
distr6::Distribution$print()
distr6::Distribution$quantile()
distr6::Distribution$rand()
distr6::Distribution$setParameterValue()
distr6::Distribution$stdev()
distr6::Distribution$strprint()
distr6::Distribution$summary()
distr6::Distribution$workingSupport()
new()
Creates a new instance of this R6 class.
ShiftedLoglogistic$new( scale = NULL, shape = NULL, location = NULL, rate = NULL, decorators = NULL )
scale
numeric(1))
Scale parameter of the distribution, defined on the positive Reals. scale = 1/rate
.
If provided rate
is ignored.
shape
(numeric(1))
Shape parameter, defined on the positive Reals.
location
(numeric(1))
Location parameter, defined on the Reals.
rate
(numeric(1))
Rate parameter of the distribution, defined on the positive Reals.
decorators
(character())
Decorators to add to the distribution during construction.
mean()
The arithmetic mean of a (discrete) probability distribution X is the expectation
with an integration analogue for continuous distributions.
ShiftedLoglogistic$mean(...)
...
Unused.
mode()
The mode of a probability distribution is the point at which the pdf is a local maximum, a distribution can be unimodal (one maximum) or multimodal (several maxima).
ShiftedLoglogistic$mode(which = "all")
which
(character(1) | numeric(1)
Ignored if distribution is unimodal. Otherwise "all"
returns all modes, otherwise specifies
which mode to return.
median()
Returns the median of the distribution. If an analytical expression is available
returns distribution median, otherwise if symmetric returns self$mean
, otherwise
returns self$quantile(0.5)
.
ShiftedLoglogistic$median()
variance()
The variance of a distribution is defined by the formula
where is the expectation of distribution X. If the distribution is multivariate the
covariance matrix is returned.
ShiftedLoglogistic$variance(...)
...
Unused.
pgf()
The probability generating function is defined by
where X is the distribution and is the expectation of the distribution X.
ShiftedLoglogistic$pgf(z, ...)
z
(integer(1))
z integer to evaluate probability generating function at.
...
Unused.
clone()
The objects of this class are cloneable with this method.
ShiftedLoglogistic$clone(deep = FALSE)
deep
Whether to make a deep clone.
McLaughlin, M. P. (2001). A compendium of common probability distributions (pp. 2014-01). Michael P. McLaughlin.
Other continuous distributions:
Arcsine
,
BetaNoncentral
,
Beta
,
Cauchy
,
ChiSquaredNoncentral
,
ChiSquared
,
Dirichlet
,
Erlang
,
Exponential
,
FDistributionNoncentral
,
FDistribution
,
Frechet
,
Gamma
,
Gompertz
,
Gumbel
,
InverseGamma
,
Laplace
,
Logistic
,
Loglogistic
,
Lognormal
,
MultivariateNormal
,
Normal
,
Pareto
,
Poisson
,
Rayleigh
,
StudentTNoncentral
,
StudentT
,
Triangular
,
Uniform
,
Wald
,
Weibull
Other univariate distributions:
Arcsine
,
Arrdist
,
Bernoulli
,
BetaNoncentral
,
Beta
,
Binomial
,
Categorical
,
Cauchy
,
ChiSquaredNoncentral
,
ChiSquared
,
Degenerate
,
DiscreteUniform
,
Empirical
,
Erlang
,
Exponential
,
FDistributionNoncentral
,
FDistribution
,
Frechet
,
Gamma
,
Geometric
,
Gompertz
,
Gumbel
,
Hypergeometric
,
InverseGamma
,
Laplace
,
Logarithmic
,
Logistic
,
Loglogistic
,
Lognormal
,
Matdist
,
NegativeBinomial
,
Normal
,
Pareto
,
Poisson
,
Rayleigh
,
StudentTNoncentral
,
StudentT
,
Triangular
,
Uniform
,
Wald
,
Weibull
,
WeightedDiscrete
Mathematical and statistical functions for the Sigmoid kernel defined by the pdf,
over the support .
The cdf and quantile functions are omitted as no closed form analytic expressions could be found, decorate with FunctionImputation for numeric results.
distr6::Distribution
-> distr6::Kernel
-> Sigmoid
name
Full name of distribution.
short_name
Short name of distribution for printing.
description
Brief description of the distribution.
distr6::Distribution$cdf()
distr6::Distribution$confidence()
distr6::Distribution$correlation()
distr6::Distribution$getParameterValue()
distr6::Distribution$iqr()
distr6::Distribution$liesInSupport()
distr6::Distribution$liesInType()
distr6::Distribution$parameters()
distr6::Distribution$pdf()
distr6::Distribution$prec()
distr6::Distribution$print()
distr6::Distribution$quantile()
distr6::Distribution$rand()
distr6::Distribution$setParameterValue()
distr6::Distribution$stdev()
distr6::Distribution$strprint()
distr6::Distribution$summary()
distr6::Distribution$workingSupport()
distr6::Kernel$cdfSquared2Norm()
distr6::Kernel$mean()
distr6::Kernel$median()
distr6::Kernel$mode()
distr6::Kernel$skewness()
new()
Creates a new instance of this R6 class.
Sigmoid$new(decorators = NULL)
decorators
(character())
Decorators to add to the distribution during construction.
pdfSquared2Norm()
The squared 2-norm of the pdf is defined by
where X is the Distribution, is its pdf and
are the distribution support limits.
Sigmoid$pdfSquared2Norm(x = 0, upper = Inf)
x
(numeric(1))
Amount to shift the result.
upper
(numeric(1))
Upper limit of the integral.
variance()
The variance of a distribution is defined by the formula
where is the expectation of distribution X. If the distribution is multivariate the
covariance matrix is returned.
Sigmoid$variance(...)
...
Unused.
clone()
The objects of this class are cloneable with this method.
Sigmoid$clone(deep = FALSE)
deep
Whether to make a deep clone.
Other kernels:
Cosine
,
Epanechnikov
,
LogisticKernel
,
NormalKernel
,
Quartic
,
Silverman
,
TriangularKernel
,
Tricube
,
Triweight
,
UniformKernel
Mathematical and statistical functions for the Silverman kernel defined by the pdf,
over the support .
The cdf and quantile functions are omitted as no closed form analytic expressions could be found, decorate with FunctionImputation for numeric results.
distr6::Distribution
-> distr6::Kernel
-> Silverman
name
Full name of distribution.
short_name
Short name of distribution for printing.
description
Brief description of the distribution.
distr6::Distribution$cdf()
distr6::Distribution$confidence()
distr6::Distribution$correlation()
distr6::Distribution$getParameterValue()
distr6::Distribution$iqr()
distr6::Distribution$liesInSupport()
distr6::Distribution$liesInType()
distr6::Distribution$parameters()
distr6::Distribution$pdf()
distr6::Distribution$prec()
distr6::Distribution$print()
distr6::Distribution$quantile()
distr6::Distribution$rand()
distr6::Distribution$setParameterValue()
distr6::Distribution$stdev()
distr6::Distribution$strprint()
distr6::Distribution$summary()
distr6::Distribution$workingSupport()
distr6::Kernel$mean()
distr6::Kernel$median()
distr6::Kernel$mode()
distr6::Kernel$skewness()
new()
Creates a new instance of this R6 class.
Silverman$new(decorators = NULL)
decorators
(character())
Decorators to add to the distribution during construction.
pdfSquared2Norm()
The squared 2-norm of the pdf is defined by
where X is the Distribution, is its pdf and
are the distribution support limits.
Silverman$pdfSquared2Norm(x = 0, upper = Inf)
x
(numeric(1))
Amount to shift the result.
upper
(numeric(1))
Upper limit of the integral.
cdfSquared2Norm()
The squared 2-norm of the cdf is defined by
where X is the Distribution, is its pdf and
are the distribution support limits.
Silverman$cdfSquared2Norm(x = 0, upper = 0)
x
(numeric(1))
Amount to shift the result.
upper
(numeric(1))
Upper limit of the integral.
variance()
The variance of a distribution is defined by the formula
where is the expectation of distribution X. If the distribution is multivariate the
covariance matrix is returned.
Silverman$variance(...)
...
Unused.
clone()
The objects of this class are cloneable with this method.
Silverman$clone(deep = FALSE)
deep
Whether to make a deep clone.
Other kernels:
Cosine
,
Epanechnikov
,
LogisticKernel
,
NormalKernel
,
Quartic
,
Sigmoid
,
TriangularKernel
,
Tricube
,
Triweight
,
UniformKernel
Function to sample Empirical Distributions without replacement, as
opposed to the rand
method which samples with replacement.
simulateEmpiricalDistribution(EmpiricalDist, n, seed = NULL)
simulateEmpiricalDistribution(EmpiricalDist, n, seed = NULL)
EmpiricalDist |
Empirical Distribution |
n |
Number of samples to generate. See Details. |
seed |
Numeric passed to |
This function can only be used to sample from the Empirical
distribution without
replacement, and will return an error for other distributions.
The seed
param ensures that the same samples can be reproduced and is more convenient than
using the set.seed()
function each time before use. If set.seed
is NULL
then the
seed is left unchanged (NULL is not passed to the set.seed
function).
If n
is of length greater than one, then n
is taken to be the length of n
.
If n
is greater than the number of observations in the Empirical distribution, then
n
is taken to be the number of observations in the distribution.
A vector of length n
with elements drawn without replacement from the given
Empirical distribution.
Gets the type of skewness
skewType(skew)
skewType(skew)
skew |
numeric |
Skewness is a measure of asymmetry of a distribution.
A distribution can either have negative skew, no skew or positive skew. A symmetric distribution will always have no skew but the reverse relationship does not always hold.
Returns one of 'negative skew', 'no skew' or 'positive skew'.
skewType(1) skewType(0) skewType(-1)
skewType(1) skewType(0) skewType(-1)
Mathematical and statistical functions for the Student's T distribution, which is commonly used to estimate the mean of populations with unknown variance from a small sample size, as well as in t-testing for difference of means and regression analysis.
The Student's T distribution parameterised with degrees of freedom, , is defined by the pdf,
for .
Returns an R6 object inheriting from class SDistribution.
The distribution is supported on the Reals.
T(df = 1)
N/A
N/A
distr6::Distribution
-> distr6::SDistribution
-> StudentT
name
Full name of distribution.
short_name
Short name of distribution for printing.
description
Brief description of the distribution.
alias
Alias of the distribution.
packages
Packages required to be installed in order to construct the distribution.
distr6::Distribution$cdf()
distr6::Distribution$confidence()
distr6::Distribution$correlation()
distr6::Distribution$getParameterValue()
distr6::Distribution$iqr()
distr6::Distribution$liesInSupport()
distr6::Distribution$liesInType()
distr6::Distribution$median()
distr6::Distribution$parameters()
distr6::Distribution$pdf()
distr6::Distribution$prec()
distr6::Distribution$print()
distr6::Distribution$quantile()
distr6::Distribution$rand()
distr6::Distribution$setParameterValue()
distr6::Distribution$stdev()
distr6::Distribution$strprint()
distr6::Distribution$summary()
distr6::Distribution$workingSupport()
new()
Creates a new instance of this R6 class.
StudentT$new(df = NULL, decorators = NULL)
df
(integer(1))
Degrees of freedom of the distribution defined on the positive Reals.
decorators
(character())
Decorators to add to the distribution during construction.
mean()
The arithmetic mean of a (discrete) probability distribution X is the expectation
with an integration analogue for continuous distributions.
StudentT$mean(...)
...
Unused.
mode()
The mode of a probability distribution is the point at which the pdf is a local maximum, a distribution can be unimodal (one maximum) or multimodal (several maxima).
StudentT$mode(which = "all")
which
(character(1) | numeric(1)
Ignored if distribution is unimodal. Otherwise "all"
returns all modes, otherwise specifies
which mode to return.
variance()
The variance of a distribution is defined by the formula
where is the expectation of distribution X. If the distribution is multivariate the
covariance matrix is returned.
StudentT$variance(...)
...
Unused.
skewness()
The skewness of a distribution is defined by the third standardised moment,
where is the expectation of distribution X,
is the mean of the
distribution and
is the standard deviation of the distribution.
StudentT$skewness(...)
...
Unused.
kurtosis()
The kurtosis of a distribution is defined by the fourth standardised moment,
where is the expectation of distribution X,
is the mean of the
distribution and
is the standard deviation of the distribution.
Excess Kurtosis is Kurtosis - 3.
StudentT$kurtosis(excess = TRUE, ...)
excess
(logical(1))
If TRUE
(default) excess kurtosis returned.
...
Unused.
entropy()
The entropy of a (discrete) distribution is defined by
where is the pdf of distribution X, with an integration analogue for
continuous distributions.
StudentT$entropy(base = 2, ...)
base
(integer(1))
Base of the entropy logarithm, default = 2 (Shannon entropy)
...
Unused.
mgf()
The moment generating function is defined by
where X is the distribution and is the expectation of the distribution X.
StudentT$mgf(t, ...)
t
(integer(1))
t integer to evaluate function at.
...
Unused.
cf()
The characteristic function is defined by
where X is the distribution and is the expectation of the distribution X.
StudentT$cf(t, ...)
t
(integer(1))
t integer to evaluate function at.
...
Unused.
pgf()
The probability generating function is defined by
where X is the distribution and is the expectation of the distribution X.
StudentT$pgf(z, ...)
z
(integer(1))
z integer to evaluate probability generating function at.
...
Unused.
clone()
The objects of this class are cloneable with this method.
StudentT$clone(deep = FALSE)
deep
Whether to make a deep clone.
Chijing Zeng
McLaughlin, M. P. (2001). A compendium of common probability distributions (pp. 2014-01). Michael P. McLaughlin.
Other continuous distributions:
Arcsine
,
BetaNoncentral
,
Beta
,
Cauchy
,
ChiSquaredNoncentral
,
ChiSquared
,
Dirichlet
,
Erlang
,
Exponential
,
FDistributionNoncentral
,
FDistribution
,
Frechet
,
Gamma
,
Gompertz
,
Gumbel
,
InverseGamma
,
Laplace
,
Logistic
,
Loglogistic
,
Lognormal
,
MultivariateNormal
,
Normal
,
Pareto
,
Poisson
,
Rayleigh
,
ShiftedLoglogistic
,
StudentTNoncentral
,
Triangular
,
Uniform
,
Wald
,
Weibull
Other univariate distributions:
Arcsine
,
Arrdist
,
Bernoulli
,
BetaNoncentral
,
Beta
,
Binomial
,
Categorical
,
Cauchy
,
ChiSquaredNoncentral
,
ChiSquared
,
Degenerate
,
DiscreteUniform
,
Empirical
,
Erlang
,
Exponential
,
FDistributionNoncentral
,
FDistribution
,
Frechet
,
Gamma
,
Geometric
,
Gompertz
,
Gumbel
,
Hypergeometric
,
InverseGamma
,
Laplace
,
Logarithmic
,
Logistic
,
Loglogistic
,
Lognormal
,
Matdist
,
NegativeBinomial
,
Normal
,
Pareto
,
Poisson
,
Rayleigh
,
ShiftedLoglogistic
,
StudentTNoncentral
,
Triangular
,
Uniform
,
Wald
,
Weibull
,
WeightedDiscrete
Mathematical and statistical functions for the Noncentral Student's T distribution, which is commonly used to estimate the mean of populations with unknown variance from a small sample size, as well as in t-testing for difference of means and regression analysis.
The Noncentral Student's T distribution parameterised with degrees of freedom, and location,
, is defined by the pdf,
for ,
.
Returns an R6 object inheriting from class SDistribution.
The distribution is supported on the Reals.
TNS(df = 1, location = 0)
N/A
N/A
distr6::Distribution
-> distr6::SDistribution
-> StudentTNoncentral
name
Full name of distribution.
short_name
Short name of distribution for printing.
description
Brief description of the distribution.
alias
Alias of the distribution.
packages
Packages required to be installed in order to construct the distribution.
distr6::Distribution$cdf()
distr6::Distribution$confidence()
distr6::Distribution$correlation()
distr6::Distribution$getParameterValue()
distr6::Distribution$iqr()
distr6::Distribution$liesInSupport()
distr6::Distribution$liesInType()
distr6::Distribution$median()
distr6::Distribution$parameters()
distr6::Distribution$pdf()
distr6::Distribution$prec()
distr6::Distribution$print()
distr6::Distribution$quantile()
distr6::Distribution$rand()
distr6::Distribution$setParameterValue()
distr6::Distribution$stdev()
distr6::Distribution$strprint()
distr6::Distribution$summary()
distr6::Distribution$workingSupport()
new()
Creates a new instance of this R6 class.
StudentTNoncentral$new(df = NULL, location = NULL, decorators = NULL)
df
(integer(1))
Degrees of freedom of the distribution defined on the positive Reals.
location
(numeric(1))
Location parameter, defined on the Reals.
decorators
(character())
Decorators to add to the distribution during construction.
mean()
The arithmetic mean of a (discrete) probability distribution X is the expectation
with an integration analogue for continuous distributions.
StudentTNoncentral$mean(...)
...
Unused.
variance()
The variance of a distribution is defined by the formula
where is the expectation of distribution X. If the distribution is multivariate the
covariance matrix is returned.
StudentTNoncentral$variance(...)
...
Unused.
clone()
The objects of this class are cloneable with this method.
StudentTNoncentral$clone(deep = FALSE)
deep
Whether to make a deep clone.
Jordan Deenichin
McLaughlin, M. P. (2001). A compendium of common probability distributions (pp. 2014-01). Michael P. McLaughlin.
Other continuous distributions:
Arcsine
,
BetaNoncentral
,
Beta
,
Cauchy
,
ChiSquaredNoncentral
,
ChiSquared
,
Dirichlet
,
Erlang
,
Exponential
,
FDistributionNoncentral
,
FDistribution
,
Frechet
,
Gamma
,
Gompertz
,
Gumbel
,
InverseGamma
,
Laplace
,
Logistic
,
Loglogistic
,
Lognormal
,
MultivariateNormal
,
Normal
,
Pareto
,
Poisson
,
Rayleigh
,
ShiftedLoglogistic
,
StudentT
,
Triangular
,
Uniform
,
Wald
,
Weibull
Other univariate distributions:
Arcsine
,
Arrdist
,
Bernoulli
,
BetaNoncentral
,
Beta
,
Binomial
,
Categorical
,
Cauchy
,
ChiSquaredNoncentral
,
ChiSquared
,
Degenerate
,
DiscreteUniform
,
Empirical
,
Erlang
,
Exponential
,
FDistributionNoncentral
,
FDistribution
,
Frechet
,
Gamma
,
Geometric
,
Gompertz
,
Gumbel
,
Hypergeometric
,
InverseGamma
,
Laplace
,
Logarithmic
,
Logistic
,
Loglogistic
,
Lognormal
,
Matdist
,
NegativeBinomial
,
Normal
,
Pareto
,
Poisson
,
Rayleigh
,
ShiftedLoglogistic
,
StudentT
,
Triangular
,
Uniform
,
Wald
,
Weibull
,
WeightedDiscrete
Validation checks to test if Distribution is continuous.
testContinuous( object, errormsg = paste(object$short_name, "is not continuous") ) checkContinuous( object, errormsg = paste(object$short_name, "is not continuous") ) assertContinuous( object, errormsg = paste(object$short_name, "is not continuous") )
testContinuous( object, errormsg = paste(object$short_name, "is not continuous") ) checkContinuous( object, errormsg = paste(object$short_name, "is not continuous") ) assertContinuous( object, errormsg = paste(object$short_name, "is not continuous") )
object |
Distribution |
errormsg |
custom error message to return if assert/check fails |
If check passes then assert
returns invisibly and test
/check
return TRUE
. If check fails, assert
stops code with error, check
returns
an error message as string, test
returns FALSE
.
testContinuous(Binomial$new()) # FALSE
testContinuous(Binomial$new()) # FALSE
Validation checks to test if Distribution is discrete.
testDiscrete(object, errormsg = paste(object$short_name, "is not discrete")) checkDiscrete(object, errormsg = paste(object$short_name, "is not discrete")) assertDiscrete(object, errormsg = paste(object$short_name, "is not discrete"))
testDiscrete(object, errormsg = paste(object$short_name, "is not discrete")) checkDiscrete(object, errormsg = paste(object$short_name, "is not discrete")) assertDiscrete(object, errormsg = paste(object$short_name, "is not discrete"))
object |
Distribution |
errormsg |
custom error message to return if assert/check fails |
If check passes then assert
returns invisibly and test
/check
return TRUE
. If check fails, assert
stops code with error, check
returns
an error message as string, test
returns FALSE
.
testDiscrete(Binomial$new()) # FALSE
testDiscrete(Binomial$new()) # FALSE
Validation checks to test if a given object is a Distribution.
testDistribution( object, errormsg = paste(object, "is not an R6 Distribution object") ) checkDistribution( object, errormsg = paste(object, "is not an R6 Distribution object") ) assertDistribution( object, errormsg = paste(object, "is not an R6 Distribution object") )
testDistribution( object, errormsg = paste(object, "is not an R6 Distribution object") ) checkDistribution( object, errormsg = paste(object, "is not an R6 Distribution object") ) assertDistribution( object, errormsg = paste(object, "is not an R6 Distribution object") )
object |
object to test |
errormsg |
custom error message to return if assert/check fails |
If check passes then assert
returns invisibly and test
/check
return TRUE
. If check fails, assert
stops code with error, check
returns
an error message as string, test
returns FALSE
.
testDistribution(5) # FALSE testDistribution(Binomial$new()) # TRUE
testDistribution(5) # FALSE testDistribution(Binomial$new()) # TRUE
Validation checks to test if a given object is a list of Distributions.
testDistributionList( object, errormsg = "One or more items in the list are not Distributions" ) checkDistributionList( object, errormsg = "One or more items in the list are not Distributions" ) assertDistributionList( object, errormsg = "One or more items in the list are not Distributions" )
testDistributionList( object, errormsg = "One or more items in the list are not Distributions" ) checkDistributionList( object, errormsg = "One or more items in the list are not Distributions" ) assertDistributionList( object, errormsg = "One or more items in the list are not Distributions" )
object |
object to test |
errormsg |
custom error message to return if assert/check fails |
If check passes then assert
returns invisibly and test
/check
return TRUE
. If check fails, assert
stops code with error, check
returns
an error message as string, test
returns FALSE
.
testDistributionList(list(Binomial$new(), 5)) # FALSE testDistributionList(list(Binomial$new(), Exponential$new())) # TRUE
testDistributionList(list(Binomial$new(), 5)) # FALSE testDistributionList(list(Binomial$new(), Exponential$new())) # TRUE
Validation checks to test if Distribution is leptokurtic.
testLeptokurtic( object, errormsg = paste(object$short_name, "is not leptokurtic") ) checkLeptokurtic( object, errormsg = paste(object$short_name, "is not leptokurtic") ) assertLeptokurtic( object, errormsg = paste(object$short_name, "is not leptokurtic") )
testLeptokurtic( object, errormsg = paste(object$short_name, "is not leptokurtic") ) checkLeptokurtic( object, errormsg = paste(object$short_name, "is not leptokurtic") ) assertLeptokurtic( object, errormsg = paste(object$short_name, "is not leptokurtic") )
object |
Distribution |
errormsg |
custom error message to return if assert/check fails |
If check passes then assert
returns invisibly and test
/check
return TRUE
. If check fails, assert
stops code with error, check
returns
an error message as string, test
returns FALSE
.
testLeptokurtic(Binomial$new())
testLeptokurtic(Binomial$new())
Validation checks to test if Distribution is matrixvariate.
testMatrixvariate( object, errormsg = paste(object$short_name, "is not matrixvariate") ) checkMatrixvariate( object, errormsg = paste(object$short_name, "is not matrixvariate") ) assertMatrixvariate( object, errormsg = paste(object$short_name, "is not matrixvariate") )
testMatrixvariate( object, errormsg = paste(object$short_name, "is not matrixvariate") ) checkMatrixvariate( object, errormsg = paste(object$short_name, "is not matrixvariate") ) assertMatrixvariate( object, errormsg = paste(object$short_name, "is not matrixvariate") )
object |
Distribution |
errormsg |
custom error message to return if assert/check fails |
If check passes then assert
returns invisibly and test
/check
return TRUE
. If check fails, assert
stops code with error, check
returns
an error message as string, test
returns FALSE
.
testMatrixvariate(Binomial$new()) # FALSE
testMatrixvariate(Binomial$new()) # FALSE
Validation checks to test if Distribution is mesokurtic.
testMesokurtic( object, errormsg = paste(object$short_name, "is not mesokurtic") ) checkMesokurtic( object, errormsg = paste(object$short_name, "is not mesokurtic") ) assertMesokurtic( object, errormsg = paste(object$short_name, "is not mesokurtic") )
testMesokurtic( object, errormsg = paste(object$short_name, "is not mesokurtic") ) checkMesokurtic( object, errormsg = paste(object$short_name, "is not mesokurtic") ) assertMesokurtic( object, errormsg = paste(object$short_name, "is not mesokurtic") )
object |
Distribution |
errormsg |
custom error message to return if assert/check fails |
If check passes then assert
returns invisibly and test
/check
return TRUE
. If check fails, assert
stops code with error, check
returns
an error message as string, test
returns FALSE
.
testMesokurtic(Binomial$new())
testMesokurtic(Binomial$new())
Validation checks to test if Distribution is mixture.
testMixture(object, errormsg = paste(object$short_name, "is not mixture")) checkMixture(object, errormsg = paste(object$short_name, "is not mixture")) assertMixture(object, errormsg = paste(object$short_name, "is not mixture"))
testMixture(object, errormsg = paste(object$short_name, "is not mixture")) checkMixture(object, errormsg = paste(object$short_name, "is not mixture")) assertMixture(object, errormsg = paste(object$short_name, "is not mixture"))
object |
Distribution |
errormsg |
custom error message to return if assert/check fails |
If check passes then assert
returns invisibly and test
/check
return TRUE
. If check fails, assert
stops code with error, check
returns
an error message as string, test
returns FALSE
.
testMixture(Binomial$new()) # FALSE
testMixture(Binomial$new()) # FALSE
Validation checks to test if Distribution is multivariate.
testMultivariate( object, errormsg = paste(object$short_name, "is not multivariate") ) checkMultivariate( object, errormsg = paste(object$short_name, "is not multivariate") ) assertMultivariate( object, errormsg = paste(object$short_name, "is not multivariate") )
testMultivariate( object, errormsg = paste(object$short_name, "is not multivariate") ) checkMultivariate( object, errormsg = paste(object$short_name, "is not multivariate") ) assertMultivariate( object, errormsg = paste(object$short_name, "is not multivariate") )
object |
Distribution |
errormsg |
custom error message to return if assert/check fails |
If check passes then assert
returns invisibly and test
/check
return TRUE
. If check fails, assert
stops code with error, check
returns
an error message as string, test
returns FALSE
.
testMultivariate(Binomial$new()) # FALSE
testMultivariate(Binomial$new()) # FALSE
Validation checks to test if Distribution is negative skew.
testNegativeSkew( object, errormsg = paste(object$short_name, "is not negative skew") ) checkNegativeSkew( object, errormsg = paste(object$short_name, "is not negative skew") ) assertNegativeSkew( object, errormsg = paste(object$short_name, "is not negative skew") )
testNegativeSkew( object, errormsg = paste(object$short_name, "is not negative skew") ) checkNegativeSkew( object, errormsg = paste(object$short_name, "is not negative skew") ) assertNegativeSkew( object, errormsg = paste(object$short_name, "is not negative skew") )
object |
Distribution |
errormsg |
custom error message to return if assert/check fails |
If check passes then assert
returns invisibly and test
/check
return TRUE
. If check fails, assert
stops code with error, check
returns
an error message as string, test
returns FALSE
.
testNegativeSkew(Binomial$new())
testNegativeSkew(Binomial$new())
Validation checks to test if Distribution is no skew.
testNoSkew(object, errormsg = paste(object$short_name, "is not no skew")) checkNoSkew(object, errormsg = paste(object$short_name, "is not no skew")) assertNoSkew(object, errormsg = paste(object$short_name, "is not no skew"))
testNoSkew(object, errormsg = paste(object$short_name, "is not no skew")) checkNoSkew(object, errormsg = paste(object$short_name, "is not no skew")) assertNoSkew(object, errormsg = paste(object$short_name, "is not no skew"))
object |
Distribution |
errormsg |
custom error message to return if assert/check fails |
If check passes then assert
returns invisibly and test
/check
return TRUE
. If check fails, assert
stops code with error, check
returns
an error message as string, test
returns FALSE
.
testNoSkew(Binomial$new())
testNoSkew(Binomial$new())
Validation checks to test if a given object is a ParameterSet.
testParameterSet( object, errormsg = paste(object, "is not an R6 ParameterSet object") ) checkParameterSet( object, errormsg = paste(object, "is not an R6 ParameterSet object") ) assertParameterSet( object, errormsg = paste(object, "is not an R6 ParameterSet object") )
testParameterSet( object, errormsg = paste(object, "is not an R6 ParameterSet object") ) checkParameterSet( object, errormsg = paste(object, "is not an R6 ParameterSet object") ) assertParameterSet( object, errormsg = paste(object, "is not an R6 ParameterSet object") )
object |
object to test |
errormsg |
custom error message to return if assert/check fails |
If check passes then assert
returns invisibly and test
/check
return TRUE
. If check fails, assert
stops code with error, check
returns
an error message as string, test
returns FALSE
.
testParameterSet(5) # FALSE testParameterSet(Binomial$new()$parameters()) # TRUE
testParameterSet(5) # FALSE testParameterSet(Binomial$new()$parameters()) # TRUE
Validation checks to test if a given object is a list of ParameterSets.
testParameterSetList( object, errormsg = "One or more items in the list are not ParameterSets" ) checkParameterSetList( object, errormsg = "One or more items in the list are not ParameterSets" ) assertParameterSetList( object, errormsg = "One or more items in the list are not ParameterSets" )
testParameterSetList( object, errormsg = "One or more items in the list are not ParameterSets" ) checkParameterSetList( object, errormsg = "One or more items in the list are not ParameterSets" ) assertParameterSetList( object, errormsg = "One or more items in the list are not ParameterSets" )
object |
object to test |
errormsg |
custom error message to return if assert/check fails |
If check passes then assert
returns invisibly and test
/check
return TRUE
. If check fails, assert
stops code with error, check
returns
an error message as string, test
returns FALSE
.
testParameterSetList(list(Binomial$new(), 5)) # FALSE testParameterSetList(list(Binomial$new(), Exponential$new())) # TRUE
testParameterSetList(list(Binomial$new(), 5)) # FALSE testParameterSetList(list(Binomial$new(), Exponential$new())) # TRUE
Validation checks to test if Distribution is platykurtic.
testPlatykurtic( object, errormsg = paste(object$short_name, "is not platykurtic") ) checkPlatykurtic( object, errormsg = paste(object$short_name, "is not platykurtic") ) assertPlatykurtic( object, errormsg = paste(object$short_name, "is not platykurtic") )
testPlatykurtic( object, errormsg = paste(object$short_name, "is not platykurtic") ) checkPlatykurtic( object, errormsg = paste(object$short_name, "is not platykurtic") ) assertPlatykurtic( object, errormsg = paste(object$short_name, "is not platykurtic") )
object |
Distribution |
errormsg |
custom error message to return if assert/check fails |
If check passes then assert
returns invisibly and test
/check
return TRUE
. If check fails, assert
stops code with error, check
returns
an error message as string, test
returns FALSE
.
testPlatykurtic(Binomial$new())
testPlatykurtic(Binomial$new())
Validation checks to test if Distribution is positive skew.
testPositiveSkew( object, errormsg = paste(object$short_name, "is not positive skew") ) checkPositiveSkew( object, errormsg = paste(object$short_name, "is not positive skew") ) assertPositiveSkew( object, errormsg = paste(object$short_name, "is not positive skew") )
testPositiveSkew( object, errormsg = paste(object$short_name, "is not positive skew") ) checkPositiveSkew( object, errormsg = paste(object$short_name, "is not positive skew") ) assertPositiveSkew( object, errormsg = paste(object$short_name, "is not positive skew") )
object |
Distribution |
errormsg |
custom error message to return if assert/check fails |
If check passes then assert
returns invisibly and test
/check
return TRUE
. If check fails, assert
stops code with error, check
returns
an error message as string, test
returns FALSE
.
testPositiveSkew(Binomial$new())
testPositiveSkew(Binomial$new())
Validation checks to test if Distribution is symmetric.
testSymmetric(object, errormsg = paste(object$short_name, "is not symmetric")) checkSymmetric(object, errormsg = paste(object$short_name, "is not symmetric")) assertSymmetric( object, errormsg = paste(object$short_name, "is not symmetric") )
testSymmetric(object, errormsg = paste(object$short_name, "is not symmetric")) checkSymmetric(object, errormsg = paste(object$short_name, "is not symmetric")) assertSymmetric( object, errormsg = paste(object$short_name, "is not symmetric") )
object |
Distribution |
errormsg |
custom error message to return if assert/check fails |
If check passes then assert
returns invisibly and test
/check
return TRUE
. If check fails, assert
stops code with error, check
returns
an error message as string, test
returns FALSE
.
testSymmetric(Binomial$new()) # FALSE
testSymmetric(Binomial$new()) # FALSE
Validation checks to test if Distribution is univariate.
testUnivariate( object, errormsg = paste(object$short_name, "is not univariate") ) checkUnivariate( object, errormsg = paste(object$short_name, "is not univariate") ) assertUnivariate( object, errormsg = paste(object$short_name, "is not univariate") )
testUnivariate( object, errormsg = paste(object$short_name, "is not univariate") ) checkUnivariate( object, errormsg = paste(object$short_name, "is not univariate") ) assertUnivariate( object, errormsg = paste(object$short_name, "is not univariate") )
object |
Distribution |
errormsg |
custom error message to return if assert/check fails |
If check passes then assert
returns invisibly and test
/check
return TRUE
. If check fails, assert
stops code with error, check
returns
an error message as string, test
returns FALSE
.
testUnivariate(Binomial$new()) # TRUE
testUnivariate(Binomial$new()) # TRUE
Mathematical and statistical functions for the Triangular distribution, which is commonly used to model population data where only the minimum, mode and maximum are known (or can be reliably estimated), also to model the sum of standard uniform distributions.
The Triangular distribution parameterised with lower limit, , upper limit,
, and mode,
, is defined by the pdf,
for
,
.
Returns an R6 object inheriting from class SDistribution.
The distribution is supported on .
Tri(lower = 0, upper = 1, mode = 0.5, symmetric = FALSE)
N/A
N/A
distr6::Distribution
-> distr6::SDistribution
-> Triangular
name
Full name of distribution.
short_name
Short name of distribution for printing.
description
Brief description of the distribution.
alias
Alias of the distribution.
packages
Packages required to be installed in order to construct the distribution.
properties
Returns distribution properties, including skewness type and symmetry.
distr6::Distribution$cdf()
distr6::Distribution$confidence()
distr6::Distribution$correlation()
distr6::Distribution$getParameterValue()
distr6::Distribution$iqr()
distr6::Distribution$liesInSupport()
distr6::Distribution$liesInType()
distr6::Distribution$parameters()
distr6::Distribution$pdf()
distr6::Distribution$prec()
distr6::Distribution$print()
distr6::Distribution$quantile()
distr6::Distribution$rand()
distr6::Distribution$setParameterValue()
distr6::Distribution$stdev()
distr6::Distribution$strprint()
distr6::Distribution$summary()
distr6::Distribution$workingSupport()
new()
Creates a new instance of this R6 class.
Triangular$new( lower = NULL, upper = NULL, mode = NULL, symmetric = NULL, decorators = NULL )
lower
(numeric(1))
Lower limit of the Distribution, defined on the Reals.
upper
(numeric(1))
Upper limit of the Distribution, defined on the Reals.
mode
(numeric(1))
Mode of the distribution, if symmetric = TRUE
then determined automatically.
symmetric
(logical(1))
If TRUE
then the symmetric Triangular distribution is constructed, where the mode
is
automatically calculated. Otherwise mode
can be set manually. Cannot be changed after
construction.
decorators
(character())
Decorators to add to the distribution during construction.
Triangular$new(lower = 2, upper = 5, symmetric = TRUE) Triangular$new(lower = 2, upper = 5, mode = 4, symmetric = FALSE) # You can view the type of Triangular distribution with $description Triangular$new(symmetric = TRUE)$description Triangular$new(symmetric = FALSE)$description
mean()
The arithmetic mean of a (discrete) probability distribution X is the expectation
with an integration analogue for continuous distributions.
Triangular$mean(...)
...
Unused.
mode()
The mode of a probability distribution is the point at which the pdf is a local maximum, a distribution can be unimodal (one maximum) or multimodal (several maxima).
Triangular$mode(which = "all")
which
(character(1) | numeric(1)
Ignored if distribution is unimodal. Otherwise "all"
returns all modes, otherwise specifies
which mode to return.
median()
Returns the median of the distribution. If an analytical expression is available
returns distribution median, otherwise if symmetric returns self$mean
, otherwise
returns self$quantile(0.5)
.
Triangular$median()
variance()
The variance of a distribution is defined by the formula
where is the expectation of distribution X. If the distribution is multivariate the
covariance matrix is returned.
Triangular$variance(...)
...
Unused.
skewness()
The skewness of a distribution is defined by the third standardised moment,
where is the expectation of distribution X,
is the mean of the
distribution and
is the standard deviation of the distribution.
Triangular$skewness(...)
...
Unused.
kurtosis()
The kurtosis of a distribution is defined by the fourth standardised moment,
where is the expectation of distribution X,
is the mean of the
distribution and
is the standard deviation of the distribution.
Excess Kurtosis is Kurtosis - 3.
Triangular$kurtosis(excess = TRUE, ...)
excess
(logical(1))
If TRUE
(default) excess kurtosis returned.
...
Unused.
entropy()
The entropy of a (discrete) distribution is defined by
where is the pdf of distribution X, with an integration analogue for
continuous distributions.
Triangular$entropy(base = 2, ...)
base
(integer(1))
Base of the entropy logarithm, default = 2 (Shannon entropy)
...
Unused.
mgf()
The moment generating function is defined by
where X is the distribution and is the expectation of the distribution X.
Triangular$mgf(t, ...)
t
(integer(1))
t integer to evaluate function at.
...
Unused.
cf()
The characteristic function is defined by
where X is the distribution and is the expectation of the distribution X.
Triangular$cf(t, ...)
t
(integer(1))
t integer to evaluate function at.
...
Unused.
pgf()
The probability generating function is defined by
where X is the distribution and is the expectation of the distribution X.
Triangular$pgf(z, ...)
z
(integer(1))
z integer to evaluate probability generating function at.
...
Unused.
clone()
The objects of this class are cloneable with this method.
Triangular$clone(deep = FALSE)
deep
Whether to make a deep clone.
McLaughlin, M. P. (2001). A compendium of common probability distributions (pp. 2014-01). Michael P. McLaughlin.
Other continuous distributions:
Arcsine
,
BetaNoncentral
,
Beta
,
Cauchy
,
ChiSquaredNoncentral
,
ChiSquared
,
Dirichlet
,
Erlang
,
Exponential
,
FDistributionNoncentral
,
FDistribution
,
Frechet
,
Gamma
,
Gompertz
,
Gumbel
,
InverseGamma
,
Laplace
,
Logistic
,
Loglogistic
,
Lognormal
,
MultivariateNormal
,
Normal
,
Pareto
,
Poisson
,
Rayleigh
,
ShiftedLoglogistic
,
StudentTNoncentral
,
StudentT
,
Uniform
,
Wald
,
Weibull
Other univariate distributions:
Arcsine
,
Arrdist
,
Bernoulli
,
BetaNoncentral
,
Beta
,
Binomial
,
Categorical
,
Cauchy
,
ChiSquaredNoncentral
,
ChiSquared
,
Degenerate
,
DiscreteUniform
,
Empirical
,
Erlang
,
Exponential
,
FDistributionNoncentral
,
FDistribution
,
Frechet
,
Gamma
,
Geometric
,
Gompertz
,
Gumbel
,
Hypergeometric
,
InverseGamma
,
Laplace
,
Logarithmic
,
Logistic
,
Loglogistic
,
Lognormal
,
Matdist
,
NegativeBinomial
,
Normal
,
Pareto
,
Poisson
,
Rayleigh
,
ShiftedLoglogistic
,
StudentTNoncentral
,
StudentT
,
Uniform
,
Wald
,
Weibull
,
WeightedDiscrete
## ------------------------------------------------ ## Method `Triangular$new` ## ------------------------------------------------ Triangular$new(lower = 2, upper = 5, symmetric = TRUE) Triangular$new(lower = 2, upper = 5, mode = 4, symmetric = FALSE) # You can view the type of Triangular distribution with $description Triangular$new(symmetric = TRUE)$description Triangular$new(symmetric = FALSE)$description
## ------------------------------------------------ ## Method `Triangular$new` ## ------------------------------------------------ Triangular$new(lower = 2, upper = 5, symmetric = TRUE) Triangular$new(lower = 2, upper = 5, mode = 4, symmetric = FALSE) # You can view the type of Triangular distribution with $description Triangular$new(symmetric = TRUE)$description Triangular$new(symmetric = FALSE)$description
Mathematical and statistical functions for the Triangular kernel defined by the pdf,
over the support .
distr6::Distribution
-> distr6::Kernel
-> TriangularKernel
name
Full name of distribution.
short_name
Short name of distribution for printing.
description
Brief description of the distribution.
distr6::Distribution$cdf()
distr6::Distribution$confidence()
distr6::Distribution$correlation()
distr6::Distribution$getParameterValue()
distr6::Distribution$iqr()
distr6::Distribution$liesInSupport()
distr6::Distribution$liesInType()
distr6::Distribution$parameters()
distr6::Distribution$pdf()
distr6::Distribution$prec()
distr6::Distribution$print()
distr6::Distribution$quantile()
distr6::Distribution$rand()
distr6::Distribution$setParameterValue()
distr6::Distribution$stdev()
distr6::Distribution$strprint()
distr6::Distribution$summary()
distr6::Distribution$workingSupport()
distr6::Kernel$initialize()
distr6::Kernel$mean()
distr6::Kernel$median()
distr6::Kernel$mode()
distr6::Kernel$skewness()
pdfSquared2Norm()
The squared 2-norm of the pdf is defined by
where X is the Distribution, is its pdf and
are the distribution support limits.
TriangularKernel$pdfSquared2Norm(x = 0, upper = Inf)
x
(numeric(1))
Amount to shift the result.
upper
(numeric(1))
Upper limit of the integral.
cdfSquared2Norm()
The squared 2-norm of the cdf is defined by
where X is the Distribution, is its pdf and
are the distribution support limits.
TriangularKernel$cdfSquared2Norm(x = 0, upper = 0)
x
(numeric(1))
Amount to shift the result.
upper
(numeric(1))
Upper limit of the integral.
variance()
The variance of a distribution is defined by the formula
where is the expectation of distribution X. If the distribution is multivariate the
covariance matrix is returned.
TriangularKernel$variance(...)
...
Unused.
clone()
The objects of this class are cloneable with this method.
TriangularKernel$clone(deep = FALSE)
deep
Whether to make a deep clone.
Other kernels:
Cosine
,
Epanechnikov
,
LogisticKernel
,
NormalKernel
,
Quartic
,
Sigmoid
,
Silverman
,
Tricube
,
Triweight
,
UniformKernel
Mathematical and statistical functions for the Tricube kernel defined by the pdf,
over the support .
The quantile function is omitted as no closed form analytic expressions could be found, decorate with FunctionImputation for numeric results.
distr6::Distribution
-> distr6::Kernel
-> Tricube
name
Full name of distribution.
short_name
Short name of distribution for printing.
description
Brief description of the distribution.
distr6::Distribution$cdf()
distr6::Distribution$confidence()
distr6::Distribution$correlation()
distr6::Distribution$getParameterValue()
distr6::Distribution$iqr()
distr6::Distribution$liesInSupport()
distr6::Distribution$liesInType()
distr6::Distribution$parameters()
distr6::Distribution$pdf()
distr6::Distribution$prec()
distr6::Distribution$print()
distr6::Distribution$quantile()
distr6::Distribution$rand()
distr6::Distribution$setParameterValue()
distr6::Distribution$stdev()
distr6::Distribution$strprint()
distr6::Distribution$summary()
distr6::Distribution$workingSupport()
distr6::Kernel$initialize()
distr6::Kernel$mean()
distr6::Kernel$median()
distr6::Kernel$mode()
distr6::Kernel$skewness()
pdfSquared2Norm()
The squared 2-norm of the pdf is defined by
where X is the Distribution, is its pdf and
are the distribution support limits.
Tricube$pdfSquared2Norm(x = 0, upper = Inf)
x
(numeric(1))
Amount to shift the result.
upper
(numeric(1))
Upper limit of the integral.
cdfSquared2Norm()
The squared 2-norm of the cdf is defined by
where X is the Distribution, is its pdf and
are the distribution support limits.
Tricube$cdfSquared2Norm(x = 0, upper = 0)
x
(numeric(1))
Amount to shift the result.
upper
(numeric(1))
Upper limit of the integral.
variance()
The variance of a distribution is defined by the formula
where is the expectation of distribution X. If the distribution is multivariate the
covariance matrix is returned.
Tricube$variance(...)
...
Unused.
clone()
The objects of this class are cloneable with this method.
Tricube$clone(deep = FALSE)
deep
Whether to make a deep clone.
Other kernels:
Cosine
,
Epanechnikov
,
LogisticKernel
,
NormalKernel
,
Quartic
,
Sigmoid
,
Silverman
,
TriangularKernel
,
Triweight
,
UniformKernel
Mathematical and statistical functions for the Triweight kernel defined by the pdf,
over the support .
The quantile function is omitted as no closed form analytic expression could be found, decorate with FunctionImputation for numeric results.
distr6::Distribution
-> distr6::Kernel
-> Triweight
name
Full name of distribution.
short_name
Short name of distribution for printing.
description
Brief description of the distribution.
distr6::Distribution$cdf()
distr6::Distribution$confidence()
distr6::Distribution$correlation()
distr6::Distribution$getParameterValue()
distr6::Distribution$iqr()
distr6::Distribution$liesInSupport()
distr6::Distribution$liesInType()
distr6::Distribution$parameters()
distr6::Distribution$pdf()
distr6::Distribution$prec()
distr6::Distribution$print()
distr6::Distribution$quantile()
distr6::Distribution$rand()
distr6::Distribution$setParameterValue()
distr6::Distribution$stdev()
distr6::Distribution$strprint()
distr6::Distribution$summary()
distr6::Distribution$workingSupport()
distr6::Kernel$initialize()
distr6::Kernel$mean()
distr6::Kernel$median()
distr6::Kernel$mode()
distr6::Kernel$skewness()
pdfSquared2Norm()
The squared 2-norm of the pdf is defined by
where X is the Distribution, is its pdf and
are the distribution support limits.
Triweight$pdfSquared2Norm(x = 0, upper = Inf)
x
(numeric(1))
Amount to shift the result.
upper
(numeric(1))
Upper limit of the integral.
cdfSquared2Norm()
The squared 2-norm of the cdf is defined by
where X is the Distribution, is its pdf and
are the distribution support limits.
Triweight$cdfSquared2Norm(x = 0, upper = 0)
x
(numeric(1))
Amount to shift the result.
upper
(numeric(1))
Upper limit of the integral.
variance()
The variance of a distribution is defined by the formula
where is the expectation of distribution X. If the distribution is multivariate the
covariance matrix is returned.
Triweight$variance(...)
...
Unused.
clone()
The objects of this class are cloneable with this method.
Triweight$clone(deep = FALSE)
deep
Whether to make a deep clone.
Other kernels:
Cosine
,
Epanechnikov
,
LogisticKernel
,
NormalKernel
,
Quartic
,
Sigmoid
,
Silverman
,
TriangularKernel
,
Tricube
,
UniformKernel
S3 functionality to truncate an R6 distribution.
truncate(x, lower = NULL, upper = NULL)
truncate(x, lower = NULL, upper = NULL)
x |
Distribution. |
lower |
lower limit for truncation. |
upper |
upper limit for truncation. |
A wrapper for truncating any probability distribution at given limits.
The pdf and cdf of the distribution are required for this wrapper, if unavailable decorate with FunctionImputation first.
Truncates a distribution at lower and upper limits on a left-open interval, using the formulae
where /
is the pdf/cdf of the truncated distribution
T = Truncate(X, lower, upper) and
,
is the pdf/cdf of the
original distribution. T is supported on (].
distr6::Distribution
-> distr6::DistributionWrapper
-> TruncatedDistribution
properties
Returns distribution properties, including skewness type and symmetry.
distr6::Distribution$cdf()
distr6::Distribution$confidence()
distr6::Distribution$correlation()
distr6::Distribution$getParameterValue()
distr6::Distribution$iqr()
distr6::Distribution$liesInSupport()
distr6::Distribution$liesInType()
distr6::Distribution$median()
distr6::Distribution$parameters()
distr6::Distribution$pdf()
distr6::Distribution$prec()
distr6::Distribution$print()
distr6::Distribution$quantile()
distr6::Distribution$rand()
distr6::Distribution$setParameterValue()
distr6::Distribution$stdev()
distr6::Distribution$strprint()
distr6::Distribution$summary()
distr6::Distribution$workingSupport()
distr6::DistributionWrapper$wrappedModels()
new()
Creates a new instance of this R6 class.
TruncatedDistribution$new(distribution, lower = NULL, upper = NULL)
distribution
([Distribution])
Distribution to wrap.
lower
(numeric(1))
Lower limit to huberize the distribution at. If NULL
then the lower bound of
the Distribution is used.
upper
(numeric(1))
Upper limit to huberize the distribution at. If NULL
then the upper bound of
the Distribution is used.
TruncatedDistribution$new( Binomial$new(prob = 0.5, size = 10), lower = 2, upper = 4 ) # alternate constructor truncate(Binomial$new(), lower = 2, upper = 4)
clone()
The objects of this class are cloneable with this method.
TruncatedDistribution$clone(deep = FALSE)
deep
Whether to make a deep clone.
Other wrappers:
Convolution
,
DistributionWrapper
,
HuberizedDistribution
,
MixtureDistribution
,
ProductDistribution
,
VectorDistribution
## ------------------------------------------------ ## Method `TruncatedDistribution$new` ## ------------------------------------------------ TruncatedDistribution$new( Binomial$new(prob = 0.5, size = 10), lower = 2, upper = 4 ) # alternate constructor truncate(Binomial$new(), lower = 2, upper = 4)
## ------------------------------------------------ ## Method `TruncatedDistribution$new` ## ------------------------------------------------ TruncatedDistribution$new( Binomial$new(prob = 0.5, size = 10), lower = 2, upper = 4 ) # alternate constructor truncate(Binomial$new(), lower = 2, upper = 4)
Mathematical and statistical functions for the Uniform distribution, which is commonly used to model continuous events occurring with equal probability, as an uninformed prior in Bayesian modelling, and for inverse transform sampling.
The Uniform distribution parameterised with lower, , and upper,
, limits is defined by the pdf,
for .
Returns an R6 object inheriting from class SDistribution.
The distribution is supported on .
Unif(lower = 0, upper = 1)
N/A
N/A
distr6::Distribution
-> distr6::SDistribution
-> Uniform
name
Full name of distribution.
short_name
Short name of distribution for printing.
description
Brief description of the distribution.
alias
Alias of the distribution.
packages
Packages required to be installed in order to construct the distribution.
properties
Returns distribution properties, including skewness type and symmetry.
distr6::Distribution$cdf()
distr6::Distribution$confidence()
distr6::Distribution$correlation()
distr6::Distribution$getParameterValue()
distr6::Distribution$iqr()
distr6::Distribution$liesInSupport()
distr6::Distribution$liesInType()
distr6::Distribution$median()
distr6::Distribution$parameters()
distr6::Distribution$pdf()
distr6::Distribution$prec()
distr6::Distribution$print()
distr6::Distribution$quantile()
distr6::Distribution$rand()
distr6::Distribution$setParameterValue()
distr6::Distribution$stdev()
distr6::Distribution$strprint()
distr6::Distribution$summary()
distr6::Distribution$workingSupport()
new()
Creates a new instance of this R6 class.
Uniform$new(lower = NULL, upper = NULL, decorators = NULL)
lower
(numeric(1))
Lower limit of the Distribution, defined on the Reals.
upper
(numeric(1))
Upper limit of the Distribution, defined on the Reals.
decorators
(character())
Decorators to add to the distribution during construction.
mean()
The arithmetic mean of a (discrete) probability distribution X is the expectation
with an integration analogue for continuous distributions.
Uniform$mean(...)
...
Unused.
mode()
The mode of a probability distribution is the point at which the pdf is a local maximum, a distribution can be unimodal (one maximum) or multimodal (several maxima).
Uniform$mode(which = "all")
which
(character(1) | numeric(1)
Ignored if distribution is unimodal. Otherwise "all"
returns all modes, otherwise specifies
which mode to return.
variance()
The variance of a distribution is defined by the formula
where is the expectation of distribution X. If the distribution is multivariate the
covariance matrix is returned.
Uniform$variance(...)
...
Unused.
skewness()
The skewness of a distribution is defined by the third standardised moment,
where is the expectation of distribution X,
is the mean of the
distribution and
is the standard deviation of the distribution.
Uniform$skewness(...)
...
Unused.
kurtosis()
The kurtosis of a distribution is defined by the fourth standardised moment,
where is the expectation of distribution X,
is the mean of the
distribution and
is the standard deviation of the distribution.
Excess Kurtosis is Kurtosis - 3.
Uniform$kurtosis(excess = TRUE, ...)
excess
(logical(1))
If TRUE
(default) excess kurtosis returned.
...
Unused.
entropy()
The entropy of a (discrete) distribution is defined by
where is the pdf of distribution X, with an integration analogue for
continuous distributions.
Uniform$entropy(base = 2, ...)
base
(integer(1))
Base of the entropy logarithm, default = 2 (Shannon entropy)
...
Unused.
mgf()
The moment generating function is defined by
where X is the distribution and is the expectation of the distribution X.
Uniform$mgf(t, ...)
t
(integer(1))
t integer to evaluate function at.
...
Unused.
cf()
The characteristic function is defined by
where X is the distribution and is the expectation of the distribution X.
Uniform$cf(t, ...)
t
(integer(1))
t integer to evaluate function at.
...
Unused.
pgf()
The probability generating function is defined by
where X is the distribution and is the expectation of the distribution X.
Uniform$pgf(z, ...)
z
(integer(1))
z integer to evaluate probability generating function at.
...
Unused.
clone()
The objects of this class are cloneable with this method.
Uniform$clone(deep = FALSE)
deep
Whether to make a deep clone.
Yumi Zhou
McLaughlin, M. P. (2001). A compendium of common probability distributions (pp. 2014-01). Michael P. McLaughlin.
Other continuous distributions:
Arcsine
,
BetaNoncentral
,
Beta
,
Cauchy
,
ChiSquaredNoncentral
,
ChiSquared
,
Dirichlet
,
Erlang
,
Exponential
,
FDistributionNoncentral
,
FDistribution
,
Frechet
,
Gamma
,
Gompertz
,
Gumbel
,
InverseGamma
,
Laplace
,
Logistic
,
Loglogistic
,
Lognormal
,
MultivariateNormal
,
Normal
,
Pareto
,
Poisson
,
Rayleigh
,
ShiftedLoglogistic
,
StudentTNoncentral
,
StudentT
,
Triangular
,
Wald
,
Weibull
Other univariate distributions:
Arcsine
,
Arrdist
,
Bernoulli
,
BetaNoncentral
,
Beta
,
Binomial
,
Categorical
,
Cauchy
,
ChiSquaredNoncentral
,
ChiSquared
,
Degenerate
,
DiscreteUniform
,
Empirical
,
Erlang
,
Exponential
,
FDistributionNoncentral
,
FDistribution
,
Frechet
,
Gamma
,
Geometric
,
Gompertz
,
Gumbel
,
Hypergeometric
,
InverseGamma
,
Laplace
,
Logarithmic
,
Logistic
,
Loglogistic
,
Lognormal
,
Matdist
,
NegativeBinomial
,
Normal
,
Pareto
,
Poisson
,
Rayleigh
,
ShiftedLoglogistic
,
StudentTNoncentral
,
StudentT
,
Triangular
,
Wald
,
Weibull
,
WeightedDiscrete
Mathematical and statistical functions for the Uniform kernel defined by the pdf,
over the support .
distr6::Distribution
-> distr6::Kernel
-> UniformKernel
name
Full name of distribution.
short_name
Short name of distribution for printing.
description
Brief description of the distribution.
distr6::Distribution$cdf()
distr6::Distribution$confidence()
distr6::Distribution$correlation()
distr6::Distribution$getParameterValue()
distr6::Distribution$iqr()
distr6::Distribution$liesInSupport()
distr6::Distribution$liesInType()
distr6::Distribution$parameters()
distr6::Distribution$pdf()
distr6::Distribution$prec()
distr6::Distribution$print()
distr6::Distribution$quantile()
distr6::Distribution$rand()
distr6::Distribution$setParameterValue()
distr6::Distribution$stdev()
distr6::Distribution$strprint()
distr6::Distribution$summary()
distr6::Distribution$workingSupport()
distr6::Kernel$initialize()
distr6::Kernel$mean()
distr6::Kernel$median()
distr6::Kernel$mode()
distr6::Kernel$skewness()
pdfSquared2Norm()
The squared 2-norm of the pdf is defined by
where X is the Distribution, is its pdf and
are the distribution support limits.
UniformKernel$pdfSquared2Norm(x = 0, upper = Inf)
x
(numeric(1))
Amount to shift the result.
upper
(numeric(1))
Upper limit of the integral.
cdfSquared2Norm()
The squared 2-norm of the cdf is defined by
where X is the Distribution, is its pdf and
are the distribution support limits.
UniformKernel$cdfSquared2Norm(x = 0, upper = 0)
x
(numeric(1))
Amount to shift the result.
upper
(numeric(1))
Upper limit of the integral.
variance()
The variance of a distribution is defined by the formula
where is the expectation of distribution X. If the distribution is multivariate the
covariance matrix is returned.
UniformKernel$variance(...)
...
Unused.
clone()
The objects of this class are cloneable with this method.
UniformKernel$clone(deep = FALSE)
deep
Whether to make a deep clone.
Other kernels:
Cosine
,
Epanechnikov
,
LogisticKernel
,
NormalKernel
,
Quartic
,
Sigmoid
,
Silverman
,
TriangularKernel
,
Tricube
,
Triweight
A wrapper for creating a vector of distributions.
A vector distribution is intented to vectorize distributions more efficiently than storing a list of distributions. To improve speed and reduce memory usage, distributions are only constructed when methods (e.g. d/p/q/r) are called.
distr6::Distribution
-> distr6::DistributionWrapper
-> VectorDistribution
modelTable
Returns reference table of wrapped Distributions.
distlist
Returns list of constructed wrapped Distributions.
ids
Returns ids of constructed wrapped Distributions.
distr6::Distribution$confidence()
distr6::Distribution$correlation()
distr6::Distribution$iqr()
distr6::Distribution$liesInSupport()
distr6::Distribution$liesInType()
distr6::Distribution$parameters()
distr6::Distribution$prec()
distr6::Distribution$print()
distr6::Distribution$setParameterValue()
distr6::Distribution$stdev()
distr6::Distribution$summary()
distr6::Distribution$workingSupport()
new()
Creates a new instance of this R6 class.
VectorDistribution$new( distlist = NULL, distribution = NULL, params = NULL, shared_params = NULL, name = NULL, short_name = NULL, decorators = NULL, vecdist = NULL, ids = NULL, ... )
distlist
(list())
List of Distributions.
distribution
(character(1))
Should be supplied with params
and optionally shared_params
as an alternative to distlist
.
Much faster implementation when only one class of distribution is being wrapped. distribution
is the full name of one of the distributions in listDistributions()
, or "Distribution"
if
constructing custom distributions. See examples in VectorDistribution.
params
(list()|data.frame())
Parameters in the individual distributions for use with distribution
. Can be supplied as a list,
where each element is the list of parameters to set in the distribution, or as an object
coercable to data.frame
, where each column is a parameter and each row is a distribution.
See examples in VectorDistribution.
shared_params
(list())
If any parameters are shared when using the distribution
constructor, this provides a much faster
implementation to list and query them together. See examples in VectorDistribution.
name
(character(1))
Optional name of wrapped distribution.
short_name
(character(1))
Optional short name/ID of wrapped distribution.
decorators
(character())
Decorators to add to the distribution during construction.
vecdist
VectorDistribution
Alternative constructor to directly create this object from an object inheriting from
VectorDistribution.
ids
(character())
Optional ids for wrapped distributions in vector, should be unique and of same length as
the number of distributions.
...
Unused
\dontrun{ VectorDistribution$new( distribution = "Binomial", params = list( list(prob = 0.1, size = 2), list(prob = 0.6, size = 4), list(prob = 0.2, size = 6) ) ) VectorDistribution$new( distribution = "Binomial", params = data.table::data.table(prob = c(0.1, 0.6, 0.2), size = c(2, 4, 6)) ) # Alternatively VectorDistribution$new( list( Binomial$new(prob = 0.1, size = 2), Binomial$new(prob = 0.6, size = 4), Binomial$new(prob = 0.2, size = 6) ) ) }
getParameterValue()
Returns the value of the supplied parameter.
VectorDistribution$getParameterValue(id, ...)
id
character()
id of parameter value to return.
...
Unused
wrappedModels()
Returns model(s) wrapped by this wrapper.
VectorDistribution$wrappedModels(model = NULL)
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.
strprint()
Printable string representation of the VectorDistribution
. Primarily used internally.
VectorDistribution$strprint(n = 10)
n
(integer(1))
Number of distributions to include when printing.
mean()
Returns named vector of means from each wrapped Distribution.
VectorDistribution$mean(...)
...
Passed to CoreStatistics$genExp
if numeric.
mode()
Returns named vector of modes from each wrapped Distribution.
VectorDistribution$mode(which = "all")
which
(character(1) | numeric(1)
Ignored if distribution is unimodal. Otherwise "all"
returns all modes, otherwise specifies
which mode to return.
median()
Returns named vector of medians from each wrapped Distribution.
VectorDistribution$median()
variance()
Returns named vector of variances from each wrapped Distribution.
VectorDistribution$variance(...)
...
Passed to CoreStatistics$genExp
if numeric.
skewness()
Returns named vector of skewness from each wrapped Distribution.
VectorDistribution$skewness(...)
...
Passed to CoreStatistics$genExp
if numeric.
kurtosis()
Returns named vector of kurtosis from each wrapped Distribution.
VectorDistribution$kurtosis(excess = TRUE, ...)
excess
(logical(1))
If TRUE
(default) excess kurtosis returned.
...
Passed to CoreStatistics$genExp
if numeric.
entropy()
Returns named vector of entropy from each wrapped Distribution.
VectorDistribution$entropy(base = 2, ...)
base
(integer(1))
Base of the entropy logarithm, default = 2 (Shannon entropy)
...
Passed to CoreStatistics$genExp
if numeric.
mgf()
Returns named vector of mgf from each wrapped Distribution.
VectorDistribution$mgf(t, ...)
t
(integer(1))
t integer to evaluate function at.
...
Passed to CoreStatistics$genExp
if numeric.
cf()
Returns named vector of cf from each wrapped Distribution.
VectorDistribution$cf(t, ...)
t
(integer(1))
t integer to evaluate function at.
...
Passed to CoreStatistics$genExp
if numeric.
pgf()
Returns named vector of pgf from each wrapped Distribution.
VectorDistribution$pgf(z, ...)
z
(integer(1))
z integer to evaluate probability generating function at.
...
Passed to CoreStatistics$genExp
if numeric.
pdf()
Returns named vector of pdfs from each wrapped Distribution.
VectorDistribution$pdf(..., log = FALSE, simplify = TRUE, data = NULL)
...
(numeric())
Points to evaluate the function at Arguments do not need
to be named. The length of each argument corresponds to the number of points to evaluate,
the number of arguments corresponds to the number of variables in the distribution.
See examples.
log
(logical(1))
If TRUE
returns the logarithm of the probabilities. Default is FALSE
.
simplify
logical(1)
If TRUE
(default) simplifies the return if possible to a numeric
, otherwise returns a
data.table::data.table.
data
array
Alternative method to specify points to evaluate. If univariate then rows correspond with number
of points to evaluate and columns correspond with number of variables to evaluate. In the special
case of VectorDistributions of multivariate distributions, then the third dimension corresponds
to the distribution in the vector to evaluate.
vd <- VectorDistribution$new( distribution = "Binomial", params = data.frame(size = 9:10, prob = c(0.5,0.6))) vd$pdf(2) # Equivalently vd$pdf(2, 2) vd$pdf(1:2, 3:4) # or as a matrix vd$pdf(data = matrix(1:4, nrow = 2)) # when wrapping multivariate distributions, arrays are required vd <- VectorDistribution$new( distribution = "Multinomial", params = list( list(size = 5, probs = c(0.1, 0.9)), list(size = 8, probs = c(0.3, 0.7)) ) ) # evaluates Multinom1 and Multinom2 at (1, 4) vd$pdf(1, 4) # evaluates Multinom1 at (1, 4) and Multinom2 at (5, 3) vd$pdf(data = array(c(1,4,5,3), dim = c(1,2,2))) # and the same across many samples vd$pdf(data = array(c(1,2,4,3,5,1,3,7), dim = c(2,2,2)))
cdf()
Returns named vector of cdfs from each wrapped Distribution.
Same usage as $pdf.
VectorDistribution$cdf( ..., lower.tail = TRUE, log.p = FALSE, simplify = TRUE, data = NULL )
...
(numeric())
Points to evaluate the function at Arguments do not need
to be named. The length of each argument corresponds to the number of points to evaluate,
the number of arguments corresponds to the number of variables in the distribution.
See examples.
lower.tail
(logical(1))
If TRUE
(default), probabilities are X <= x
, otherwise, P(X > x)
.
log.p
(logical(1))
If TRUE
returns the logarithm of the probabilities. Default is FALSE
.
simplify
logical(1)
If TRUE
(default) simplifies the return if possible to a numeric
, otherwise returns a
data.table::data.table.
data
array
Alternative method to specify points to evaluate. If univariate then rows correspond with number
of points to evaluate and columns correspond with number of variables to evaluate. In the special
case of VectorDistributions of multivariate distributions, then the third dimension corresponds
to the distribution in the vector to evaluate.
quantile()
Returns named vector of quantiles from each wrapped Distribution.
Same usage as $cdf.
VectorDistribution$quantile( ..., lower.tail = TRUE, log.p = FALSE, simplify = TRUE, data = NULL )
...
(numeric())
Points to evaluate the function at Arguments do not need
to be named. The length of each argument corresponds to the number of points to evaluate,
the number of arguments corresponds to the number of variables in the distribution.
See examples.
lower.tail
(logical(1))
If TRUE
(default), probabilities are X <= x
, otherwise, P(X > x)
.
log.p
(logical(1))
If TRUE
returns the logarithm of the probabilities. Default is FALSE
.
simplify
logical(1)
If TRUE
(default) simplifies the return if possible to a numeric
, otherwise returns a
data.table::data.table.
data
array
Alternative method to specify points to evaluate. If univariate then rows correspond with number
of points to evaluate and columns correspond with number of variables to evaluate. In the special
case of VectorDistributions of multivariate distributions, then the third dimension corresponds
to the distribution in the vector to evaluate.
rand()
Returns data.table::data.table of draws from each wrapped Distribution.
VectorDistribution$rand(n, simplify = TRUE)
n
(numeric(1))
Number of points to simulate from the distribution. If length greater than , then
n <- length(n)
,
simplify
logical(1)
If TRUE
(default) simplifies the return if possible to a numeric
, otherwise returns a
data.table::data.table.
clone()
The objects of this class are cloneable with this method.
VectorDistribution$clone(deep = FALSE)
deep
Whether to make a deep clone.
Other wrappers:
Convolution
,
DistributionWrapper
,
HuberizedDistribution
,
MixtureDistribution
,
ProductDistribution
,
TruncatedDistribution
## ------------------------------------------------ ## Method `VectorDistribution$new` ## ------------------------------------------------ ## Not run: VectorDistribution$new( distribution = "Binomial", params = list( list(prob = 0.1, size = 2), list(prob = 0.6, size = 4), list(prob = 0.2, size = 6) ) ) VectorDistribution$new( distribution = "Binomial", params = data.table::data.table(prob = c(0.1, 0.6, 0.2), size = c(2, 4, 6)) ) # Alternatively VectorDistribution$new( list( Binomial$new(prob = 0.1, size = 2), Binomial$new(prob = 0.6, size = 4), Binomial$new(prob = 0.2, size = 6) ) ) ## End(Not run) ## ------------------------------------------------ ## Method `VectorDistribution$pdf` ## ------------------------------------------------ vd <- VectorDistribution$new( distribution = "Binomial", params = data.frame(size = 9:10, prob = c(0.5,0.6))) vd$pdf(2) # Equivalently vd$pdf(2, 2) vd$pdf(1:2, 3:4) # or as a matrix vd$pdf(data = matrix(1:4, nrow = 2)) # when wrapping multivariate distributions, arrays are required vd <- VectorDistribution$new( distribution = "Multinomial", params = list( list(size = 5, probs = c(0.1, 0.9)), list(size = 8, probs = c(0.3, 0.7)) ) ) # evaluates Multinom1 and Multinom2 at (1, 4) vd$pdf(1, 4) # evaluates Multinom1 at (1, 4) and Multinom2 at (5, 3) vd$pdf(data = array(c(1,4,5,3), dim = c(1,2,2))) # and the same across many samples vd$pdf(data = array(c(1,2,4,3,5,1,3,7), dim = c(2,2,2)))
## ------------------------------------------------ ## Method `VectorDistribution$new` ## ------------------------------------------------ ## Not run: VectorDistribution$new( distribution = "Binomial", params = list( list(prob = 0.1, size = 2), list(prob = 0.6, size = 4), list(prob = 0.2, size = 6) ) ) VectorDistribution$new( distribution = "Binomial", params = data.table::data.table(prob = c(0.1, 0.6, 0.2), size = c(2, 4, 6)) ) # Alternatively VectorDistribution$new( list( Binomial$new(prob = 0.1, size = 2), Binomial$new(prob = 0.6, size = 4), Binomial$new(prob = 0.2, size = 6) ) ) ## End(Not run) ## ------------------------------------------------ ## Method `VectorDistribution$pdf` ## ------------------------------------------------ vd <- VectorDistribution$new( distribution = "Binomial", params = data.frame(size = 9:10, prob = c(0.5,0.6))) vd$pdf(2) # Equivalently vd$pdf(2, 2) vd$pdf(1:2, 3:4) # or as a matrix vd$pdf(data = matrix(1:4, nrow = 2)) # when wrapping multivariate distributions, arrays are required vd <- VectorDistribution$new( distribution = "Multinomial", params = list( list(size = 5, probs = c(0.1, 0.9)), list(size = 8, probs = c(0.3, 0.7)) ) ) # evaluates Multinom1 and Multinom2 at (1, 4) vd$pdf(1, 4) # evaluates Multinom1 at (1, 4) and Multinom2 at (5, 3) vd$pdf(data = array(c(1,4,5,3), dim = c(1,2,2))) # and the same across many samples vd$pdf(data = array(c(1,2,4,3,5,1,3,7), dim = c(2,2,2)))
Mathematical and statistical functions for the Wald distribution, which is commonly used for modelling the first passage time for Brownian motion.
The Wald distribution parameterised with mean, , and shape,
, is defined by the pdf,
for and
.
Sampling is performed as per Michael, Schucany, Haas (1976).
Returns an R6 object inheriting from class SDistribution.
The distribution is supported on the Positive Reals.
Wald(mean = 1, shape = 1)
quantile
is
omitted as no closed form analytic expression could be found, decorate with FunctionImputation
for a numerical imputation.
Also known as the Inverse Normal distribution.
distr6::Distribution
-> distr6::SDistribution
-> Wald
name
Full name of distribution.
short_name
Short name of distribution for printing.
description
Brief description of the distribution.
alias
Alias of the distribution.
packages
Packages required to be installed in order to construct the distribution.
distr6::Distribution$cdf()
distr6::Distribution$confidence()
distr6::Distribution$correlation()
distr6::Distribution$getParameterValue()
distr6::Distribution$iqr()
distr6::Distribution$liesInSupport()
distr6::Distribution$liesInType()
distr6::Distribution$median()
distr6::Distribution$parameters()
distr6::Distribution$pdf()
distr6::Distribution$prec()
distr6::Distribution$print()
distr6::Distribution$quantile()
distr6::Distribution$rand()
distr6::Distribution$setParameterValue()
distr6::Distribution$stdev()
distr6::Distribution$strprint()
distr6::Distribution$summary()
distr6::Distribution$workingSupport()
new()
Creates a new instance of this R6 class.
Wald$new(mean = NULL, shape = NULL, decorators = NULL)
mean
(numeric(1))
Mean of the distribution, location parameter, defined on the positive Reals.
shape
(numeric(1))
Shape parameter, defined on the positive Reals.
decorators
(character())
Decorators to add to the distribution during construction.
mean()
The arithmetic mean of a (discrete) probability distribution X is the expectation
with an integration analogue for continuous distributions.
Wald$mean(...)
...
Unused.
mode()
The mode of a probability distribution is the point at which the pdf is a local maximum, a distribution can be unimodal (one maximum) or multimodal (several maxima).
Wald$mode(which = "all")
which
(character(1) | numeric(1)
Ignored if distribution is unimodal. Otherwise "all"
returns all modes, otherwise specifies
which mode to return.
variance()
The variance of a distribution is defined by the formula
where is the expectation of distribution X. If the distribution is multivariate the
covariance matrix is returned.
Wald$variance(...)
...
Unused.
skewness()
The skewness of a distribution is defined by the third standardised moment,
where is the expectation of distribution X,
is the mean of the
distribution and
is the standard deviation of the distribution.
Wald$skewness(...)
...
Unused.
kurtosis()
The kurtosis of a distribution is defined by the fourth standardised moment,
where is the expectation of distribution X,
is the mean of the
distribution and
is the standard deviation of the distribution.
Excess Kurtosis is Kurtosis - 3.
Wald$kurtosis(excess = TRUE, ...)
excess
(logical(1))
If TRUE
(default) excess kurtosis returned.
...
Unused.
mgf()
The moment generating function is defined by
where X is the distribution and is the expectation of the distribution X.
Wald$mgf(t, ...)
t
(integer(1))
t integer to evaluate function at.
...
Unused.
cf()
The characteristic function is defined by
where X is the distribution and is the expectation of the distribution X.
Wald$cf(t, ...)
t
(integer(1))
t integer to evaluate function at.
...
Unused.
pgf()
The probability generating function is defined by
where X is the distribution and is the expectation of the distribution X.
Wald$pgf(z, ...)
z
(integer(1))
z integer to evaluate probability generating function at.
...
Unused.
clone()
The objects of this class are cloneable with this method.
Wald$clone(deep = FALSE)
deep
Whether to make a deep clone.
McLaughlin, M. P. (2001). A compendium of common probability distributions (pp. 2014-01). Michael P. McLaughlin.
Michael, J. R., Schucany, W. R., & Haas, R. W. (1976). Generating random variates using transformations with multiple roots. The American Statistician, 30(2), 88-90.
Other continuous distributions:
Arcsine
,
BetaNoncentral
,
Beta
,
Cauchy
,
ChiSquaredNoncentral
,
ChiSquared
,
Dirichlet
,
Erlang
,
Exponential
,
FDistributionNoncentral
,
FDistribution
,
Frechet
,
Gamma
,
Gompertz
,
Gumbel
,
InverseGamma
,
Laplace
,
Logistic
,
Loglogistic
,
Lognormal
,
MultivariateNormal
,
Normal
,
Pareto
,
Poisson
,
Rayleigh
,
ShiftedLoglogistic
,
StudentTNoncentral
,
StudentT
,
Triangular
,
Uniform
,
Weibull
Other univariate distributions:
Arcsine
,
Arrdist
,
Bernoulli
,
BetaNoncentral
,
Beta
,
Binomial
,
Categorical
,
Cauchy
,
ChiSquaredNoncentral
,
ChiSquared
,
Degenerate
,
DiscreteUniform
,
Empirical
,
Erlang
,
Exponential
,
FDistributionNoncentral
,
FDistribution
,
Frechet
,
Gamma
,
Geometric
,
Gompertz
,
Gumbel
,
Hypergeometric
,
InverseGamma
,
Laplace
,
Logarithmic
,
Logistic
,
Loglogistic
,
Lognormal
,
Matdist
,
NegativeBinomial
,
Normal
,
Pareto
,
Poisson
,
Rayleigh
,
ShiftedLoglogistic
,
StudentTNoncentral
,
StudentT
,
Triangular
,
Uniform
,
Weibull
,
WeightedDiscrete
Mathematical and statistical functions for the Weibull distribution, which is commonly used in survival analysis as it satisfies both PH and AFT requirements.
The Weibull distribution parameterised with shape, , and scale,
, is defined by the pdf,
for .
Returns an R6 object inheriting from class SDistribution.
The distribution is supported on the Positive Reals.
Weibull(shape = 1, scale = 1)
N/A
N/A
distr6::Distribution
-> distr6::SDistribution
-> Weibull
name
Full name of distribution.
short_name
Short name of distribution for printing.
description
Brief description of the distribution.
alias
Alias of the distribution.
packages
Packages required to be installed in order to construct the distribution.
distr6::Distribution$cdf()
distr6::Distribution$confidence()
distr6::Distribution$correlation()
distr6::Distribution$getParameterValue()
distr6::Distribution$iqr()
distr6::Distribution$liesInSupport()
distr6::Distribution$liesInType()
distr6::Distribution$parameters()
distr6::Distribution$pdf()
distr6::Distribution$prec()
distr6::Distribution$print()
distr6::Distribution$quantile()
distr6::Distribution$rand()
distr6::Distribution$setParameterValue()
distr6::Distribution$stdev()
distr6::Distribution$strprint()
distr6::Distribution$summary()
distr6::Distribution$workingSupport()
new()
Creates a new instance of this R6 class.
Weibull$new(shape = NULL, scale = NULL, altscale = NULL, decorators = NULL)
shape
(numeric(1))
Shape parameter, defined on the positive Reals.
scale
(numeric(1))
Scale parameter, defined on the positive Reals.
altscale
(numeric(1))
Alternative scale parameter, if given then scale
is ignored.
altscale = scale^-shape
.
decorators
(character())
Decorators to add to the distribution during construction.
mean()
The arithmetic mean of a (discrete) probability distribution X is the expectation
with an integration analogue for continuous distributions.
Weibull$mean(...)
...
Unused.
mode()
The mode of a probability distribution is the point at which the pdf is a local maximum, a distribution can be unimodal (one maximum) or multimodal (several maxima).
Weibull$mode(which = "all")
which
(character(1) | numeric(1)
Ignored if distribution is unimodal. Otherwise "all"
returns all modes, otherwise specifies
which mode to return.
median()
Returns the median of the distribution. If an analytical expression is available
returns distribution median, otherwise if symmetric returns self$mean
, otherwise
returns self$quantile(0.5)
.
Weibull$median()
variance()
The variance of a distribution is defined by the formula
where is the expectation of distribution X. If the distribution is multivariate the
covariance matrix is returned.
Weibull$variance(...)
...
Unused.
skewness()
The skewness of a distribution is defined by the third standardised moment,
where is the expectation of distribution X,
is the mean of the
distribution and
is the standard deviation of the distribution.
Weibull$skewness(...)
...
Unused.
kurtosis()
The kurtosis of a distribution is defined by the fourth standardised moment,
where is the expectation of distribution X,
is the mean of the
distribution and
is the standard deviation of the distribution.
Excess Kurtosis is Kurtosis - 3.
Weibull$kurtosis(excess = TRUE, ...)
excess
(logical(1))
If TRUE
(default) excess kurtosis returned.
...
Unused.
entropy()
The entropy of a (discrete) distribution is defined by
where is the pdf of distribution X, with an integration analogue for
continuous distributions.
Weibull$entropy(base = 2, ...)
base
(integer(1))
Base of the entropy logarithm, default = 2 (Shannon entropy)
...
Unused.
pgf()
The probability generating function is defined by
where X is the distribution and is the expectation of the distribution X.
Weibull$pgf(z, ...)
z
(integer(1))
z integer to evaluate probability generating function at.
...
Unused.
clone()
The objects of this class are cloneable with this method.
Weibull$clone(deep = FALSE)
deep
Whether to make a deep clone.
McLaughlin, M. P. (2001). A compendium of common probability distributions (pp. 2014-01). Michael P. McLaughlin.
Other continuous distributions:
Arcsine
,
BetaNoncentral
,
Beta
,
Cauchy
,
ChiSquaredNoncentral
,
ChiSquared
,
Dirichlet
,
Erlang
,
Exponential
,
FDistributionNoncentral
,
FDistribution
,
Frechet
,
Gamma
,
Gompertz
,
Gumbel
,
InverseGamma
,
Laplace
,
Logistic
,
Loglogistic
,
Lognormal
,
MultivariateNormal
,
Normal
,
Pareto
,
Poisson
,
Rayleigh
,
ShiftedLoglogistic
,
StudentTNoncentral
,
StudentT
,
Triangular
,
Uniform
,
Wald
Other univariate distributions:
Arcsine
,
Arrdist
,
Bernoulli
,
BetaNoncentral
,
Beta
,
Binomial
,
Categorical
,
Cauchy
,
ChiSquaredNoncentral
,
ChiSquared
,
Degenerate
,
DiscreteUniform
,
Empirical
,
Erlang
,
Exponential
,
FDistributionNoncentral
,
FDistribution
,
Frechet
,
Gamma
,
Geometric
,
Gompertz
,
Gumbel
,
Hypergeometric
,
InverseGamma
,
Laplace
,
Logarithmic
,
Logistic
,
Loglogistic
,
Lognormal
,
Matdist
,
NegativeBinomial
,
Normal
,
Pareto
,
Poisson
,
Rayleigh
,
ShiftedLoglogistic
,
StudentTNoncentral
,
StudentT
,
Triangular
,
Uniform
,
Wald
,
WeightedDiscrete
Mathematical and statistical functions for the WeightedDiscrete distribution, which is commonly used in empirical estimators such as Kaplan-Meier.
The WeightedDiscrete distribution is defined by the pmf,
for .
Sampling from this distribution is performed with the sample function with the elements given as the x values and the pdf as the probabilities. The cdf and quantile assume that the elements are supplied in an indexed order (otherwise the results are meaningless).
The number of points in the distribution cannot be changed after construction.
Returns an R6 object inheriting from class SDistribution.
The distribution is supported on .
WeightDisc(x = 1, pdf = 1)
N/A
N/A
distr6::Distribution
-> distr6::SDistribution
-> WeightedDiscrete
name
Full name of distribution.
short_name
Short name of distribution for printing.
description
Brief description of the distribution.
alias
Alias of the distribution.
properties
Returns distribution properties, including skewness type and symmetry.
distr6::Distribution$cdf()
distr6::Distribution$confidence()
distr6::Distribution$correlation()
distr6::Distribution$getParameterValue()
distr6::Distribution$iqr()
distr6::Distribution$liesInSupport()
distr6::Distribution$liesInType()
distr6::Distribution$median()
distr6::Distribution$parameters()
distr6::Distribution$pdf()
distr6::Distribution$prec()
distr6::Distribution$print()
distr6::Distribution$quantile()
distr6::Distribution$rand()
distr6::Distribution$setParameterValue()
distr6::Distribution$stdev()
distr6::Distribution$summary()
distr6::Distribution$workingSupport()
new()
Creates a new instance of this R6 class.
WeightedDiscrete$new(x = NULL, pdf = NULL, cdf = NULL, decorators = NULL)
x
numeric()
Data samples, must be ordered in ascending order.
pdf
numeric()
Probability mass function for corresponding samples, should be same length x
.
If cdf
is not given then calculated as cumsum(pdf)
.
cdf
numeric()
Cumulative distribution function for corresponding samples, should be same length x
. If
given then pdf
is ignored and calculated as difference of cdf
s.
decorators
(character())
Decorators to add to the distribution during construction.
strprint()
Printable string representation of the Distribution
. Primarily used internally.
WeightedDiscrete$strprint(n = 2)
n
(integer(1))
Ignored.
mean()
The arithmetic mean of a (discrete) probability distribution X is the expectation
with an integration analogue for continuous distributions. If distribution is improper (F(Inf) != 1, then E_X(x) = Inf).
WeightedDiscrete$mean(...)
...
Unused.
mode()
The mode of a probability distribution is the point at which the pdf is a local maximum, a distribution can be unimodal (one maximum) or multimodal (several maxima).
WeightedDiscrete$mode(which = "all")
which
(character(1) | numeric(1)
Ignored if distribution is unimodal. Otherwise "all"
returns all modes, otherwise specifies
which mode to return.
variance()
The variance of a distribution is defined by the formula
where is the expectation of distribution X. If the distribution is multivariate the
covariance matrix is returned.
If distribution is improper (F(Inf) != 1, then var_X(x) = Inf).
WeightedDiscrete$variance(...)
...
Unused.
skewness()
The skewness of a distribution is defined by the third standardised moment,
where is the expectation of distribution X,
is the mean of the
distribution and
is the standard deviation of the distribution.
If distribution is improper (F(Inf) != 1, then sk_X(x) = Inf).
WeightedDiscrete$skewness(...)
...
Unused.
kurtosis()
The kurtosis of a distribution is defined by the fourth standardised moment,
where is the expectation of distribution X,
is the mean of the
distribution and
is the standard deviation of the distribution.
Excess Kurtosis is Kurtosis - 3.
If distribution is improper (F(Inf) != 1, then k_X(x) = Inf).
WeightedDiscrete$kurtosis(excess = TRUE, ...)
excess
(logical(1))
If TRUE
(default) excess kurtosis returned.
...
Unused.
entropy()
The entropy of a (discrete) distribution is defined by
where is the pdf of distribution X, with an integration analogue for
continuous distributions.
If distribution is improper then entropy is Inf.
WeightedDiscrete$entropy(base = 2, ...)
base
(integer(1))
Base of the entropy logarithm, default = 2 (Shannon entropy)
...
Unused.
mgf()
The moment generating function is defined by
where X is the distribution and is the expectation of the distribution X.
If distribution is improper (F(Inf) != 1, then mgf_X(x) = Inf).
WeightedDiscrete$mgf(t, ...)
t
(integer(1))
t integer to evaluate function at.
...
Unused.
cf()
The characteristic function is defined by
where X is the distribution and is the expectation of the distribution X.
If distribution is improper (F(Inf) != 1, then cf_X(x) = Inf).
WeightedDiscrete$cf(t, ...)
t
(integer(1))
t integer to evaluate function at.
...
Unused.
pgf()
The probability generating function is defined by
where X is the distribution and is the expectation of the distribution X.
If distribution is improper (F(Inf) != 1, then pgf_X(x) = Inf).
WeightedDiscrete$pgf(z, ...)
z
(integer(1))
z integer to evaluate probability generating function at.
...
Unused.
clone()
The objects of this class are cloneable with this method.
WeightedDiscrete$clone(deep = FALSE)
deep
Whether to make a deep clone.
McLaughlin, M. P. (2001). A compendium of common probability distributions (pp. 2014-01). Michael P. McLaughlin.
Other discrete distributions:
Arrdist
,
Bernoulli
,
Binomial
,
Categorical
,
Degenerate
,
DiscreteUniform
,
EmpiricalMV
,
Empirical
,
Geometric
,
Hypergeometric
,
Logarithmic
,
Matdist
,
Multinomial
,
NegativeBinomial
Other univariate distributions:
Arcsine
,
Arrdist
,
Bernoulli
,
BetaNoncentral
,
Beta
,
Binomial
,
Categorical
,
Cauchy
,
ChiSquaredNoncentral
,
ChiSquared
,
Degenerate
,
DiscreteUniform
,
Empirical
,
Erlang
,
Exponential
,
FDistributionNoncentral
,
FDistribution
,
Frechet
,
Gamma
,
Geometric
,
Gompertz
,
Gumbel
,
Hypergeometric
,
InverseGamma
,
Laplace
,
Logarithmic
,
Logistic
,
Loglogistic
,
Lognormal
,
Matdist
,
NegativeBinomial
,
Normal
,
Pareto
,
Poisson
,
Rayleigh
,
ShiftedLoglogistic
,
StudentTNoncentral
,
StudentT
,
Triangular
,
Uniform
,
Wald
,
Weibull
x <- WeightedDiscrete$new(x = 1:3, pdf = c(1 / 5, 3 / 5, 1 / 5)) WeightedDiscrete$new(x = 1:3, cdf = c(1 / 5, 4 / 5, 1)) # equivalently # d/p/q/r x$pdf(1:5) x$cdf(1:5) # Assumes ordered in construction x$quantile(0.42) # Assumes ordered in construction x$rand(10) # Statistics x$mean() x$variance() summary(x)
x <- WeightedDiscrete$new(x = 1:3, pdf = c(1 / 5, 3 / 5, 1 / 5)) WeightedDiscrete$new(x = 1:3, cdf = c(1 / 5, 4 / 5, 1)) # equivalently # d/p/q/r x$pdf(1:5) x$cdf(1:5) # Assumes ordered in construction x$quantile(0.42) # Assumes ordered in construction x$rand(10) # Statistics x$mean() x$variance() summary(x)