Learn R Programming

oeli (version 0.5.2)

simulate_markov_chain: Simulate Markov chain

Description

This function simulates a Markov chain.

Usage

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

Value

A numeric vector of length T with states.

Arguments

Gamma

A transition probability matrix.

T

An integer, the length of the Markov chain.

delta

A numeric probability vector, the initial distribution. If not specified, delta is set to the stationary distribution of Gamma.

Examples

Run this code
Gamma <- sample_transition_probability_matrix(dim = 3)
simulate_markov_chain(Gamma = Gamma, T = 10)

Run the code above in your browser using DataLab