deeptime.markov.tools.analysis.correlation¶
- deeptime.markov.tools.analysis.correlation(T, obs1, obs2=None, times=(1,), k=None, ncv=None)¶
Time-correlation for equilibrium experiment. [1]
- Parameters:
T ((M, M) ndarray or scipy.sparse matrix) – Transition matrix
obs1 ((M,) ndarray) – Observable, represented as vector on state space
obs2 ((M,) ndarray (optional)) – Second observable, for cross-correlations
times (array-like of int (optional), default=(1)) – List of times (in tau) at which to compute correlation
k (int (optional)) – Number of eigenvalues and eigenvectors to use for computation
ncv (int (optional)) – The number of Lanczos vectors generated, ncv must be greater than k; it is recommended that ncv > 2*k
- Returns:
correlations (ndarray) – Correlation values at given times
times (ndarray, optional) – time points at which the correlation was computed (if return_times=True)
References
Notes
Auto-correlation
The auto-correlation of an observable \(a(x)\) for a system in equilibrium is
\[\mathbb{E}_{\mu}[a(x,0)a(x,t)]=\sum_x \mu(x) a(x, 0) a(x, t) \]\(a(x,0)=a(x)\) is the observable at time \(t=0\). It can be propagated forward in time using the t-step transition matrix \(p^{t}(x, y)\).
The propagated observable at time \(t\) is \(a(x, t)=\sum_y p^t(x, y)a(y, 0)\).
Using the eigenvlaues and eigenvectors of the transition matrix the autocorrelation can be written as
\[\mathbb{E}_{\mu}[a(x,0)a(x,t)]=\sum_i \lambda_i^t \langle a, r_i\rangle_{\mu} \langle l_i, a \rangle. \]Cross-correlation
The cross-correlation of two observables \(a(x)\), \(b(x)\) is similarly given
\[\mathbb{E}_{\mu}[a(x,0)b(x,t)]=\sum_x \mu(x) a(x, 0) b(x, t) \]Examples
>>> import numpy as np >>> from deeptime.markov.tools.analysis import correlation
>>> T = np.array([[0.9, 0.1, 0.0], [0.5, 0.0, 0.5], [0.0, 0.1, 0.9]]) >>> a = np.array([1.0, 0.0, 0.0]) >>> times = np.array([1, 5, 10, 20])
>>> corr = correlation(T, a, times=times) >>> corr array([0.40909091, 0.34081364, 0.28585667, 0.23424263])