states: State Names of Hidden Markov Model

Description Usage Arguments Value Author(s) See Also Examples

Description

Returns a vector of state names for given HMM.

Usage

1
2
## S4 method for signature 'hmm'
states(hmm)

Arguments

hmm

Object of class hmm

...

Additional arguments.

Value

A character vector with as many entries as hmm has states. Each entry represents the name of the corresponding state.

Author(s)

Peter Humburg

See Also

hmm

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
## create two state HMM with t distributions
state.names <- c("one","two")
transition <- c(0.1, 0.02)
location <- c(1, 2)
scale <- c(1, 1)
df <- c(4, 6)
model <- getHMM(list(a=transition, mu=location, sigma=scale, nu=df), 
    state.names)

## obtain observation sequence from model
obs <- sampleSeq(model, 100, return.states=TRUE)

## compute most likely state sequence for obs
## return sequence of state indices instead of names
vit.res <- viterbi(model, obs$observation, names=FALSE)

## get sequence of state names via call to 'states'
state.seq <- states(model)[vit.res$stateSeq]

Example output



tileHMM documentation built on May 30, 2017, 3:41 a.m.