Quantopian's community platform is shutting down. Please read this post for more information and download your code.
Back to Community
An experiment with independent component analysis

After reading this paper I thought I will give independent component analysis a try instead of PCA. The residuals are mean reverting even 30 days out of sample. Probably a strategy can be developed around this.

5 responses

On a side note, I learnt how to calibrate an ornstein uhlenbeck (OU) process on the residuals. However my current strategy is to go long/short if the s score computed from OU process is above a threshold. I am thinking there should be a way to tell if the process has not only crossed the threshold but is also reverting back to zero. Does anyone have experience with this?

Hi Pravin,

Would you be willing to provide a gentle layman's terms tutorial on what you are doing here? Your notebook looks remarkably simple, but I gather that there are some important mathematical details behind the scenes. Can you share some of the intuition?

Grant

Hi Grant,

The idea is based on arbitrage pricing theory. Basically we believe that there are some hidden underlying factors that drive stock prices. How do we identify these factors? There are several ways but PCA or ICA can be used. Both decompose the returns on stocks and identify the underlying sources that drive the stock returns. In both cases, return on each stock is a linear combination of the returns on the "sources". These sources are purely mathematical constructs and might or might not have an economic meaning.

Once the sources are identified and we find out their linear combination that make up each stock's returns we can trade that. For example if there are only 2 sources S1 and S2 and 1 stock X. Lets say return on X is given by

X = 0.3 x S1 + 0.7 x S2

Whenever X violates this combination we trade it and hope it reverts to the mean. To trade it we long/short the stock X and hedge it by "source".

See the tutorial on youtube: https://www.youtube.com/watch?v=2WY7wCghSVI

Thanks Pravin,

At least I now have a starting point. How did you come up with the list of securities in the notebook you posted above?

Grant

From community. I think SPY100 or something.