flexmix (version 2.3-15)

FLXMCmvcombi: FlexMix Binary and Gaussian Clustering Driver

Description

This is a model driver for flexmix implementing model-based clustering of a combination of binary and Gaussian data.

Usage

FLXMCmvcombi(formula = . ~ .)

Arguments

formula

A formula which is interpreted relative to the formula specified in the call to flexmix using update.formula. Only the left-hand side (response) of the formula is used. Default is to use the original flexmix model formula.

Value

FLXMCmvcombi returns an object of class FLXMC.

Details

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.

See Also

flexmix, FLXMCmvbinary, FLXMCmvnorm

Examples

Run this code
# NOT RUN {
## 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)))

# }

Run the code above in your browser using DataCamp Workspace