I'm doing a project related to identifying sales dynamics. My database contains 26 weeks after launching the product (so 26 time-series observations equally spaced in time).



I used two methods of time-series clustering to see which patterns dominate in different groups (clustering by units_sold_that_week). The first method is based on k-medoids and the second one connected with clustering by parameters of growth models.

My next step is to make forecasts based on these clusters. Is there any special method for forecasting based on time-series clusters? In my project, I have to combine the topic of clustering and forecasting on clusters.

I am running my analyses in R, so I would be grateful for any suggestions regarding R procedures.

Please note that I am relatively new to time series analysis so any clarity you could provide, on R or any package you could recommend that would help accomplish this task efficiently, would be appreciated.

  • 1
    $\begingroup$ As @GiorgioSpedicato suggests, dynamic time warping (DTW) is the way to go. There is a very nice example in the link suggested by Giorgio Spedicato that clearly explains how to cluster time series, then you could apply any forecasting method in R forecast Package. It looks like you are using weekly data, you could use stlf function in R forecast package which handles high frequency time series. $\endgroup$ – forecaster Apr 1 '14 at 22:21
  • $\begingroup$ Try for PSF (researchgate.net/publication/…). The R package is available CRAN named as PSF. $\endgroup$ – Neeraj Dhanraj Jul 8 '16 at 18:38

So there are series of R package for doing similar thing; but in a different context. The examples are from gene expression data, where they have expression measurement in a course of time series. You just to look into their example, make your data look like them and run the analysis.

Some of the method use Dirichlet Processing mixture model like this and some others are extended version of conventional clustering methods like this one. Mfuzz is another R package and also this one

I hope it helps you

  • $\begingroup$ I was trying to use kml, but an error occured. Can you help me what 'contains trajectories to cluster' means which is the first variable of procedure kml() ? I want to cluster variable units_sold by time, so i tried with t(units_sold) but it do not work $\endgroup$ – peterpeter Apr 6 '14 at 5:04

Times ago I went to this website Rdatamining that suggested dynamic time warping for time series classification. Basically, it uses dynamic time warping to evaluate a distance between time series and to cluster them based on that distance. Within cluster you might have a look to hierarchical time series clustering as proposed in the hts R package (for the theory have a look to Roby Hyndman Forecast Book Chapter).


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.