Skip to contents

This function simulates a Markov chain.

Usage

simulate_markov_chain(
  Gamma,
  T,
  delta = Gamma2delta(Gamma),
  seed = NULL,
  total_length = T
)

Arguments

Gamma

A transition probability matrix (tpm).

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

seed

Set a seed.

total_length

An integer, the total length of the output vector. Must be greater or equal than T.

Value

A numeric vector of length T with states.

Examples

if (FALSE) {
Gamma <- matrix(c(0.5, 0.3, 0.5, 0.7), 2, 2)
T <- 10
simulate_markov_chain(Gamma = Gamma, T = T)
}