FLXMCmvcombi | R Documentation |
This is a model driver for flexmix
implementing
model-based clustering of a combination of binary and Gaussian data.
FLXMCmvcombi(formula = . ~ .)
formula |
A formula which is interpreted relative to the formula
specified in the call to |
This model driver can be used to cluster mixed-mode binary and
Gaussian data. It checks which columns of a matrix contain only zero
and ones, and does the same as FLXMCmvbinary
for them. For
the remaining columns of the data matrix independent Gaussian
distributions are used (same as FLXMCmvnorm
with
diagonal = FALSE
.
The same could be obtained by creating a corresponding list of two
models for the respective columns, but FLXMCmvcombi
does a
better job in reporting parameters.
FLXMCmvcombi
returns an object of class FLXMC
.
Friedrich Leisch
flexmix
, FLXMCmvbinary
, FLXMCmvnorm
## create some artificial data
x1 <- cbind(rnorm(300),
sample(0:1, 300, replace = TRUE, prob = c(0.25, 0.75)))
x2 <- cbind(rnorm(300, mean = 2, sd = 0.5),
sample(0:1, 300, replace = TRUE, prob = c(0.75, 0.25)))
x <- rbind(x1, x2)
## fit the model
f1 <- flexmix(x ~ 1, k = 2, model = FLXMCmvcombi())
## should be similar to the original parameters
parameters(f1)
table(clusters(f1), rep(1:2, c(300,300)))
## a column with noise should not hurt too much
x <- cbind(x, rnorm(600))
f2 <- flexmix(x ~ 1, k = 2, model = FLXMCmvcombi())
parameters(f2)
table(clusters(f2), rep(1:2, c(300,300)))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.