1 : 
ingmarviss 
111 

2 : 
ingmarviss 
421 
FITTING HIDDEN MARKOV MODELS IN R

3 : 



4 : 
ingmarviss 
408 
depmixS4 provides a framework for specifying and fitting hidden Markov

5 : 


models. The observation densities use an interface to the glm

6 : 


distributions, most of which are now implemented. Besides these,

7 : 


observations can be modelled using the multinomial distribution with

8 : 


identity or logistic link function. The latter provides functionality for

9 : 


multinomial logistic responses with covariates. The transition matrix and

10 : 


the initial state probabilities are also modeled as multinomial logistics

11 : 
ingmarviss 
421 
(or multinomials with identity link, which is the default when no

12 : 


covariates are present) with the possibility of including covariates.

13 : 
ingmarviss 
434 

14 : 
ingmarviss 
421 
Optimization is by default done using the EM algorithm. When linear

15 : 


constraints are included, package Rsolnp is used for optimization (there is

16 : 


also support for using Rdonlp2 as optimizer, see details below). New

17 : 


response distributions can be added by extending the responseclass and

18 : 
ingmarviss 
408 
writing appropriate methods for it (dens, and getpars and setpars); an

19 : 


example of this is provided on the ?makeDepmix help page. depmixS4 also

20 : 
ingmarviss 
421 
fits latent class and mixture models, see ?mix for an example.

21 : 
ingmarviss 
111 

22 : 
ingmarviss 
421 
The latest development versions of depmixS4 (and depmix) can be found at:

23 : 
ingmarviss 
111 
https://rforge.rproject.org/projects/depmix/

24 : 



25 : 



26 : 
ingmarviss 
408 
FOR DEPMIX USERS

27 : 
ingmarviss 
111 

28 : 
ingmarviss 
408 
depmixS4 is a completely new implementation of the depmix package using S4

29 : 


classes. Model specification now uses formulae and family objects,

30 : 


familiar from the lm and glm functions. Moreover, the transition matrix

31 : 


and the initial state probabilities (as well as multinomial responses) are

32 : 


now modeled as multinomial logistics with a baseline. Specification of

33 : 


linear constraints uses the same mechanism as was used in depmix, with the

34 : 


only difference that constraints are passed as arguments to the fit

35 : 


function rather than the model specification function. See the help files

36 : 
ingmarviss 
421 
for further details. NOTE: most of the functionality of depmix is now

37 : 


also provided in depmixS4; in the future therefor I may stop updating

38 : 


depmix.

39 : 
ingmarviss 
111 

40 : 



41 : 
ingmarviss 
408 
USING RDONLP2

42 : 
ingmarviss 
111 

43 : 
ingmarviss 
421 
Optimization of models with (general) linear (in)equality constraint is

44 : 


done using Rsolnp (available from CRAN). Optionally the Rdonlp2 package

45 : 


can be used; Rdonlp2 was written by Ryuichi Tamura(ry.tamura @ gmail.com),

46 : 


and used to be available from: http://arumat.net/Rdonlp2/ The present

47 : 


status of Rdonlp2 is unclear.
