Skip to contents

Returns the names of the states of a Markov chain, in the order of its transition matrix.

Usage

states(object)

# S4 method for class 'markovchain'
states(object)

Arguments

object

A markovchain object (or a ctmc object).

Value

A character vector, the states slot.

See also

Author

Giorgio Spedicato

Examples

statesNames <- c("a", "b", "c")
markovB <- new("markovchain", states = statesNames, transitionMatrix =
                matrix(c(0.2, 0.5, 0.3, 0, 1, 0, 0.1, 0.8, 0.1), nrow = 3,
                byrow = TRUE, dimnames=list(statesNames,statesNames)),
                name = "A markovchain Object" 
)
states(markovB)
#> [1] "a" "b" "c"
names(markovB)
#> [1] "a" "b" "c"