Skip to contents

Fits a mixture with morie_esl_em_gmm() and evaluates the resulting density. ESL Sec 6.8 presents the mixture as a density estimate – a smoother with a data-driven bandwidth – rather than as a clustering device, and the density is the object that view needs.

Usage

morie_esl_gaussian_mixture(X, k = 2, newdata = NULL, ...)

Arguments

X

Training data, n by p.

k

Number of components.

newdata

Points at which to evaluate; defaults to X.

...

Passed to morie_esl_em_gmm().

Value

List with density, log_density, pi, mu, sigma, loglik, aic, bic.

References

Hastie, T., et al. (2009). ESL (2nd ed.), Sec 6.8. Springer.

Examples

set.seed(1)
x <- c(rnorm(300, -3), rnorm(300, 3))
d <- morie_esl_gaussian_mixture(x, k = 2, newdata = c(-3, 0))
d$density[1] > d$density[2]
#> [1] TRUE