dist <- c(
dist_normal(1:2),
dist_poisson(3),
dist_multinomial(size = c(4, 3),
prob = list(c(0.3, 0.5, 0.2), c(0.1, 0.5, 0.4)))
)
family(dist)
# Distributions composed of other distributions (such as the mixture
# below) only identify the outer family by default.
mix_dist <- dist_mixture(dist_normal(0, 1), dist_normal(5, 2),
weights = c(0.3, 0.7))
family(mix_dist)
# With recursive = TRUE, the families of the mixture's components are
# also identified.
family(mix_dist, recursive = TRUE)
Run the code above in your browser using DataLab