Skip to contents

A continuous time Markov chain with stationary distribution \(\pi\) is time reversible if it satisfies the detailed balance equations \(\pi_i Q_{ij} = \pi_j Q_{ji}\) for all states \(i, j\).

Usage

is.TimeReversible(ctmc)

Arguments

ctmc

A ctmc object.

Value

TRUE if the chain is time reversible, FALSE otherwise.

Details

The equations are checked up to a relative tolerance of \(\sqrt{\epsilon}\) (about \(1.5 \times 10^{-8}\)) of the largest flow \(\pi_i |Q_{ij}|\), because \(\pi\) is computed numerically. When the chain has several stationary distributions they must all satisfy them.

References

Dobrow, R. P. (2016). Introduction to Stochastic Processes with R. Wiley.

Author

Vandit Jain

Examples

energyStates <- c("sigma", "sigma_star")
gen <- matrix(c(-3, 3, 1, -1), nrow = 2, byrow = TRUE,
              dimnames = list(energyStates, energyStates))
molecularCTMC <- new("ctmc", states = energyStates, byrow = TRUE,
                     generator = gen, name = "Molecular Transition Model")
is.TimeReversible(molecularCTMC)
#> [1] TRUE

# a birth-death chain is reversible, a cycle is not
s <- c("a", "b", "c")
birthDeath <- matrix(c(-0.3, 0.3, 0,
                       0.1, -0.5, 0.4,
                       0, 0.7, -0.7), nrow = 3, byrow = TRUE,
                     dimnames = list(s, s))
is.TimeReversible(new("ctmc", states = s, byrow = TRUE, generator = birthDeath))
#> [1] TRUE
cycle <- matrix(c(-1, 1, 0, 0, -1, 1, 1, 0, -1), nrow = 3, byrow = TRUE,
                dimnames = list(s, s))
is.TimeReversible(new("ctmc", states = s, byrow = TRUE, generator = cycle))
#> [1] FALSE