simulate.hsmmspec {mhsmm} | R Documentation |
Simulates values for a specified hidden semi-Markov model
## S3 method for class 'hsmmspec' simulate(object, nsim, seed = NULL,rand.emission=NULL,...)
object |
A |
nsim |
An integer or vector of integers (for multiple sequences) specifying the length of the sequence(s) |
seed |
|
rand.emission |
The function used to generate observations from the emission distribution |
... |
further arguments passed to or from other methods. |
If nsim
is a single integer then a HSMM of that length is produced. If nsim
is a vector of integers, then length(nsim)
sequences are generated with respective lengths.
An object of class hmmdata
x |
A vector of length |
s |
A vector of length |
N |
A vector of the length of each observation sequence (used to segment x and s) |
Jared O'Connell jaredoconnell@gmail.com
Guedon, Y. (2003), Estimating hidden semi-Markov chains from discrete sequences, Journal of Computational and Graphical Statistics, Volume 12, Number 3, page 604-639 - 2003
hsmmfit
,
hsmmspec
,
predict.hsmm
J <- 3 init <- c(0,0,1) P <- matrix(c(0,.1,.4,.5,0,.6,.5,.9,0),nrow=J) B <- list(mu=c(10,15,20),sigma=c(2,1,1.5)) d <- list(lambda=c(10,30,60),shift=c(10,100,30),type='poisson') model <- hsmmspec(init,P,parms.emission=B,sojourn=d,dens.emission=dnorm.hsmm) train <- simulate(model,rand.emis=rnorm.hsmm,nsim=100,seed=123456) plot(train,xlim=c(0,400))