Skip to contents

Computes the marginal distribution of a Gaussian mixture over a subset of coordinates. The marginal of a Gaussian mixture is itself a Gaussian mixture with the same weights.

Usage

gmm_marginalise(g, keep)

Arguments

g

A gmm (or gmm_fit) object.

keep

Integer vector of coordinate indices to retain (in 1..p).

Value

A gmm object in dimension length(keep).

Examples

g <- gmm(weights = c(0.5, 0.5),
         means = list(c(-1, 0, 2), c(1, 0, -2)),
         covariances = list(diag(3), diag(3)))
gmm_marginalise(g, keep = c(1L, 3L))
#> <marginalise(gmm)>: K = 2 components in p = 2 dimensions
#>   [1] w = 0.5000, |mu| = 2.2361, tr(Sigma) = 2.0000
#>   [2] w = 0.5000, |mu| = 2.2361, tr(Sigma) = 2.0000