# Forecast of Medical Costs in Health Companies Using Models Based on Advanced Analytics
## 4 Results
### Clustering
#### 4.2.5 Distribution by Cluster of Continuous Contributed Weeks  
This shows the number of weeks that the users have been affiliated since their first date of affiliation, as shown in Figure 11. It can be noticed that cluster 8 aggregates old healthy users that have been affiliated for a prolonged period. The model was evaluated with 4 and 16 memory cells, showing the reliability when first segmented by cluster, for all clusters except for clusters 1 and 3, where with 16, its results are better. As shown in the Table 9, it is preferable to use 4 memory cells. After defining the clusters, and according to the cluster selection, we predicted the cost again using LSTM networks; this feature allows you to choose which cluster and over what period to project it. In this case, we chose cluster 3, resulting in the following projection as seen in Figure 12.  
Figure 11: Distribution by cluster of continuous contributed weeks. Figure 10: Distribution by cluster of weeks contributed since last year. Figure 9: Distribution by cluster of last consultation time (Recency). As such, patients were better modeled and performance was slightly increased, instead of working with the optimal values in performance provided by the elbow and silhouette methods (see Tables 9 and A1 for details of the performance of both approaches). It is also important to note that the allowance of 15 clusters, instead of 5, has also helped to identify two clusters of inactive patients (6) and 'Young and Healthy with Little Use' patients (cluster 11) whose predictability is not reliable (R2 < 0) and could be biasing the models when using only five clusters. We reviewed previous cost prediction model studies, namely a standard short-term memory model (LSTM) and a stacked LSTM model, to predict the monthly drug cost of more than 50,000 patients between 2011 and 2015. For the single-layer LSTM model, they obtained an RMSE value of 14.617 and an R2 value of 0.8048. For the stacked LSTM model, the RMSE value was 13.693 and an R2 value of 0.8159 [12]. Another works predicted the average weekly expenditure of patients on certain pain medications, with different models such as Arima, MLP, and LSTM selecting two medications among the 10 most prescribed pain medications in the US; the LSTM result yielded an RMSE value for medicine A of 143,69 and an R2 value of 0.77 [22]. Below are the metrics we adopted for each model. These are: root mean square error (RMSE) [43; 44]; mean absolute percentage error (MAPE) [45]; R2; and adjusted R2 [46]. The most common metric used for regression purposes is the root mean square error (RMSE) and it represents the square root of the average distance between the actual value and the predicted value. This indicates the absolute adjustment of the model to the data; how close are the observed data points to the model's predicted values. The RMSE measurement is an absolute mean of adjustment. As the square root of a variance, the RMSE can be interpreted  
Figure 12: Cluster 3 medical cost projection. \begin{table}
\begin{tabular}{c c c c c} \hline \hline
**Cluster** & **Description** & **Number** & **RMSE (4)** & **RMSE (16)** \\ \hline
0 & HighAge, COPD-AHT & 43.403 & 58,69 & 61,71 \\
1 & YoungAdult, HEALTHY & 380.158 & 601,59 & 623,36 \\
2 & Adult, AHT-OBESTITY & 122.125 & 83,70 & 105,02 \\
3 & SeniorAdult, AHT & 123.463 & 34,14 & 27,02 \\
4 & Adult, OBESITY & 205.765 & 97,57 & 206,74 \\
5 & SeniorAdult, AHT-DIABETES-OBESITY & 71.647 & 129,95 & 211,48 \\
6 & Inactive & 154.907 & 274,06 & 418,10 \\
7 & SeniorAdult OBESITY-AHT & 64.867 & 31,27 & 107,55 \\
8 & SeniorAdult, HEALTHY & 71.372 & 89,20 & 98,81 \\
9 & SeniorAdult, CANCER-AHT & 36.429 & 29,17 & 52,67 \\
10 & HighAge, CKD-AHT & 51.153 & 85,02 & 114,07 \\
11 & Young, HEALTHY, LittleUse & 411.973 & 463,20 & 445,10 \\
12 & Adult, CANCER & 37.006 & 51,94 & 69,43 \\
13 & HighAge, COPD-AHT-OBESITY & 33.504 & 15,15 & 25,98 \\
14 & Young, HEALTHY, RecentUse & 11.3965 & 122,09 & 167,99 \\ \hline \hline \end{tabular}
\end{table} 
Table 9: Result for clusters with different RSMEs.