I understand that Principal Component Analysis (PCA) can be applied basically for cross sectional data. Can PCA be used for time series data effectively by specifying year as time series variable and running PCA normally? I have found that dynamic PCA works for panel data and the coding in Stata is designed for panel data and not time series. Is there any specific type of PCA which works on time series data?

Update. Let me explain in detail.

I am presently constructing an index for Infrastructure in India with variables like road length, rail route length, electricity generation capacity, number of telephone subscribers etc. I have 12 variables through 22 years for 1 country. Though I have reviewed papers that apply PCA on time series and even panel data, PCA is designed for cross sectional data which assumes i.i.d assumption. Panel and cross sectional data violates it and PCA does not take into account the time series dimension in it. I have seen dynamic PCA being applied only on panel data. I want to know if there is a specific PCA that is applied on time series or running static PCA with year defined as time series variable will do the job?

  • 2
    $\begingroup$ Singular Spectrum Analysis (SSA) is often called PCA for time series. en.wikipedia.org/wiki/Singular_spectrum_analysis $\endgroup$ – Vladislavs Dovgalecs Jun 23 '15 at 15:30
  • 1
    $\begingroup$ Please review some of the posts in the sidebar to the right (-->) that refer to both PCA and time series. If any answer your question, please link to it in comments here, but if none do, you might explain the specific ways in which your issue differs from any of those. $\endgroup$ – Glen_b -Reinstate Monica Jun 24 '15 at 5:27
  • $\begingroup$ None of them answers the question of pca on time series. Specific queries on the topic either relates to science or are left unanswered. $\endgroup$ – Nisha Simon Jun 24 '15 at 7:13
  • 3
    $\begingroup$ PCA, as a data transformation, dimensionality reduction, exploration, and visualization tool, does not make any assumptions. You can run it on any data whatsoever, including time series data. In fact, PCA is very often applied for time series data (sometimes it is called "functional PCA", sometimes not). I don't even know what "dynamic PCA" and "static PCA" should mean; don't worry and use standard PCA. $\endgroup$ – amoeba says Reinstate Monica Jun 28 '15 at 13:11
  • $\begingroup$ You may wanna consider using Functional PCA which is particularly designed for time series. The FDA package in R implemented fPCA. You will be able to find the multivariate fPCA. $\endgroup$ – Anne Jul 7 '18 at 23:47

One approach could be to take the first time differences of your 12 variables to ensure stationarity. Then calculate the $12\times12$ covariance matrix and perform PCA on it. This will be some sort of average PCA over the whole time span, and will not say anything about how the different timelags affect each other. But it could be a good starting point.

If you are interested in decomposing the time domain as well I would check out SSA as suggested in the comments.

When you series are (assumed) stationary a single covariance matrix is meaningful. If your data is integrated of an order of 1 or higher, as I suspect they might be, the estimation of a single covariance matrix will not yield consistent results. A random walk is for example integrated of order 1, and the estimated covariance of two random walks does not say anything about their co-movement, here co-integration analysis is required.

As suggested in the comments PCA in itself doesn't care about stationarity so you can feed PCA any positive semi-definite matrix and the PC decomposition will be fine in a PCA-sense.

But if your estimated covariance matrix does not represent anything meaningful about the data, then PCA will, of course, not either.

  • 1
    $\begingroup$ +1. What do you mean by "the first time differences"? $\endgroup$ – amoeba says Reinstate Monica Jun 28 '15 at 14:14
  • $\begingroup$ I mean the first difference, so for each of the twelve x's I would do x_t - x_t-1. $\endgroup$ – Duffau Jun 28 '15 at 14:22
  • $\begingroup$ So you suggest to do PCA on time derivatives of each time series, as opposed to time series themselves. That's interesting; why would this be your first suggestion? $\endgroup$ – amoeba says Reinstate Monica Jun 28 '15 at 14:45
  • $\begingroup$ For two reasons: 1) For covariance estimation to be consistent, the normal cross sectional assumptions is for the two random variables to be independent and identically distributed (iid). This ensures the convergence of the sample mean to expected value, the so called Law of large numbers (LLN). In time series analysis the assumption of two stochastic processes being iid is to restrictive. So it is replaced with the notion of stationarity (of many different kinds). For the LLN to hold and covariance estimation to be consistent the two series need to have a jointly stationary distribution. $\endgroup$ – Duffau Jun 28 '15 at 21:54
  • $\begingroup$ If each stochastic process is staionary then (I'm allmost positive that) they have are jointly stationary, hence covariance estimation makes sense. First differences is a standard technique in econometrics to make time series "more stationary". And from here estimation and PCA is straight forward. So in short, because it is easy :-) .... ok there was no second reason.. $\endgroup$ – Duffau Jun 28 '15 at 22:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.