Skip to contents

A structured wrapper around gmm_conditionalise() for the common case where the observed coordinates are specified by integer index rather than NA-padded vector. Equivalent to gmm_observe() with a selection matrix A and zero noise covariance, but routed through the Schur-complement path for efficiency.

Usage

gmm_missing(g, observed, values)

Arguments

g

A gmm (or gmm_fit) in R^p.

observed

Integer vector of indices in seq_len(p). The coordinates to condition on (fully observed).

values

Numeric vector of length length(observed). The observed values, in the same order as observed.

Value

A gmm in R^(p - length(observed)).

Examples

g <- gmm(weights = c(0.4, 0.6),
         means = list(c(-1, 0), c(1, 0)),
         covariances = list(diag(2), diag(2)))
# Condition coord 2 on the value 0.5; keep coord 1.
gmm_missing(g, observed = 2L, values = 0.5)
#> <missing(gmm)>: K = 2 components in p = 1 dimensions
#>   [1] w = 0.4000, |mu| = 1.0000, tr(Sigma) = 1.0000
#>   [2] w = 0.6000, |mu| = 1.0000, tr(Sigma) = 1.0000