Learn R Programming

markovchain (version 0.9.5)

firstPassage: First passage across states

Description

This function compute the first passage probability in states

Usage

firstPassage(object, state, n)

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.

Arguments

object

A markovchain object

state

Initial state

n

Number of rows on which compute the distribution

Author

Giorgio Spedicato

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
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