Skip to contents

Computes the conditional distribution of a Gaussian mixture given fixed values of a subset of coordinates, by the Schur-complement formula applied component-wise and re-weighted by the marginal evidence \(p(\textit{x}_b)\) of each component.

Usage

gmm_conditionalise(g, given)

Arguments

g

A gmm (or gmm_fit) object.

given

A length-p numeric vector. Coordinates to condition on take their numeric value; coordinates left free are NA.

Value

A gmm object in dimension equal to the number of free coordinates.

Examples

g <- gmm(weights = c(0.5, 0.5),
         means = list(c(-1, 0), c(1, 0)),
         covariances = list(diag(2), diag(2)))
gmm_conditionalise(g, given = c(NA, 0.5))
#> <conditionalise(gmm)>: K = 2 components in p = 1 dimensions
#>   [1] w = 0.5000, |mu| = 1.0000, tr(Sigma) = 1.0000
#>   [2] w = 0.5000, |mu| = 1.0000, tr(Sigma) = 1.0000