Learn R Programming

RcppHMM (version 1.2.2)

setNames: Set the names of the model

Description

Function used to set new hidden state names to the model. If it is a categorical model, it also sets the labels for the observations. This function verifies that all the parameters and new names agree in size.

Usage

setNames(hmm , names)

Arguments

hmm

a list with the necessary variables to define a hidden Markov model.

names

a list with the new names to be set in the model.

Value

A "list" that contains the verified hidden Markov model parameters.

Examples

Run this code
# NOT RUN {
## Values for a hidden Markov model with categorical observations

set.seed(1000)
newModel <- initHMM(2,4)
n <- c("First","Second")
m <- c("A","T","C","G")
newModel <- setNames(newModel,
                    list( "StateNames" = n,
                          "ObservationNames" = m) )

## Values for a hidden Markov model with continuous observations

set.seed(1000)
newModel <- initGHMM(3) 
n <- c("Low",  "Normal", "High" )
newModel <- setNames(newModel,
                     list( "StateNames" = n))

## Values for a hidden Markov model with discrete observations

set.seed(1000)
newModel <- initPHMM(3) 
n <- c("Low",  "Normal", "High" )
newModel <- setNames(newModel,
                     list( "StateNames" = n))

# }

Run the code above in your browser using DataLab