Skip to contents

A broom-style tidy() method: one row per component, with the weight, the mean coordinates (mean_1, ...), and the marginal variances (var_1, ...). Available as generics::tidy(g) (or broom::tidy(g)) when the generics package is installed.

Arguments

x

A gmm (or gmm_fit).

...

Ignored, for generic compatibility.

Value

A data frame with K rows.

Examples

g <- gmm(weights = c(0.3, 0.7), means = list(c(-1, 0), c(2, 1)),
         covariances = list(diag(2), 0.5 * diag(2)))
generics::tidy(g)
#>   component weight mean_1 mean_2 var_1 var_2
#> 1         1    0.3     -1      0   1.0   1.0
#> 2         2    0.7      2      1   0.5   0.5