# Can clique analysis tell us something new about time series?

It used to be that when you looked at a time series, the first question to ask was “what does this look like in the frequency domain?” Fourier transforms were quick and cheap and it never hurt to take a look.

One of the tools in the 1QBit Quantum-Ready Development Kit is an algorithm for finding cliques in graphs. This may be used to look at correlations between multiple time series, such as one might find in price data from a stock market. The stocks are the nodes, and the cross-correlation factors are the weights on the edges. Cliques represent sets of stocks with similar variations in time.

However, we can also use a tool like this to look at correlations between different parts of the same time series. Like the Fourier Transform, it sometimes tells us something. It’s quick and cheap so why not take a look?

Take oil, for example. Here is a plot of daily crude oil spot prices from January 1995 to December 2015. The data is from the U.S. Energy Information Administration

Here is what happens if we take the daily data in groups of 5 weeks (i.e. by month), and then calculate a normalized month-to-month autocorrelation matrix. The red indicates high correlation and the blue low. The normalization removes the average price level for the month, so that the correlation is between how the prices move over the month.

The red line along the diagonal indicates that each month is perfectly correlated with itself. Beyond that you might expect to see noise, but there’s actually something of a pattern.

There are clearly months that are unlike all other months, as evidenced by the light blue horizontal and vertical lines. Going by their frequency alone, they represent some kind of yearly effect.

The question is: what happens when we apply clique analysis to the graph defined by the correlation matrix? Can it reveal a structure that the correlation matrix hints might be there?

With a hope no one would consider this impolite and/or harmfull, let me cite a lovely point of view on the underlying assumption from **“Correlation** does **not** imply **Causation**“: that many contemporary Quantitative Finance -modellers neglect or abstract from:

## For any two correlated events, A and B, the following relationships are possible:

- A causes B; (direct causation)
- B causes A; (reverse causation)
- A and B are consequences of a
**common cause**, but do not cause each other; - A causes B and B causes A (bidirectional or cyclic causation);
- A causes C which causes B (indirect causation);
- There is no connection between A and B; the correlation is a coincidence.

**Thus there can be no conclusion made** regarding the ** existence** or the

**of a**

*direction***cause-and-effect relationship**only from the fact that

**A and B are correlated**.

- Although correlation does not imply causation, causation does imply correlation. That is, although a correlational study cannot definitely prove a causal hypothesis, it may rule one out.
- Once correlation is known it can be used to make predictions. When we know a score on one measure we can make a more accurate prediction of another measure that is highly related to it. The stronger the relationship between/among variables the more accurate the prediction.
- …and more

Stanovich, K. (2007). *How to Think Straight About Psychology*. Boston, MA: Pearson.

– JasOberoi

For instance, suppose you find that living in a certain city is correlated with early death. You can’t conclude that living in that city *causes* early death, nor that getting people to move out of that city would help them live longer. (Maybe the city is attractive to sickly people, for some reason.) But if you are an actuary, you would be perfectly justified in wanting to charge higher life insurance premiums to members of that city – knowing about this correlation could be very valuable to you.

An example I read somewhere, and makes perfect sense to me..

-JasOberoi