sampleSeq: Generate Observation Sequence from HMM

Description Usage Arguments Value Author(s) See Also Examples

Description

Generates an observation sequence according to a model given as object of class hmm. Optionally the undelying state sequence is returned together with the observations.

Usage

1
2
## S4 method for signature 'contHMM,numeric'
sampleSeq(hmm, size, return.states=FALSE)

Arguments

hmm

Object of class contHMM.

size

Numeric value indicating the desired length of the observation sequence.

return.states

Logical indicating whether the underlying state sequence should be returned together with the observation sequence.

Value

If return.states is FALSE (the default) a vector of length size with observations sampled from hmm. If return.states is TRUE a list with components

states

Character vector with state sequence that was used to generate the observations.

observation

Vector with observations sampled from hmm.

Author(s)

Peter Humburg

See Also

hmm, states

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
## create two state HMM with t distributions
state.names <- c("one","two")
transition <- c(0.035, 0.01)
location <- c(1, 2)
scale <- c(1, 1)
df <- c(4, 6)
hmm1 <- getHMM(list(a=transition, mu=location, sigma=scale, nu=df),
    state.names)

## generate observation sequence from model
obs <- sampleSeq(hmm1, 100)

humburg/tileHMM documentation built on May 17, 2019, 9:13 p.m.