Learn R Programming

markovchain (version 0.0.3)

markovchainList-class: Class "markovchainList"

Description

A class to handle non - homogeneous markov chains

Arguments

Objects from the Class

Objects can be created by calls of the form new("markovchainList", ...). Each item in the list is a markovchain object.

References

Sheldon Ross

See Also

markovchain

Examples

Run this code
showClass("markovchainList")
#define a markovchainList
statesNames=c("a","b")
 mcA<-new("markovchain", transitionMatrix=matrix(c(0.7,0.3,0.1,0.9),
 byrow=TRUE, nrow=2, dimnames=list(statesNames,statesNames)))
mcB<-new("markovchain", states=c("a","b","c"), 
transitionMatrix=matrix(c(0.2,0.5,0.3,0,1,0,0.1,0.8,0.1),
nrow=3, byrow=TRUE))
mcC<-new("markovchain", states=c("a","b","c","d"), 
  	transitionMatrix=matrix(c(0.25,0.75,0,0,0.4,0.6,
    0,0,0,0,0.1,0.9,0,0,0.7,0.3), nrow=4, byrow=TRUE)
)
mcList<-new("markovchainList",markovchains=list(mcA, mcB, mcC))

Run the code above in your browser using DataLab