Skip to contents

Read-only accessors for the component weights, means, and covariances.

Usage

gmm_weights(g)

gmm_means(g)

gmm_covariances(g)

Arguments

g

A gmm (or gmm_fit).

Value

gmm_weights() returns a numeric vector of length K; gmm_means() and gmm_covariances() return length-K lists of length-p numeric vectors and p by p matrices respectively.

See also

gmm_mean() / gmm_cov() for the moments of the mixture as a whole, gmm_fit_quality() for the fit-quality certificate.

Other classes: autoplot.gmm_fit, glance.gmm_fit, gmm(), gmm_counterfactual_law(), gmm_dim(), gmm_fit(), gmm_n_components(), gmm_target(), is_proposal(), tidy.gmm

Examples

g <- gmm(weights = c(0.3, 0.7), means = list(-1, 2),
         covariances = list(matrix(1), matrix(0.5)))
gmm_weights(g)
#> [1] 0.3 0.7
gmm_means(g)
#> [[1]]
#> [1] -1
#> 
#> [[2]]
#> [1] 2
#>