swh:1:snp:dc80812a22a7696ce24055bd58afbf9f13e3e78c
Tip revision: 24ed3f119945e321909ee421b80508aae198c0d6 authored by Friedrich Leisch on 03 May 2007, 00:00:00 UTC
version 2.0-0
version 2.0-0
Tip revision: 24ed3f1
FLXmclust.Rd
%
% Copyright (C) 2004-2005 Friedrich Leisch
% $Id: FLXmclust.Rd 3221 2007-01-22 14:27:40Z gruen $
%
\name{FLXMCmvnorm}
\alias{FLXMCmvnorm}
\alias{FLXmclust}
\title{FlexMix Clustering Demo Driver}
\description{
This is a demo driver for \code{\link{flexmix}} implementing
model-based clustering of Gaussian data.
}
\usage{
FLXMCmvnorm(formula = . ~ ., diagonal = TRUE)
}
\arguments{
\item{formula}{A formula which is interpreted relative to the formula
specified in the call to \code{\link{flexmix}} using
\code{\link{update.formula}}. Only the left-hand side (response) of
the formula is used. Default is to use the original
\code{\link{flexmix}} model
formula.}
\item{diagonal}{If \code{TRUE}, then the covariance matrix of the
components is restricted to diagonal matrices.}
}
\details{
This is mostly meant as a demo for FlexMix driver programming, you
should also look at package \pkg{mclust} for real applications.
}
\value{
\code{FLXMCmvnorm} returns an object of class \code{FLXM}.
}
\author{Friedrich Leisch}
\references{
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/
}
\seealso{\code{\link{flexmix}}}
\keyword{cluster}
\examples{
data("Nclus")
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(diag=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)
cluster(ex2)[ok]
\testonly{
stopifnot(all.equal(max.col(p), cluster(ex2)[ok]))
}
}