Cluster multiple time series using K-means
I have been recently confronted to the issue of finding similarities among time-series and though about using k-means to cluster them. To illustrate the method, I'll be using data from the Penn World Tables, readily available in R (inside the {pwt9} package): First, of all, let's only select the needed columns: The goal here is to cluster the different countries by looking at how similar they are on the avh variable. Let's do some further cleaning. The k-means implementation in R expects a wide data frame (currently my data frame is in the long format) and no missing values. These could potentially be imputed, but I can't be bothered: To convert my data frame from long to wide, I use the fresh pivot_wider() function, instead of the less intuitive spread() function.
Oct-16-2019, 14:34:42 GMT
- Technology: