4

I'm quite new to R, HMMs and depmix, so apologize if this question is too obvious. I fitted a toy model and want to simulate random sequences of predetermined length. The simulate function seems the way to go. My commands:

mod <- depmix(list(speeds~1,categ~1),data=my2Ddata,nstates=2,family=list(gaussian(),multinomial("identity")),instart=runif(2))
mod <- simulate(mod)
print(mod)

Output is not the one expected (actually the output is exactly the same I get if I print mod before simulate command):

Initial state probabilties model 
pr1   pr2 
0.615 0.385 

Transition matrix 
   toS1 toS2
fromS1  0.5  0.5
fromS2  0.5  0.5

Response parameters 
Resp 1 : gaussian 
Resp 2 : multinomial 
   Re1.(Intercept) Re1.sd Re2.0 Re2.1
St1               0      1   0.5   0.5
St2               0      1   0.5   0.5

I was expecting something like a sequence of n random states drawn from fitted distribution (like they say page 41 here: https://cran.r-project.org/web/packages/depmixS4/depmixS4.pdf)

Any hint someone?

Patrick
  • 2,577
  • 6
  • 30
  • 53

1 Answers1

0
mod@response[[1]][[1]]@y
mod@response[[1]][[2]]@y

would provide the simulated speeds and categ.

mod@states

would provide the simulated hidden states.

Feng Mai
  • 2,749
  • 1
  • 28
  • 33
  • it seems that mod@response[[1]][[1]]@y provides a number of simulated values that is not clear. Is this one the way to simulate out-of-samples data? – A1010 Dec 15 '20 at 20:31