msmtools.estimation.prior_rev¶
-
msmtools.estimation.
prior_rev
(C, alpha=-1.0)¶ Prior counts for sampling of reversible transition matrices.
Prior is defined as
b_ij= alpha if i<=j b_ij=0 else
Parameters: - C ((M, M) ndarray or scipy.sparse matrix) – Count matrix
- alpha (float (optional)) – Value of prior counts
Returns: B – Matrix of prior counts
Return type: (M, M) ndarray
Notes
The reversible prior is a matrix with -1 on the upper triangle. Adding this prior respects the fact that for a reversible transition matrix the degrees of freedom correspond essentially to the upper triangular part of the matrix.
The prior is defined as
\[\begin{split}b_{ij} = \left \{ \begin{array}{rl} \alpha & i \leq j \\ 0 & \text{elsewhere} \end{array} \right .\end{split}\]Examples
>>> import numpy as np >>> from msmtools.estimation import prior_rev
>>> C = np.array([[10, 1, 0], [2, 0, 3], [0, 1, 4]]) >>> B = prior_rev(C) >>> B array([[-1., -1., -1.], [ 0., -1., -1.], [ 0., 0., -1.]])