Learn R Programming

HMM (version 1.0.1)

simHMM: Simulate states and observations for a Hidden Markov Model

Description

Simulates a path of states and observations for a given Hidden Markov Model.

Usage

simHMM(hmm, length)

Arguments

hmm

A Hidden Markov Model.

length

The length of the simulated sequence of observations and states.

Value

The function simHMM returns a path of states and associated observations:

states

The path of states.

observations

The sequence of observations.

Format

Dimension and Format of the Arguments.

hmm

A valid Hidden Markov Model, for example instantiated by initHMM.

See Also

See initHMM for instantiation of Hidden Markov Models.

Examples

Run this code
# NOT RUN {
# Initialise HMM
hmm = initHMM(c("X","Y"),c("a","b","c"))
# Simulate from the HMM
simHMM(hmm, 100)
# }

Run the code above in your browser using DataLab