*TD2*ΒΆ

**TD2 module performs temporal decorrelation of second order
on the spatially whitened data**

TD2 module removes dominant second order temporal correlations by computing a time-delayed covariance matrix and performing PCA.

This code makes use of AMUSE algorithm which can be found using the link

http://docs.markovmodel.org/lecture_tica.html

An eigen value decomposition is performed over time delayed covariance matrix and the data is projected onto the dominant eigen vectors to obtain spatially whitened and temporally decorrelated data.

**Problem**:

TD2 fails to capture insights obtained from the inherent *anharmonicity* in atomic fluctuations and it’s long tail
behavior.

**Parameters**

```
Y - an mxT spatially whitened matrix (m dimensionality of subspace, T snapshots). May be a numpy array or a matrix where,
m - dimensionality of the subspace we are interested in; Default value is None, in which case m=n
T - number of snapshots of MD trajectory
U - whitening matrix obtained after doing the PCA analysis on m components of real data
lag - lag time in the form of an integer denoting the time steps
verbose - print information on progress. Default is true.
```

**Returns**

```
V - An n x m matrix V (NumPy matrix type) is a separating matrix such that V = Btd2 x U
(U is obtained from SD2 of data matrix and Btd2 is obtained from time-delayed covariance of matrix Y)
Z - B2td2 * Y is spatially whitened and temporally decorrelated (2nd order) source extracted from
the m x T spatially whitened matrix Y.
Dstd2 - has eigen values sorted by increasing variance
PCstd2 - holds the index for m most significant principal components by decreasing variance
R = Dstd2[PCstd2]
R - Eigen values of the time-delayed covariance matrix of Y
Btd2 - Eigen vectors of the time-delayed covariance matrix of Y
```

Note

- Tic is the time delayed covariance matrix computed with time lag = lag. To ensure symmetricity of the covariance
matrix a mathematical computation is made:
*Tic = 0.5 * [Tic + Tic.T]* - Eigen value decomposition of this time delayed symmetrized covariance matrix is performed to obtain eigen vector matrix
- Z is obtained by projecting the trajectory obtained from
*Y*onto the dominant eigen vectors.*Z*is a matrix of spatially whitened and temporally uncorrelated components in the 2nd order