# What is PCA doing with autocorrelated data?

Just because some correspondent posed an interesting question concerning methods of computation of autocorrelation, I began to play with it, nearly without any knowledge about time series and autocorrelation.

The correspondent arranged his data ($32$ data points of a time series) shifted by one time lag each besides so that he had a matrix of $32\times32$ data (as I understood him) where the first row are the original data, the second row the data shifted by $1$ time unit, the next row by another one and so on. I realized this additionally by glueing the end to the tail, so making "circular" datasets.

Then, just for looking what might come out of it, I computed the correlation matrix and from this the principal components. Surprisingly I got the image of a frequency-decomposition, and (again with other data) one frequency, say that with one period in the $32$ data was in the first principal component, and that with four periods was in the second PC and so on (I got $6$ "relevant" PC's with eigenvalue $>1$). First I thought this depends on the input data, but now I assume it is systematically this way by the special construction of the data set with its circular shifts (also known as "Toeplitz" matrix). Rotations of the PC-solution to varimax or other rotation-criteria gave slightly different, and possibly interesting, results, but in general seem to provide such a frequency-decomposition.

Here is a link to pictures which I've made from the $32$-point data set; the curves are simply made from the loadings of the factormatrix: one curve the loadings on one factor. The curve of the first PC1 should show the highest amplitudes (roughly because it bears the highest sum of loadingssquares)

Questions:

• Q1: Is this a feature by design? (of PCA with this type of dataset)
• Q2: Is this approach indeed somehow usable for a serious approach to frequency-/wavelength analysis?

[update] here is the dataset (hope it shall come out being copyable for you)

-5,-3,-1,0,2,4,6,5,3,1,1,0,-2,-3,-1,0,3,5,7,6,7,5,4,3,2,3,5,4,3,2,3,4
-3,-1,0,2,4,6,5,3,1,1,0,-2,-3,-1,0,3,5,7,6,7,5,4,3,2,3,5,4,3,2,3,4,-5
-1,0,2,4,6,5,3,1,1,0,-2,-3,-1,0,3,5,7,6,7,5,4,3,2,3,5,4,3,2,3,4,-5,-3
0,2,4,6,5,3,1,1,0,-2,-3,-1,0,3,5,7,6,7,5,4,3,2,3,5,4,3,2,3,4,-5,-3,-1
2,4,6,5,3,1,1,0,-2,-3,-1,0,3,5,7,6,7,5,4,3,2,3,5,4,3,2,3,4,-5,-3,-1,0
4,6,5,3,1,1,0,-2,-3,-1,0,3,5,7,6,7,5,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,5,4,3,2,3,4,-5,-3,-1,0,2,4,6,5,3,1,1,0,-2,-3,-1,0,3,5,7,6
5,4,3,2,3,5,4,3,2,3,4,-5,-3,-1,0,2,4,6,5,3,1,1,0,-2,-3,-1,0,3,5,7,6,7
4,3,2,3,5,4,3,2,3,4,-5,-3,-1,0,2,4,6,5,3,1,1,0,-2,-3,-1,0,3,5,7,6,7,5
3,2,3,5,4,3,2,3,4,-5,-3,-1,0,2,4,6,5,3,1,1,0,-2,-3,-1,0,3,5,7,6,7,5,4
2,3,5,4,3,2,3,4,-5,-3,-1,0,2,4,6,5,3,1,1,0,-2,-3,-1,0,3,5,7,6,7,5,4,3
3,5,4,3,2,3,4,-5,-3,-1,0,2,4,6,5,3,1,1,0,-2,-3,-1,0,3,5,7,6,7,5,4,3,2
5,4,3,2,3,4,-5,-3,-1,0,2,4,6,5,3,1,1,0,-2,-3,-1,0,3,5,7,6,7,5,4,3,2,3
4,3,2,3,4,-5,-3,-1,0,2,4,6,5,3,1,1,0,-2,-3,-1,0,3,5,7,6,7,5,4,3,2,3,5
3,2,3,4,-5,-3,-1,0,2,4,6,5,3,1,1,0,-2,-3,-1,0,3,5,7,6,7,5,4,3,2,3,5,4
2,3,4,-5,-3,-1,0,2,4,6,5,3,1,1,0,-2,-3,-1,0,3,5,7,6,7,5,4,3,2,3,5,4,3
3,4,-5,-3,-1,0,2,4,6,5,3,1,1,0,-2,-3,-1,0,3,5,7,6,7,5,4,3,2,3,5,4,3,2
4,-5,-3,-1,0,2,4,6,5,3,1,1,0,-2,-3,-1,0,3,5,7,6,7,5,4,3,2,3,5,4,3,2,3

• Thanks @amoeba and for the lot of editing. I'd only seen two errors which I wanted to edit later, the question looks much nicer now! Nov 11, 2014 at 16:44

Do you imagine rows in your data matrix to be the variables or the samples? I will assume they are samples: i.e. you have $n=32$ different time series (samples).
Then, if all $n=32$ rows are identical, but only circularly shifted by $1$ position each, then the $n\times n$ Gram matrix of your data consisting of dot products between all pairs of rows will have Toeplitz structure: high values close to the diagonal and gradually decreasing to zero values away from it. Toeplitz matrices have consecutive Fourier modes as their eigenvectors (and eigenvectors of the Gram matrix are principal components, up to the scaling), so yes to your Q1: it is no surprise that you get sinusoidal waves of increasing frequencies as PCs.