sim.hmm: Simulate discrete data from a hidden Markov model.
Description
Simulates one or more replicates of discrete data
from a model such as is fitted by the function hmm().
Usage
sim.hmm(nsim, tpm, Rho, nrep=1)
Arguments
nsim
The length of each sequence of observations.
tpm
The transition probability matrix for the underlying hidden Markov
chain(s). Note that the rows of tpm must sum to 1.
Ignored if ncol(Rho)==1.
Rho
A matrix specifying the probability of an observation taking on one
of a set of possible values, given the state of the underlying hidden
Markov chain. Note that the columns of Rho must sum to 1.
If ncol(Rho)==1 the data are i.i
nrep
The number of independent replicate sequences of observations.
Value
A matrix with nsim rows and nrep columns; if
nrep==1, then the returned value is a vector of length
nsim. Each column of the matrix forms an independent
replicate of observations from the specified hidden Markov model.
The values of those observations are integers between 1 and
nrow(Rho).