`mix`

creates an object of class `mix`

, an (independent)
mixture model (as a limit case of dependent mixture models in which all
observed time series are of length 1), otherwise known latent class or
mixture model. For a short description of the package see
`depmixS4`

.

1 2 3 4 |

`response` |
The response to be modeled; either a formula or a list of formulae in the multivariate case; this interfaces to the glm distributions. See 'Details'. |

`data` |
An optional data.frame to interpret the variables in the response and transition arguments. |

`nstates` |
The number of states of the model. |

`family` |
A family argument for the response. This must be a list of family's if the response is multivariate. |

`prior` |
A one-sided formula specifying the density for the prior or initial state probabilities. |

`initdata` |
An optional data.frame to interpret the variables occuring in prior. The number of rows of this data.frame must be equal to the number of cases being modeled. See 'Details'. |

`respstart` |
Starting values for the parameters of the response models. |

`instart` |
Starting values for the parameters of the prior or initial state probability model. |

`...` |
Not used currently. |

The function `mix`

creates an S4 object of class `mix`

,
which needs to be fitted using `fit`

to optimize the
parameters.

The response model(s) are by default created by call(s) to
`GLMresponse`

using the `formula`

and the `family`

arguments, the latter specifying the error distribution. See
`GLMresponse`

for possible values of the `family`

argument for `glm`

-type responses (ie a subset of the `glm`

family options, and the multinomial). Alternative response
distributions are specified by using the `makeDepmix`

function. Its help page has examples of specifying a model with a
multivariate normal response, as well as an example of adding a
user-defined response model, in this case for the ex-gauss
distribution.

If `response`

is a list of formulae, the `response`

's are
assumed to be independent conditional on the latent state.

The prior density is modeled as a multinomial logistic. This model is
created by a call to `transInit`

.

Starting values may be provided by the respective arguments. The order
in which parameters must be provided can be easily studied by using the
`setpars`

and `getpars`

functions.

Linear constraints on parameters can be provided as argument to the
`fit`

function.

The print function prints the formulae for the response and prior models along with their parameter values.

`mix`

returns an object of class `mix`

which has the
following slots:

`response` |
A list of a list of response models; the first index runs over states; the second index runs over the independent responses in case a multivariate response is provided. |

`prior` |
A multinomial logistic model for the initial state probabilities. |

`dens,init` |
See |

`ntimes` |
A vector made by |

`nstates` |
The number of states of the model. |

`nresp` |
The number of independent responses. |

`npars` |
The total number of parameters of the model. Note: this
is |

Ingmar Visser

A. L. McCutcheon (1987). *Latent class analysis*. Sage
Publications.

`fit`

, `transInit`

, `GLMresponse`

,
`depmix-methods`

for accessor functions to `depmix`

objects.

1 2 3 4 5 6 7 8 9 10 11 12 13 | ```
# four binary items on the balance scale task
data(balance)
# define a latent class model
instart=c(0.5,0.5)
set.seed(1)
respstart=runif(16)
# note that ntimes argument is used to make this a mixture model
mod <- mix(list(d1~1,d2~1,d3~1,d4~1), data=balance, nstates=2,
family=list(multinomial(),multinomial(),multinomial(),multinomial()),
respstart=respstart,instart=instart)
# to see the model
mod
``` |

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.