# msmtools.analysis.expected_counts_stationary¶

msmtools.analysis.expected_counts_stationary(T, N, mu=None)

Expected transition counts for Markov chain in equilibrium.

Parameters: T ((M, M) ndarray or sparse matrix) – Transition matrix. N (int) – Number of steps for chain. mu ((M,) ndarray (optional)) – Stationary distribution for T. If mu is not specified it will be computed from T. EC – Expected value for transition counts after N steps. (M, M) ndarray or sparse matrix

Notes

Since $$\mu$$ is stationary for $$T$$ we have

$\mathbb{E}[C^{(N)}]=N D_{\mu}T.$

$$D_{\mu}$$ is a diagonal matrix. Elements on the diagonal are given by the stationary vector $$\mu$$

Examples

>>> import numpy as np
>>> from msmtools.analysis import expected_counts_stationary

>>> T = np.array([[0.9, 0.1, 0.0], [0.5, 0.0, 0.5], [0.0, 0.1, 0.9]])
>>> N = 100
>>> EC = expected_counts_stationary(T, N)

>>> EC
array([[ 40.90909091,   4.54545455,   0.        ],
[  4.54545455,   0.        ,   4.54545455],
[  0.        ,   4.54545455,  40.90909091]])