mix | R Documentation |
Create a mixture distribution.
mix(..., weights = 1, na.rm = FALSE)
is_mix(object)
is.mix(object)
... |
Distribution objects, possibly also lists of distributions. |
weights |
Vector of weights corresponding to the distributions; or, single numeric for equal weights. |
na.rm |
Remove |
object |
Object to be tested |
A mixture distribution – an empty distribution if any weights
are NA
and na.rm = FALSE
, the default.
a <- distionary::dst_norm(0, 1)
b <- distionary::dst_norm(5, 2)
m1 <- mix(a, b, weights = c(1, 4))
#plot(m1)
distionary::variable(m1)
c <- distionary::dst_empirical(0:6)
m2 <- mix(a, b, c, weights = c(0.2, 0.5, 0.3))
#plot(m2, n = 1001)
distionary::variable(m2)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.