R: Simulation for HSMMs

simulate.hsmmspec {mhsmm} | R Documentation

## Simulation for HSMMs

### Description

Simulates values for a specified hidden semi-Markov model

### Usage

    ## S3 method for class 'hsmmspec'
    simulate(object, nsim, seed = NULL,rand.emission=NULL,...)

### Arguments

`object` | A `hsmmspec` object
`nsim` | An integer or vector of integers (for multiple sequences) specifying the length of the sequence(s)
`seed` | `seed` for the random number generator
`rand.emission` | The function used to generate observations from the emission distribution
`...` | further arguments passed to or from other methods.

### Details

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.

### Value

An object of class hmmdata

`x` | A vector of length `sum(N)` - the sequence(s) of observed values
`s` | A vector of length `sum(N)` - the sequence(s) of hidden states
`N` | A vector of the length of each observation sequence (used to segment x and s)

### Author(s)

Jared O'Connell jaredoconnell@gmail.com

### References

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

### See Also

`hsmmfit`, `hsmmspec`, `predict.hsmm`

### Examples

    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))

[Package mhsmm version 0.4.16 Index]