These are demo drivers for `flexmix`

implementing
model-based clustering of Gaussian data.

1 2 | ```
FLXMCmvnorm(formula = . ~ ., diagonal = TRUE)
FLXMCnorm1(formula = . ~ .)
``` |

`formula` |
A formula which is interpreted relative to the formula
specified in the call to |

`diagonal` |
If |

This is mostly meant as a demo for FlexMix driver programming, you
should also look at package mclust for real
applications. `FLXMCmvnorm`

clusters multivariate data,
`FLXMCnorm1`

univariate data. In the latter case smart
initialization is important, see the example below.

`FLXMCmvnorm`

returns an object of class `FLXMC`

.

Friedrich Leisch and Bettina Gruen

Friedrich Leisch. FlexMix: A general framework for finite mixture
models and latent class regression in R. *Journal of Statistical
Software*, **11**(8), 2004. http://www.jstatsoft.org/v11/i08/

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 | ```
data("Nclus", package = "flexmix")
require("MASS")
eqscplot(Nclus)
## This model is wrong (one component has a non-diagonal cov matrix)
ex1 <- flexmix(Nclus ~ 1, k = 4, model = FLXMCmvnorm())
print(ex1)
plotEll(ex1, Nclus)
## True model, wrong number of components
ex2 <- flexmix(Nclus ~ 1, k = 6, model = FLXMCmvnorm(diagonal = FALSE))
print(ex2)
plotEll(ex2, Nclus)
## Get parameters of first component
parameters(ex2, component = 1)
## Have a look at the posterior probabilies of 10 random observations
ok <- sample(1:nrow(Nclus), 10)
p <- posterior(ex2)[ok, ]
p
## The following two should be the same
max.col(p)
clusters(ex2)[ok]
## Now try the univariate case
plot(density(Nclus[, 1]))
ex3 <- flexmix(Nclus[, 1] ~ 1, cluster = cut(Nclus[, 1], 3),
model = FLXMCnorm1())
ex3
parameters(ex3)
``` |

Questions? Problems? Suggestions? Tweet to @rdrrHQ or email at ian@mutexlabs.com.

Please suggest features or report bugs with the GitHub issue tracker.

All documentation is copyright its authors; we didn't write any of that.