title: Clustering Time Series in R - is K Mean accurate?
body: <p>My data set is composed by measurement of the same index for 14 years (columns) for 105 countries (rows). I want to cluster countries based on their index trend over time. </p>
  
  <p>I am trying Hierarchical clustering (<code>hclust</code>) and K Medoids (<code>pam</code>) exploiting DTW distance matrix (<code>dtw</code> package). </p>
  
  <p>I also tried K Mean, using the DTW distance matrix as first argument of function <code>kmeans</code>. The algorithm works, but I'm not sure about the accuracy of that, since K Mean exploit Eucledian Distance and computes centroids as means. </p>
  
  <p>I am also thinking  about using data directly, but I can't understand how the result would be accurate since the algorithm would consider different measurement of the same variable over time as different variables in order to compute the centroids at each iteration and Eucledian distance to assign observations to clusters. It doesn't seem to me that this process could cluster time series as well as Hierarchical and K Medoids clustering. </p>
  
  <p>Is K Mean algorithm a good choice when clustering Time Series or it is better to use algorithms that exploit distance concept as DTW (but are slower)? Does it exist an R function that allows to use K Mean algorithm with distance matrix or a specific package to cluster Time Series data? </p>