Skip to contents

Parameters of mixing components can be overridden with with_params = list(dists = list(..., ..., ...)). #' Mixing probabilites can be overridden with with_params = list(probs = list(..., ..., ...)). The number of components cannot be overridden.

Usage

dist_mixture(dists = list(), probs = NULL)

Arguments

dists

A list of mixing distributions. May contain placeholders and duplicates.

probs

A list of mixing probabilities with the same length as dists. They are normalized to sum to one and NULL can be used as a placeholder within probs. To reduce the number of required parameters, probs should at least be partly specified (probs = list(NULL, NULL, ..., 1) with k - 1 NULLs where k is the number of mixing components).

Value

A MixtureDistribution object.

Details

Does not support the quantile() capability!

Examples


# A complicated way to define a uniform distribution on \[0, 2\]
dist_mixture(
  dists = list(
    dist_uniform(min = 0, max = 1),
    dist_uniform(min = 1, max = 2)
  ),
  probs = list(0.5, 0.5)
)
#> A Mixture<UniformDistribution, UniformDistribution> with 0 dof