Description Usage Arguments Details Value Author(s) References See Also Examples

`lcmixed`

is a method for the
`flexmix`

-function in package
`flexmix`

. It provides the necessary information to run an
EM-algorithm for maximum likelihood estimation for a latent class
mixture (clustering) model where some variables are continuous
and modelled within the mixture components by Gaussian distributions
and some variables are categorical and modelled within components by
independent multinomial distributions. `lcmixed`

can be called
within `flexmix`

. The function `flexmixedruns`

is a wrapper
function that can be run to apply `lcmixed`

.

Note that at least one categorical variable is needed, but it is possible to use data without continuous variable.

There are further format restrictions to the data (see below in the
documentation of `continuous`

and `discrete`

), which
can be ignored when running `lcmixed`

through
`flexmixedruns`

.

1 2 |

`formula` |
a formula to specify response and explanatory
variables. For |

`continuous` |
number of continuous variables. Note that the continuous variables always need to be the first variables in the matrix or data frame. |

`discrete` |
number of categorical variables. Always the last variables in the matrix or data frame. Note that categorical variables always must be coded as integers 1,2,3, etc. without interruption. |

`ppdim` |
vector of integers specifying the number of (in the data) existing categories for each categorical variable. |

`diagonal` |
logical. If |

`pred.ordinal` |
logical. If |

`printlik` |
logical. If |

The data need to be organised case-wise, i.e., if there are categorical variables only, and 15 cases with values c(1,1,2) on the 3 variables, the data matrix needs 15 rows with values 1 1 2.

General documentation on flexmix methods can be found in Chapter 4 of Friedrich Leisch's "FlexMix: A General Framework for Finite Mixture Models and Latent Class Regression in R", https://CRAN.R-project.org/package=flexmix

An object of class `FLXMC`

(not documented; only used
internally by `flexmix`

).

Christian Hennig christian.hennig@unibo.it https://www.unibo.it/sitoweb/christian.hennig/en

Hennig, C. and Liao, T. (2013) How to find an appropriate clustering
for mixed-type variables with application to socio-economic
stratification, *Journal of the Royal Statistical Society, Series
C Applied Statistics*, 62, 309-369.

`flexmixedruns`

, `flexmix`

,
`flexmix-class`

,
`discrete.recode`

, which recodes a dataset into the format
required by `lcmixed`

1 2 3 4 5 6 7 8 9 10 11 | ```
set.seed(112233)
options(digits=3)
require(MASS)
require(flexmix)
data(Cars93)
Cars934 <- Cars93[,c(3,5,8,10)]
cc <-
discrete.recode(Cars934,xvarsorted=FALSE,continuous=c(2,3),discrete=c(1,4))
fcc <- flexmix(cc$data~1,k=2,
model=lcmixed(continuous=2,discrete=2,ppdim=c(6,3),diagonal=TRUE))
summary(fcc)
``` |

```
Loading required package: MASS
Loading required package: flexmix
Loading required package: lattice
Call:
flexmix(formula = cc$data ~ 1, k = 2, model = lcmixed(continuous = 2,
discrete = 2, ppdim = c(6, 3), diagonal = TRUE))
prior size post>0 ratio
Comp.1 0.327 29 40 0.725
Comp.2 0.673 64 72 0.889
'log Lik.' -782 (df=23)
AIC: 1610 BIC: 1669
```

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.