dirichletChain: Markov chain from a Dirichlet process

View source: R/random.R

dirichletChainR Documentation

Markov chain from a Dirichlet process

Description

Generates a Markov chain whose rows are drawn from a truncated Dirichlet process with the stick-breaking (GEM) construction, as MarkovChain.dirichlet_process() of PyDTMC does.

Usage

dirichletChain(
  n,
  diffusion,
  states = NULL,
  diagonalBias = NULL,
  shiftConcentration = FALSE,
  byrow = TRUE,
  seed = NULL,
  name = "Dirichlet process chain"
)

Arguments

n

The number of states, at least 2. It can be omitted when states is given.

diffusion

The concentration parameter \alpha > 0 of the Dirichlet process. Small values concentrate the probability of each row on its first states; large values spread it more evenly.

states

An optional character vector of n state names. Defaults to as.character(1:n).

diagonalBias

An optional positive number \beta. When given, a draw from \mathrm{Beta}(\beta, 1) is added to each diagonal entry before the row is renormalised, which makes the chain more likely to stay where it is; larger values give a stronger bias.

shiftConcentration

If TRUE, the columns are reversed, so that the probability concentrates on the last states instead of the first ones.

byrow

Whether the transition matrix of the result is stored by rows (the default) or by columns.

seed

An optional whole number, as in randomMarkovChain.

name

The name slot of the result.

Details

For each row, b_1, \ldots, b_n are independent \mathrm{Beta}(1, \alpha) draws and the weights are

w_j = b_j \prod_{k < j} (1 - b_k),

normalised to sum to one (the truncation at n states leaves out the mass \prod_k (1 - b_k)). PyDTMC only accepts whole values of \alpha between 1 and n; any positive value is accepted here, since the construction is defined for every \alpha > 0.

Value

A markovchain object with n states.

References

Sethuraman, J. (1994). A constructive definition of Dirichlet priors. Statistica Sinica, 4(2), 639-650.

See Also

randomMarkovChain

Examples

dirichletChain(5, diffusion = 2, seed = 1)
# a chain that tends to stay in its current state
dirichletChain(5, diffusion = 2, diagonalBias = 5, seed = 1)


markovchain documentation built on Oct. 10, 2026, 9:07 a.m.