I have a collection of time series data. The data is structured (Country, Year, Value).

~50 countries and ~30 data points for each country

Is there a way to cluster time series? Time intervals are uniform and measuring the same output across different countries (0 < value < 1).

Plotting the values at a glance, it looks like there are two obvious groups of countries.

I have seen people mention fitting an ARIMA or a polynomial regression model to the data. And then compare the co-efficients to cluster them. (chow test). But i have also read that the chow test, tests for the presence of a structural break at a period. Is this a sound approach?

I am only interested in grouping by countries that have the most similar time series (what measure of similarity?) together into 2-4 clusters.

example subset plotted

Also I should have noted that the number of data points for each series can vary.

  • $\begingroup$ 30 time points is not very many for a time series. Perhaps you can post a plot, and show why you think there are 2 clusters, like what feature of the plot seems to distinguish one group of countries from another? $\endgroup$ – ken Oct 16 '18 at 7:33
  • $\begingroup$ "Also I should have noted that the number of data points for each series can vary." For those, it might be difficult to include in the analysis. It simply might not be enough observations to capture the time points where other data exhibit salient features, like maxima at year 2000. As for the other data, it seems like there is not much noise, so a polynomial fit might work well, and maybe you can try clustering on the coefficients? But given only 50 countries (and some w/ too short an observation), this again might not be enough to give nice results... Worth a try though. $\endgroup$ – ken Oct 16 '18 at 7:36

Besides statistical methods such as ARIMA, you can use Dynamic Time Wrapping method such as below. To know more see this link:

int DTWDistance(s: array [1..n], t: array [1..m]) {
    DTW := array [0..n, 0..m]

    for i := 1 to n
        DTW[i, 0] := infinity
    for i := 1 to m
        DTW[0, i] := infinity
    DTW[0, 0] := 0

    for i := 1 to n
        for j := 1 to m
            cost := d(s[i], t[j])
            DTW[i, j] := cost + minimum(DTW[i-1, j  ],    // insertion
            DTW[i  , j-1],    // deletion
            DTW[i-1, j-1])    // match

    return DTW[n, m]
| cite | improve this answer | |

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.