# NOT RUN {
m <- matrix(1 / 10 * c(6,3,1,
2,3,5,
4,1,5), ncol = 3, byrow = TRUE)
mc <- new("markovchain", states = c("s","c","r"), transitionMatrix = m)
meanFirstPassageTime(mc, "r")
# Grinstead and Snell's "Oz weather" worked out example
mOz <- matrix(c(2,1,1,
2,0,2,
1,1,2)/4, ncol = 3, byrow = TRUE)
mcOz <- new("markovchain", states = c("s", "c", "r"), transitionMatrix = mOz)
meanFirstPassageTime(mcOz)
# }
Run the code above in your browser using DataLab