Wrapper used to construct a mixture of two or more distributions.
Returns an R6 object of class MixtureDistribution.
MixtureDistribution$new(distlist, weights = NULL, vectordist = NULL)
Argument | Type | Details |
distlist |
list | List of distributions. |
weights |
numeric | Vector of weights. See Details. |
vectordist |
numeric | Vector Distribution. See Details. |
Variable | Return |
name |
Name of distribution. |
short_name |
Id of distribution. |
description |
Brief description of distribution. |
Accessor Methods | Link |
wrappedModels(model = NULL) |
wrappedModels |
decorators() |
decorators |
traits() |
traits |
valueSupport() |
valueSupport |
variateForm() |
variateForm |
type() |
type |
properties() |
properties |
support() |
support |
symmetry() |
symmetry |
sup() |
sup |
inf() |
inf |
dmax() |
dmax |
dmin() |
dmin |
skewnessType() |
skewnessType |
kurtosisType() |
kurtosisType |
d/p/q/r Methods | Link |
pdf(x1, ..., log = FALSE, simplify = TRUE) |
pdf |
cdf(x1, ..., lower.tail = TRUE, log.p = FALSE, simplify = TRUE) |
cdf |
quantile(p, ..., lower.tail = TRUE, log.p = FALSE, simplify = TRUE) |
quantile.Distribution |
rand(n, simplify = TRUE) |
rand |
Statistical Methods | Link |
prec() |
prec |
stdev() |
stdev |
median() |
median.Distribution |
iqr() |
iqr |
cor() |
cor |
Parameter Methods | Link |
parameters(id) |
parameters |
getParameterValue(id, error = "warn") |
getParameterValue |
setParameterValue(..., lst = NULL, error = "warn") |
setParameterValue |
Validation Methods | Link |
liesInSupport(x, all = TRUE, bound = FALSE) |
liesInSupport |
liesInType(x, all = TRUE, bound = FALSE) |
liesInType |
Representation Methods | Link |
strprint(n = 2) |
strprint |
print(n = 2) |
print |
summary(full = T) |
summary.Distribution |
plot() |
Coming Soon. |
qqplot() |
Coming Soon. |
A Mixture Distribution is a weighted combination of two or more distributions such that for pdf/cdfs of n distribution \(f_1,...,f_n\)/\(F_1,...,F_n\) and a given weight associated to each distribution, \(w_1,...,w_n\). The pdf of the mixture distribution \(M(X1,...,XN)\), \(f_M\) is given by $$f_M = \sum_i (f_i)(w_i)$$ and the cdf, F_M is given by $$F_M = \sum_i (F_i)(w_i)$$
If weights are given, they should be provided as a vector of numerics. If they don't sum to one then they are normalised automatically. If NULL, they are taken to be uniform, i.e. for n distributions, \(w_i = 1/n, \ \forall \ i \ \in \ [1,n]\).
Can optionally be constructed using a VectorDistribution
, in which case distlist
is ignored
and the mixture is constructed with the wrapped models in the vector.
# NOT RUN {
mixture <- MixtureDistribution$new(list(Binomial$new(prob = 0.5, size = 10), Binomial$new()),
weights = c(0.2,0.8))
mixture$pdf(1)
mixture$cdf(1)
# }
Run the code above in your browser using DataLab