4
$\begingroup$

This question has been addressed here: Can Principal Component Analysis be used on stock prices / non-stationary data?

In his answer Jon Egil wrote

please make sure you analyse returns not prices

and referenced a paper by Attilio Meucci. In another of Attilio Meucci's papers (which is very nice incidentally), Review of Statistical Arbitrage, Cointegration, and Multivariate Ornstein-Uhlenbeck (2009) Attilio applies PCA to prices (or in this case yields) rather than returns. He even supplies code and data here.

Even just looking at the code you can see he measures the covariance and then applies the PCA directly to this matrix. The results he gets are good, producing the level, slope and curve you would expect.

So it seems that in some cases PCA can be applied successfully to prices.

  1. I'd just like to understand better when it can be applied to prices and what it can't? Is this case was the detrending inherent in the covariance estimation sufficient to produce stationarity?

  2. What are the best tests to apply to whether a particular time-series is suitable for PCA analysis or not?

$\endgroup$
  • 2
    $\begingroup$ PCA can clearly be applied to prices. The PCA itself knows nothing about whether you have stationarity. It's a matter of your research question: if you want to set aside trend, then you must feed approximately stationary data to your PCA. That's nothing to do with PCA requirements and all to do with what you want to analyse. I see no objection in principle to feeding several price series to a PCA; the question is entirely whether that is instructive in practice. $\endgroup$ – Nick Cox Jan 21 '16 at 13:13
2
$\begingroup$

You can't apply PCA directly to price data. However, if you assume that a linear combination of your stocks is co-integrated, than you'll have a process $Y = Xw$ that is stationary.

If $Y$ is (cov)-stationary (let's not require strict stationarity), we can go forward and say that $Cov(Y) = Cov(Xw)$ over which we can apply the principal component factorization. We could not do that without the assumption of co-integration: "A time series is said to be covariance stationary if its mean and variance do not change over time" (ref). This means that we can drop "time" for the equation and generalize our results outside the span of the time-series.

PCA and cointegration go hand in hand: having applied a linear transformation on the data allows us to select the hedge-ratio as the eigenvector corresponding to the biggest eigenvalue.

Going back to your questions: PCA can be applied in case of co-integration.

$\endgroup$
  • 1
    $\begingroup$ This is a little dogmatic. Perhaps you mean that in your view you should not do this because ... Perhaps the OP doesn't have the goals you imply or infer, being interested in hedge ratios, etc. $\endgroup$ – Nick Cox Jan 21 '16 at 13:42
  • $\begingroup$ Added more meat, how that clarifies my view. $\endgroup$ – IcannotFixThis Jan 21 '16 at 13:46
  • $\begingroup$ Very nice answer! $\endgroup$ – Baz Jan 21 '16 at 15:19
  • $\begingroup$ @IcannotFixThis, can you give an example of cointegrated stock prices? $\endgroup$ – Aksakal Jan 30 '16 at 1:32
  • $\begingroup$ Ernie Chan in his book gives a few examples. You can find some implementations on quantopian. I can not comment on whether they're good strategies, though, $\endgroup$ – IcannotFixThis Jan 30 '16 at 13:05
3
$\begingroup$

I don't think you can really apply PCA directly to your data! Actually you can, but you should proceed in the opposite way as you would do for stationary data:

  • For stationary data, you usually focus on the first PCAs (highest eigenvalue), that summarises the most the variance of your data
  • for cointegrated data, you focus actually on the last PCAs (smallest eigenvalue), since the largest one has the highest variance, i.e. is the most non-stationary!

You can verify this easily by looking at the paper of Harris and Snell, who find that PCA can be used to estimating the cointegrating space, by focusing on the smallest eigenvalues:

  • Harris, D. (1997) Principal components analysis of cointegrated time series, Econometric Theory, 13, 529–57.
  • Snell, A. (1999) Testing for r versus r-1 cointegrating vectors, Journal of Econometrics, 88, 151–91.
$\endgroup$
  • $\begingroup$ First PC catches the largest fraction of the variance, but that need not mean most, i.e. more than half. $\endgroup$ – Nick Cox Jan 30 '16 at 2:02
  • $\begingroup$ A tiny addition: the quest for a stationary signal with sufficient variance is also motivated, in trading, buy the need to have sufficient oscillations to let you get in and out with sufficient profits to cover your trading fees and ultimately make money. $\endgroup$ – IcannotFixThis Jan 31 '16 at 10:12
0
$\begingroup$

Yields, and bond prices are usually stationary so it is fine to apply PCA to them, stock prices usually have a time trend component (they grow over time), so they are not stationary.

$\endgroup$

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.