R: Random number generation from a multivariate normal...

rmvnorm.hsmm {mhsmm} | R Documentation

## Random number generation from a multivariate normal distributed emission distribution

### Description

This generates values from a multivariate normal distributed emission state `j` given parameters in `model`.

### Usage

    rmvnorm.hsmm(j, model)

### Arguments

`j` | An integer representing the state
`model` | A `hmmspec` or `hsmmspec` object

### Details

This is essentially a wrapper for `rnorm`. Users may build functions with the same arguments and return values so they can use their own custom emission distributions.

### Value

A single value from the emission distribution.

### Author(s)

Jared O'Connell jaredoconnell@gmail.com

### See Also

`dmvnorm.hsmm`, `mstep.mvnorm`

### Examples

      J<-2
      initial <- rep(1/J,J)
      P <- matrix(c(.3,.5,.7,.5),nrow=J)
      b <- list(mu=list(c(-3,0),c(1,2)),sigma=list(diag(2),matrix(c(4,2,2,3), ncol=2)))
      model <- hmmspec(init=initial, trans=P, parms.emission=b,dens.emission=dmvnorm.hsmm)
      model
      train <- simulate(model, nsim=300, seed=1234, rand.emis=rmvnorm.hsmm)
      plot(train,xlim=c(0,100))
      h1 = hmmfit(train,model,mstep=mstep.mvnorm)

[Package mhsmm version 0.4.16 Index]