Learn R Programming

markovchain (version 0.0.9.5)

absorbingStates: Various function to perform statistical and probabilistic analysis

Description

These functions return absorbing and transient states of the markovchain objects.

Usage

absorbingStates(object)
transientStates(object)
canonicForm(object)

Arguments

object
A markovchain object.

Value

  • A matrix

References

Feres, Matlab listing for markov chain.

See Also

markovchain

Examples

Run this code
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)
                 ))
absorbingStates(markovB)
transientStates(markovB)
canonicForm(markovB)
#periodicity analysis
E=matrix(0,nrow=4,ncol=4)
E[1,2]=1
#E[2,c(1, 3)]=1/2;
E[2,1]=1/3;E[2,3]=2/3
#E[3,c(2, 4)]=1/2;
E[3,2]=1/4;E[3,4]=3/4
E[4,3]=1
mcE <- new("markovchain", states = c("a", "b", "c", "d"), 
                 transitionMatrix = E, 
                 name = "E")

is.irreducible(mcE) #true
period(mcE) #2

Run the code above in your browser using DataLab