Mixtures assume univariate components
robjhyndman opened this issue · 1 comments
robjhyndman commented
e.g.,
library(distributional)
p1 <- p2 <- 0.5
mu1 <- c(0, 0)
mu2 <- c(3, 1)
Sigma1 <- rbind(c(1, 0.5), c(0.5, 1))
Sigma2 <- diag(2)
dist_mixture(
dist_multivariate_normal(list(mu1), list(Sigma1)),
dist_multivariate_normal(list(mu2), list(Sigma2)),
weights = c(p1, p2)
) |>
mean()
#> Error in vapply(x[["dist"]], mean, numeric(1L), ...): values must be length 1,
#> but FUN(X[[1]]) result is length 2
Created on 2024-07-31 with reprex v2.1.1
mitchelloharawild commented
Implementation of this partly depends on #25, due to the problem being encapsulation of different distribution types.
dim(<dist>)
exists to identify the appropriate dimension of the distribution, but is unused (and is not currently easy to use).