Temporal vs Spatial PCA


I am playing around with the detection fo spatiotemporal patterns on an ECoG grind and I am wondering if I could use PCA to extract meaningful patterns in the data. For spatial patterns, I would run an eigendecomposition on the spatial covariance matrix and for temporal modes I would create a time covariance matrix. Now, since spatiotemporal patterns (such as travelling waves) are defined as a pattern in space and in time I think my PCA’s result would not adequately describe the patterns. Another issue with PCA in this scenario could be the sign uncertainty of the eigenvectors. I could imagine this would lead to problems estimating the exact direction of e.g. travelling waves.

Maybe anyone has any idea how I could reduce my dimensions to show modes/patterns that describe patterns that exist both in space and in time?

Hi Tim. I don’t think PCA will give you any sensible results in this case. PCA is a compression method, not a pattern-extraction method.

The first thing that comes to mind is dynamic mode decomposition. I don’t have a lot of personal experience with DMD, although I played around with it a bit several years ago. I hope it’s helpful for you!

Hi Mike,

thanks for the suggestion, looks really interesting indeed. I will check it out!


If you test it out – and if you don’t mind – perhaps you can post back here a quick summary of your experience with DMD? It seems like a neat method to me but I don’t really have an opinion of it, so I’d be curious to know about other people’s experiences.

Yes, sure, I can do that!

So, DMD worked out great in my data. I was able to extract exactly the pattern I saw in the ERP. If you know some linear algebra, the method is accessible and can easily be implemented with a few lines of code. However, there is also code available online if you do not feel comfortable writing it yourself.

This website is helpful (there is also a book):

Steve Brunton and Nathan Kutz also explain the method in more detail on youtube. See Steves video (Dynamic Mode Decomposition (Overview) - YouTube ) for a short introduction and Nathan’s for a bit more math (Dynamic Mode Decomposition (Theory) - YouTube).

If you are interested in Neuroscience you should check out this paper:

There are some important things to consider when using DMD on neuro data such as ECoG grids instead of fluid motion. We often have much less channels than time points, which means that the SVD might give us too few modes to adequately describe the data. That is why you should create an augmented matrix by shifting and concatenating the data. See section 2.2 in the Bruton (2016) paper for more details on this!

The paper also suggests using the lower rank data structure as inputs to clustering algorithms. Sounds super cool, but I did not try that out yet.

Hope this helps and thanks again for the suggestion!


Nice, good to hear, and I’m glad it worked out well for your data.