R: First passage across states

firstPassage {markovchain} | R Documentation

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

### Details

Based on Feres' Matlab listings

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

### Author(s)

Giorgio Spedicato

### References

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

### See Also

`conditionalDistribution`

### Examples

    simpleMc <- new("markovchain", states = c("a", "b"),
                     transitionMatrix = matrix(c(0.4, 0.6, .3, .7),
                                        nrow = 2, byrow = TRUE))
    firstPassage(simpleMc, "b", 20)

[Package markovchain version 0.8.6 Index]