msmtools.analysis.correlation¶

msmtools.analysis.
correlation
(T, obs1, obs2=None, times=1, maxtime=None, k=None, ncv=None, return_times=False)¶ Timecorrelation for equilibrium experiment.
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 crosscorrelations
 times (arraylike of int (optional), default=(1)) – List of times (in tau) at which to compute correlation
 maxtime (int, optional, default=None) – Maximum time step to use. Equivalent to . Alternative to times.
 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
[1] Noe, F, S Doose, I Daidone, M Loellmann, M Sauer, J D Chodera and J Smith. 2010. Dynamical fingerprints for probing individual relaxation processes in biomolecular dynamics with simulations and kinetic experiments. PNAS 108 (12): 48224827. Notes
Autocorrelation
The autocorrelation 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 tstep 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.\]Crosscorrelation
The crosscorrelation 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 msmtools.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])