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 tpm (transition probability matrix).

T

The length of the Markov chain.

delta

A 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

Gamma <- matrix(c(0.5, 0.3, 0.5, 0.7), 2, 2)
T <- 10
fHMM:::simulate_markov_chain(Gamma = Gamma, T = T)
#>  [1] 1 1 2 2 2 2 1 1 1 1