# Anomaly Detection in Elderly Health Monitoring via IoT for Timely Interventions
## 3 Results
### HADA Integrated into the Developed Model
Most values for q (1-10) with rank = 1 and ensureZeroMean = TRUE led to detecting 18 anomalies, suggesting high sensitivity in anomaly detection. This behavior remains stable and consistent in the context of alert generation, and this hyperparameter configuration was subsequently used. Regarding the final model hyperparameters, we chose a dimensionality reduction with a rank set to 6, meaning that the model retained all parameters in the analysis without discrimination. The model reports each parameter as a principal component for describing the data. This choice simplifies the model and helps prevent overfitting, but it could reduce the ability to capture the complex variability of the data. The parameter en-sureZeroMean  
Figure 9: Number of anomalies versus rank for different q values (ensureZeroMean = TRUE). was set to true, ensuring each feature has a mean of 0 before applying PCA. This way, we avoided distortions caused by scale differences between features. Additionally, we used a seed value of 1, ensuring the reproducibility of results to obtain the same results each time the model runs. This validates and enables comparison of the model's performance on similar datasets. The parameter exampleWeightColumnName was set to null, considering all observations were treated equally without applying additional weights. The combination of these hyperparameters makes HADA a model capable of identifying anomalies specific to variations in AR, mR, MR, DST, SST, and S.  
After processing the data, 18 anomalies were identified over the 2-year monitoring period. Of these anomalies, nine were false, meaning they were records that, although flagged as anomalies by HADA, did not represent a major health issue. The other nine anomalies were not major alerts but rather minor physiological changes that were easily explainable, such as the process of eliminating kidney stones. These changes did not require immediate medical intervention, but the user underwent surgery in 2025 to remove them. This suggests that HADA acts as a predictive component, with alerts indicating subtle changes in the monitored patient's condition. Figures 11-13 mark the days HADA generated alerts (highlighted by the red vertical line). Figure 11 presents the evolution of AR, mR, and MR regarding the detected anomalies, providing a clear visualization of the moments when the values of these indicators exceeded normal limits and were flagged as anomalies. Thus, HADA identifies changes by analyzing correlations between these parameters, enabling early detection of potential health issues. This visualization underscores the system's capacity to monitor complex relationships among heart rate metrics, offering actionable insights for prompt medical interventions. Figure 12 depicts the distribution of DST and SST associated with anomalies. This graph shows whether the anomalies were associated with changes in sleep behavior. These parameters are crucial for assessing overall sleep quality, as they reflect different stages of sleep. By monitoring these trends over time, the system can detect irregularities that might not be apparent when analyzing individual parameters alone. The results show that DST and SST exhibit fluctuations throughout the monitoring period, with occasional spikes or drops that trigger anomaly alerts. This underscores the importance of continuous monitoring to capture subtle changes in sleep behavior, which could indicate underlying physiological conditions or stressors affecting the elderly's health. Figure 10: Number of anomalies versus rank for different q values (ensureZeroMean = FALSE). Figure 13 presents the correlation between S and anomaly detection. This graph demonstrates fluctuations in daily physical activity levels, with some days showing significantly higher or lower step counts compared to others. These variations are likely influenced by factors such as routine activities, health conditions, or environmental changes.