# Clustering time series based on correlation

I want to cluster a set of time series regarding their pairwise correlation. If I normalize the series by subtracting their average value and then scaling to a standard deviation of one, the correlation coefficient (Pearson's r value) between original series is the same as the dot product of the normalized counterparts.

Which clustering algorithms would be apropriate in this situation ?

-
 Be careful. It makes no sense to do this unless the time series are all stationary. See the work of Eamonn Keogh for some cautionary tales. – Rob Hyndman May 15 '12 at 11:10

## 2 Answers

Choose any distance based clustering algorithm.

Have a look at ELKI. First of all they have probably the largest choice in clustering algorithms, plus you can plug in arbitrary distance functions easily. They also have Pearson correlation distance along with various specialized time series distances.

Depending on your domain knowledge, DBSCAN could be a good choice. If you can define a reasonable threshold and minimum cluster size.

-

I don't know about appropriate, but we have had good results by submitting such data to the network-based clustering method MCL. We (van Dongen and Abreu-Goodger) have written up an elaborate example in PMID 22144159 (using MCL to extract clusters from networks), on E coli expression data across 466 different conditions. In other work we have also applied MCL to time-series data. An important step in this approach is to quantitate the network as it is submitted to edge thresholds of increasing severity, then to choose an appropriate threshold (based on network density, number of singletons, et cetera), transform the network, and finally cluster it. From the book chapter mentioned above, it would look something like this (with some cutoffs made more stringent):

mcxarray -data ecoli.exprs -co 0.5 -skipr 1 -skipc 1 -tf 'abs()' -o ecoli.mci -write-tab ecoli.dict
mcx query -imx ecoli.mci --vary-correlation    # consider attributes that are output.
mcx alter -imx ecoli.mci -tf 'gq(0.8),add(-0.8)' -o ecoli80.mci
mcl ecoli80.mci -use-tab ecoli.dict            # try different granularities.
mcl ecoli80.mci -use-tab ecoli.dict -I 1.4
mcl ecoli80.mci -use-tab ecoli.dict -I 3

-