# Pattern Recognition in Older Adults' Activities of Daily Living
## 3 Materials and Methods
### Pattern Recognition
Therefore, the algorithm ranges from the first date in the structure to the last, and every five minutes of every day, it seeks to see if there is information from beacons that can be read. If so, it increases the beacon's probability field where the RSSI value is higher; i.e., the algorithm will look for all the beacon information that the smartwatch reads and acquire the information in which the RSSI value is higher. This means that the respective person was closer to that beacon than others at that moment, increasing the probability value of that moment (which corresponds to the hour of minutes). If no data are received from any beacon at a given moment, the smartwatch cannot detect any associated BLE beacons. Possible reasons include sensor disconnection or the person being outside the home. To address this, a new location named \"None \(|\) Outside\" is introduced to account for these occurrences and distinguish them from other events. Therefore, these data must be divided by the days the pattern is studied. This is because, for example, if we have twelve days of data, and at 1 am we have the average room value of 11.4, this indicates that each average day compared to twelve days is very close to 100%. With this, the algorithm has to divide this value by the total number of days so that it has the probability of 0 to 1 that the older adult is inside a room at 1 am. This division is made for all data so that it has consistency in the data and can be worked on. Thus, everything is prepared to determine the probability of a person being in a \begin{table}
\begin{tabular}{c c c} \hline \hline \multicolumn{3}{c}{**Strings Equivalence**} \\ \hline
**String 1** & **String 2** & **Result (\%)** \\ \hline Toilet 1 & Toilet 2 & 87.5 \\ Living room 1 & Living room 2 & 92.3 \\ Bedroom 1 & Bedroom 2 & 88.8 \\ Kitchen 1 & Kitchen 2 & 88.9 \\ Bathroom 1 & Bathroom 2 & 90.0 \\ \hline \hline \end{tabular}
\end{table} 
Table 2: Equivalence percentage between two strings. compartment (\(c_{i}\)) at a time (\(t_{j}\)) (given by \(Prob(c_{i},t_{j})\)). Briefly, the algorithm will travel each hour and every five minutes and calculates the probability through the average and the number of days, the standard deviation, and the 25 th and 75 th percentiles to have data to analyze the data. Finally, the algorithm writes what is in the structure for the pattern file, organized in ascending hours, and the probability of each compartment in descending order, visible in Figure 8. A complete list of the functions defined in Algorithm 1 is presented in Appendix A. ### Outlier Detection

The Interquartile Range (IQR) rule [19] and the Z-score method [20] emerged as the most suitable techniques for this study. These methods offer robust statistical insights into data deviations from the norm. It is important to note that each technique may require specific adaptations depending on the context in which it is applied. Furthermore, it is worth mentioning that both methods are recommended for data conforming to a normal distribution. For the outlier detection process, several works have been carried out [21; 22; 23]. A formula incorporating the Interquartile Range (IQR) with a constant value of 2.2 is suggested to be used as the optimal value. Consequently, the upper and lower limits of the IQR are given by Equations (1) and (2)

\[Upper=Q3+(2.2*(Q3-Q1)) \tag{1}\]

\[Lower=Q1-(2.2*(Q3-Q1)) \tag{2}\]

where \(Upper\) and \(Lower\) represent the upper and lower limits of the IQR, and \(Q1\), \(Q2\), and \(Q3\) represent the first, second, and third quartiles, respectively. Based on these two formulas, if a specific value is lower than the result of Equation (2) or if it is higher than the result of Equation (1), then it means that this value is an outlier. The Z-score method is widely used in many other statistics-related operations [24; 25]. By default, any Z-score of 3 or more is considered an outlier since it falls outside the range of approximately 99.7% of the data. The Z-score is given by Equation (3).