# COVID-19: Worldwide Profiles during the First 250 Days
## 2 Materials and Methods
### Modeling  
#### 2.3.1 Analysis of Temporal Sequences  
To understand the temporal differences between countries at the level of cases and deaths, the version of the package DTAIDistance [23] of the algorithm Dynamic Time Warping (DTW) was applied. DTW is an algorithm aimed to measure the similarity between time series. Due to countries' population differences, cases, and deaths, similarities were measured using the daily values normalized to 100,000 of the population, and over the time synchronized profiles of this scaled and standardized variable. Although hierarchical clustering is a valuable type of algorithm to visualize hierarchical groups in small datasets, it rarely provides good results in larger datasets. Thus, it was decided to use the implementation of the package PyClustering [24] of the K-medoids algorithm for clustering countries based on squares matrices, where both rows and columns were the countries and the values the DTW distances. K-medoids is a variation of the K-means algorithm which instead of defining the clusters' centers arbitrarily does so based on data points. Whereas in K-means the sum of the squared Euclidean distances of the data points is used to define the number of clusters, in K-medoids the sum of dissimilarities of data points is used. As such, K-medoids is better suited to measure the distances between data points, and it is more robust to tackle noise or outliers [14; 25; 26]. The silhouette method was used to identify the number of relevant clusters (k). The silhouette value measures how similar a data point is to its cluster as compared with other clusters. The silhouette value ranges from \(-1\) to \(+1\), where \(+1\) indicates that the data point is well matched to its cluster and \(-1\) indicates the opposite. The average silhouette value, also known as the silhouette score, provides an indication of the cluster validity [27]. In the silhouette score analysis, as depicted in Figure 2, k = 2 presented the best results concerning the clustering of COVID-19 cases time profiles. However, the score for k = 3 was also very close to k = 2. While for k = 2 the two clusters were composed, respectively, by 123 and 65 countries, for k = 3 the three clusters were composed, respectively, by 51, 57, and 80 countries. Based on this observation, it was decided to classify the countries into three clusters in terms of their standardized and synchronized time profiles of COVID-19 cases. \begin{table}
\begin{tabular}{c c c c c c c c} \hline \hline
**Count** & **Mean** &
\begin{tabular}{c} **Standard** \\ **Deviation** \\ \end{tabular} & **Min.** & **25\%** & **50\%** & **75\%** & **Max.** \\ \hline
212 & 262.566 & 34.037 & 19.00 & 255.00 & 261.00 & 270.00 & 335.00 \\ \hline \hline \end{tabular} Note: Count is the number of observations; Mean is the mean of the variable; Standard deviation is the standard deviation of the variable; Min. is the minimum value; 25% is the value of the first quartile; 50% is value of the second quartile or median; 75% is value of the third quartile; and Max. is the maximum value.  
\end{table} 
Table 4: ECCC T Variable Per Country Summary Statistics. The Kruskal-Wallis test was conducted using the module \"stats\" from the package SciPy [28] to examine the difference in total cases by 100,000 of the population per cluster. The results (statistic = 124.695, \(p\) < 0.001) show that the total number of cases mean values differed between the clusters. The post-hoc analysis, conducted with the package scikit-posthoc [29], showed that the total number of cases' mean values also differed per each tuple of clusters.