Learn R Programming

markovchain (version 0.8.5)

firstPassage: First passage across states

Description

This function compute the first passage probability in states

Usage

firstPassage(object, state, n)

Arguments

object

A markovchain object

state

Initial state

n

Number of rows on which compute the distribution

Value

A matrix of size 1:n x number of states showing the probability of the first time of passage in states to be exactly the number in the row.

Details

Based on Feres' Matlab listings

References

Renaldo Feres, Notes for Math 450 Matlab listings for Markov chains

See Also

conditionalDistribution

Examples

Run this code
# NOT RUN {
simpleMc <- new("markovchain", states = c("a", "b"),
                 transitionMatrix = matrix(c(0.4, 0.6, .3, .7), 
                                    nrow = 2, byrow = TRUE))
firstPassage(simpleMc, "b", 20)

# }

Run the code above in your browser using DataLab