transition_entropy: Transition Entropy of a Markov Chain

View source: R/transition_entropy.R

transition_entropyR Documentation

Transition Entropy of a Markov Chain

Description

Computes per-state branching entropy, stationary entropy, and the chain-level entropy rate of a Markov transition process. The entropy rate is the Shannon-McMillan-Breiman per-step uncertainty of trajectories under the stationary distribution; it is the canonical information-theoretic summary of a transition matrix.

Usage

transition_entropy(x, base = 2, normalize = TRUE)

Arguments

x

A netobject, cograph_network, tna object, row-stochastic numeric transition matrix, or a wide sequence data.frame (rows = actors, columns = time-steps; a relative transition network is built automatically). Group dispatch on netobject_group.

base

Numeric. Logarithm base. 2 (default) for bits, exp(1) for nats, 10 for hartleys.

normalize

Logical. If TRUE (default), rows that do not sum to 1 are normalised automatically (with a warning).

Details

Convention 0 \log 0 := 0 is applied, so absorbing or deterministic rows contribute zero per-row entropy. The chain need not be irreducible; \pi is computed from the eigendecomposition of P^\top as elsewhere in the package. For non-ergodic chains the returned \pi is one stationary distribution among many - interpret with the help of chain_structure.

The relation h(P) \leq H(\pi) holds with equality iff successive states are independent. The deficit H(\pi) - h(P) is reported as redundancy - a measure of how much memory the chain has at order 1.

Value

An object of class "net_transition_entropy" with:

row_entropy

Named numeric vector, length n. Per-state branching entropy H(P_{i\cdot}) = -\sum_j P_{ij} \log P_{ij}.

row_entropy_norm

Named numeric vector. row_entropy divided by the ceiling \log_b n (in [0, 1]; all zeros when n = 1).

stationary

Named numeric vector. Stationary distribution \pi.

stationary_entropy

Scalar. H(\pi) = -\sum_i \pi_i \log \pi_i - the entropy of \pi treated as an i.i.d. distribution. Upper bound on the entropy rate.

stationary_entropy_norm

Scalar. stationary_entropy divided by the ceiling \log_b n.

entropy_rate

Scalar. h(P) = \sum_i \pi_i H(P_{i\cdot}) - the Shannon-McMillan-Breiman entropy rate.

entropy_rate_norm

Scalar. entropy_rate divided by the ceiling \log_b n.

redundancy

Scalar. H(\pi) - h(P), the entropy deficit attributable to serial dependence; zero for an i.i.d. chain (rows of P all equal \pi).

redundancy_norm

Scalar. The relative redundancy (H(\pi) - h(P)) / H(\pi) (the fraction of the stationary entropy removed by order-1 memory), not redundancy divided by \log_b n; 0 when H(\pi) = 0.

max_entropy

Scalar. The normalising ceiling \log_b n.

base

Logarithm base used.

states

Character vector of state names.

References

Cover, T.M. & Thomas, J.A. (2006). Elements of Information Theory, 2nd ed., chapter 4. Wiley.

Shannon, C.E. (1948). A mathematical theory of communication. Bell System Technical Journal, 27, 379-423.

See Also

markov_stability, passage_time, markov_order_test, chain_structure

Examples


net <- build_network(as.data.frame(trajectories), method = "relative")
te  <- transition_entropy(net)
print(te)
summary(te)
plot(te)



Nestimate documentation built on July 11, 2026, 1:09 a.m.