Skip to contents

This function simulates a Markov chain.

Usage

simulate_markov_chain(Gamma, T, delta = oeli::stationary_distribution(Gamma))

Arguments

Gamma

[matrix()]
A transition probability matrix.

T

[integer(1)]
The length of the Markov chain.

delta

[numeric()]
A probability vector, the initial distribution.

By default, delta is the stationary distribution of Gamma.

Value

A numeric vector of length T with states.

See also

Examples

Gamma <- sample_transition_probability_matrix(dim = 3)
simulate_markov_chain(Gamma = Gamma, T = 10)
#>  [1] 2 2 2 1 3 2 1 3 3 2