Skip to content
All library documents

PCA on Log Returns and the Assumptions Behind Projecting Log Prices

Article Quant Q&A · Author: pavybez

Summary

The document examines a workflow that estimates a covariance matrix from stock log returns, extracts principal components, and then projects log prices onto those components. Its central concern is that price levels are nonstationary, so the covariance structure and the resulting PCA require explicit assumptions. The answer distinguishes strong stationarity, where the distribution is stable, from weak stationarity, where means and covariances remain stable.

One proposed relaxation is to assume that the components retained by PCA and each stock’s exposures to them remain stable. Under that assumption, the construction becomes a factor model for returns, with residual terms that need not themselves be stationary. The answer says factor identification requires the residual variance to be much smaller than the factor-driven variation. It frames the choice as a modeling decision and advises checking whether estimated parameters fit the initial assumptions. It supplies no empirical comparison or validation results, and the suitability of the PCA projection depends on whether those stability assumptions hold.

Key ideas

  • PCA based on return covariance relies on assumptions about the stability of the return distribution or covariance structure.
  • Weak stationarity requires stable means and covariances, while strong stationarity requires a stable distribution.
  • Stable principal components and stable stock exposures can be treated as a factor-model assumption.
  • Factor interpretation is harder when residual variation is large relative to the factor-driven variation.
  • Estimated parameters should be checked against the assumptions used to justify the model.

Tags

Full text
# principal component analysis on non stationary data


# principal component analysis on non stationary data












I read that since stock prices are non-stationary it does not make sense to take their covariance. So I took the log returns of stocks, computed covariance matrix, took the top few eigen vectors that explain maximum variance and instead of projecting the returns I projected the log prices on these vectors. Is there anything wrong with this approach? python code below:

> logprices = numpy.log(prices) logreturns = numpy.diff(logprices, axis=0) cov = EmpiricalCovariance().fit(logreturns).covariance_ eigenvalues, eigenvectors = numpy.linalg.eigh(cov) components = eigenvectors[:, :5] # top 5 eigen vectors sources = numpy.dot(logprices, components)

## Answer by lehalle (score 1, accepted)

https://quant.stackexchange.com/a/35479

You may know that they are two definitions of stationary (see for instance Series of Irregular Observations: Forecasting and Model Building; this book probably contains all you need to model timeseries, and it is now new):

- strongly stationary means each time you have an observation (for you an observation is a vector of returns of dimension you number of stocks) it is drawn from the same distribution;

- weakly stationary means each time how have an observation, it is drawn from a distribution that has the same expectation (i.e. mean) and variance (i.e. here covariance matrix).

If you believe mixing your observation to obtain a covariance matrix and make his PCA, what would you need ?

- a first answer is you need your observations to be weakly stationary to be able to even speak about their covariance matrix, no?

- but you can relax it and say you only need the eigenvectors and eigenvalues you will keep to be strongly stationary. You will need the betas of the stocks with respects to these components to be "stable", say constant.

The second option is another model, it is in fact a factor model. It states the returns $R_k$ of the $k$th stock is equal to

$$R_k = \beta_k F_k + \epsilon_k,$$

where $\epsilon_k$ is no more stationary... You will for sure need its variance to be far lower than the one of $\beta_k F_k$ to be able to identify the factors.

As usual in statistics, all is matter of model choice. You need to be aware of your choices, use estimators that are compatible with them (imagine for instance your random vector of $\epsilon_k$ is somehow "synchronized" to drive $R_k$ towards highly negative values during months, and then switches them to positive values... you will need an ad hoc estimator). And at the end of the process, you will need to check all the parameters you obtain are compatible with your initial hypothesis.

Shown in full with attribution under the source's licence. Licence: CC BY-SA 4.0 (Stack Exchange)

This summary was written by Stratmill's research agent from the original; it is not a copy of the source.