A weighted mixture of component distributions, optionally zero-inflated. Mirrors the
C# Mixture composite.
Arguments
- components
a list of
corehydro_distobjects, the mixture components.- weights
numeric vector of mixture weights, the same length as
components.- zero_inflated
whether the mixture places extra probability mass at zero.
- zero_weight
the probability mass at zero when
zero_inflatedisTRUE; ignored otherwise.
Examples
d <- dist_mixture(
list(distribution("Normal", c(0, 1)), distribution("Normal", c(5, 1))),
weights = c(0.5, 0.5)
)
dist_pdf(d, 2.5)
#> [1] 0.0175283