Quantification Analysis of Sleep Based on Smartwatch Sensors for Parkinson’s Disease

Rapid eye movement (REM) sleep behavior disorder (RBD) is associated with Parkinson’s disease (PD). In this study, a smartwatch-based sensor is utilized as a convenient tool to detect the abnormal RBD phenomenon in PD patients. Instead, a questionnaire with sleep quality assessment and sleep physiological indices, such as sleep stage, activity level, and heart rate, were measured in the smartwatch sensors. Therefore, this device can record comprehensive sleep physiological data, offering several advantages such as ubiquity, long-term monitoring, and wearable convenience. In addition, it can provide the clinical doctor with sufficient information on the patient’s sleeping patterns with individualized treatment. In this study, a three-stage sleep staging method (i.e., comprising sleep/awake detection, sleep-stage detection, and REM-stage detection) based on an accelerometer and heart-rate data is implemented using machine learning (ML) techniques. The ML-based algorithms used here for sleep/awake detection, sleep-stage detection, and REM-stage detection were a Cole–Kripke algorithm, a stepwise clustering algorithm, and a k-means clustering algorithm with predefined criteria, respectively. The sleep staging method was validated in a clinical trial. The results showed a statistically significant difference in the percentage of abnormal REM between the control group (1.6 ± 1.3; n = 18) and the PD group (3.8 ± 5.0; n = 20) (p = 0.04). The percentage of deep sleep stage in our results presented a significant difference between the control group (38.1 ± 24.3; n = 18) and PD group (22.0 ± 15.0, n = 20) (p = 0.011) as well. Further, our results suggested that the smartwatch-based sensor was able to detect the difference of an abnormal REM percentage in the control group (1.6 ± 1.3; n = 18), PD patient with clonazepam (2.0 ± 1.7; n = 10), and without clonazepam (5.7 ± 7.1; n = 10) (p = 0.007). Our results confirmed the effectiveness of our sensor in investigating the sleep stage in PD patients. The sensor also successfully determined the effect of clonazepam on reducing abnormal REM in PD patients. In conclusion, our smartwatch sensor is a convenient and effective tool for sleep quantification analysis in PD patients.

continuously measure and record sleep using several machine learning (ML) and deep learning algorithms such as decision trees, logistic regression, linear support vector machine, convolutional neural network, long short-term memory, and perceptron [14,29,35].
In this study, we aimed to design a quantification method as an objective assessment for REM disorder and RBD evaluation in PD patients at home. We developed an algorithm for sleep-stage classification to identify the collected physiological data including the Gsensor and heart rate from the smartwatch. The algorithm could distinguish awake, light sleep, deep sleep, and REM sleep. Based on the k-means clustering algorithm, the heart rate data and G-values were used individually to differentiate subject-specific variation [36]. Importantly, the objective assessment for REM disorder was presented as an index with a statistical difference, which could be implemented in smartwatch sensors as a convenient and effective tool for sleep quantification analysis in PD patients. Figure 1 shows the intelligent wearable device proposed in this study for the objective assessment of sleep in PD patients. The proposed platform combines a wearable device with an analysis software to analyze the physiological data associated with the disease and automatically provide an objective assessment for clinical diagnosis. The platform used the ASUS VivoWatch BP (ASUSTeK Computer Inc., Taipei, Taiwan) to acquire physiological data from the wrists of PD patients during sleep. Following overnight recording, the data were then transferred to a clinic or hospital and analyzed using our proposed MLbased algorithms. The patients wore the device at home, and it transmitted multiple objective assessments, such as sleep efficiency, REM, and sleep cycle, to the clinician. The programming interface of the ASUS application enabled an efficient communication between the wearable device and custom cloud server. Thus, all physiological data collected from the wearable device could be stored, analyzed, and even translated to clinical content. convolutional neural network, long short-term memory, and perceptron [14,29,35].

An Intelligent Wearable Device for Objective Assessment of Sleep in PD Patients
In this study, we aimed to design a quantification method as an objective assessment for REM disorder and RBD evaluation in PD patients at home. We developed an algorithm for sleep-stage classification to identify the collected physiological data including the Gsensor and heart rate from the smartwatch. The algorithm could distinguish awake, light sleep, deep sleep, and REM sleep. Based on the k-means clustering algorithm, the heart rate data and G-values were used individually to differentiate subject-specific variation [36]. Importantly, the objective assessment for REM disorder was presented as an index with a statistical difference, which could be implemented in smartwatch sensors as a convenient and effective tool for sleep quantification analysis in PD patients. Figure 1 shows the intelligent wearable device proposed in this study for the objective assessment of sleep in PD patients. The proposed platform combines a wearable device with an analysis software to analyze the physiological data associated with the disease and automatically provide an objective assessment for clinical diagnosis. The platform used the ASUS VivoWatch BP (ASUSTeK Computer Inc., Taipei, Taiwan) to acquire physiological data from the wrists of PD patients during sleep. Following overnight recording, the data were then transferred to a clinic or hospital and analyzed using our proposed ML-based algorithms. The patients wore the device at home, and it transmitted multiple objective assessments, such as sleep efficiency, REM, and sleep cycle, to the clinician. The programming interface of the ASUS application enabled an efficient communication between the wearable device and custom cloud server. Thus, all physiological data collected from the wearable device could be stored, analyzed, and even translated to clinical content. Figure 1. The proposed wearable device for objective assessment of sleep in PD patients. Subjects were assessed by an experienced neurologist and guided on how to use on the smartwatch to collect physiological data at home during sleep. Following overnight recording, the data were transferred to a clinic or hospital and then quantitatively analyzed using the proposed ML-based algorithms. The proposed wearable device for objective assessment of sleep in PD patients. Subjects were assessed by an experienced neurologist and guided on how to use on the smartwatch to collect physiological data at home during sleep. Following overnight recording, the data were transferred to a clinic or hospital and then quantitatively analyzed using the proposed ML-based algorithms.

Data Acquisition and Clinical Trial Design
The control group and PD group comprised 30 healthy subjects without PD and 27 patients with PD, respectively. All subjects were recruited from the Buddhist Tzu Chi General Hospital in Taiwan. All subjects were right-handed and did not use any medication that affects heart rate (e.g., beta-blockers, thyroxine, or bronchodilator) during the experiment. The age of the healthy subjects ranged from 40-80 years with no history of neurological diseases. The inclusion criteria for PD patients were (1) an age range of 40-80 years, (2) PD diagnosis compliant with the UK Brain Bank diagnostic criteria, and (3) a H&Y scale stage between 2 and 4. The exclusion criteria for PD patients were (1) subjects diagnosed with secondary parkinsonism or a Parkinson-plus syndrome such as multiple system atrophy, progressive supranuclear palsy, and corticobasal degeneration (CBD); (2) subjects with Mini Mental State Examination scores below 24; (3) subjects with a history of epilepsy; (4) participants with pacemakers or with diagnosed arrhythmias (e.g., atrial fibrillation); (5) subjects who received deep brain stimulation surgery. In addition, all subjects with a history of neurological or psychiatric disease with a chronic heart disease (e.g., arrhythmia) and who were using a pacemaker were excluded. The study was reviewed and approved by the Buddhist Tzu Chi General Hospital Institutional Review Board (IRB107-66-A). The study covered the period from 1 January 2018 to 31 December 2019.
All subjects were asked to complete a self-rated PSQI assessment and to wear an ASUS VivoWatch BP smartwatch on their wrists at least 2 cm away from the tip of the ulna bone. In addition to the sleep status information, other relevant information, including pulse and blood pressure, were obtained from the ASUS VivoWatch BP. Three patients in the PD group who were not on clonazepam dropped out from the study because of invalid questionnaires. All subjects kept their normal medication routine. The demographic characteristics and sleep information of the two groups (i.e., control and PD) are listed in Table 1. The PD group included 15 patients who were not on clonazepam and 12 who were on clonazepam. Thus, the PD group was further divided into two subgroups, i.e., those who were using clonazepam (w. clonazepam) and those who were not using the drug (w.o. clonazepam) ( Table 2). Inadequate data acquisition with poor data quality was observed in 12 subjects in the control group and 7 subjects in the PD group (2 in the PD w. clonazepam subgroup and 5 in the PD w.o. clonazepam subgroup) because of the inappropriate method of wearing the smartwatch. These data were not considered in the quantification analysis of light-sleep, deep-sleep, REM, and abnormal REM listed in Tables 6 and 7.

Design of the Algorithm for Sleep Stage Classification
Accelerometer data were collected at a sample rate of 250 Hz. The beat-to-beat interval (RR interval) was also collected using the photoplethysmogram (PPG) sensor of the ASUS VivoWatch BP smartwatch. An algorithm was designed to detect and classify the sleep stage of the subjects into awake, light sleep, deep sleep, and REM ( Figure 2). According to the architecture of the sleep-stage classification in this study, three detection stages were sleep/awake detection, sleep-stage detection, and REM-stage detection. First, sleep/awake detection was conducted to identify the awake and sleep stages. A Cole-Kripke algorithm with a maximum of 30 s nonoverlapping epoch (G-value) was implemented as shown in Equation (1) [30]: W −1 = 28, W 0 = 121, W −1 = 8, W +2 = 50, P = 0.01076 (P was a modified scale factor from Cole-Kripke algorithm). The modified method was derived from all sample data in this study by iteratively varying factor P to maximize the percentage of correct sleep/awake identification. Second, a scoring method for sleep-stage detection was implemented to identify lightsleep and deep-sleep stages. Based on the criteria of the G-value obtained at every 30 s epoch, values were added to or subtracted from the initial score (score = 0). For G-values below 40, 1 was added to the initial score. For 40 G < 50, 50 G < 80, 80 G < 200, 200 G < 400, and 400 G < 600, 2, 3, 5, 10, and 20 were subtracted from the initial sleep score, respectively.
Third, the REM-stage detection was performed based on the sleep-stage categorized by the previous sleep/awake detection procedure. K-means clustering was conducted on the RR interval information recorded using the ASUS VivoWatch BP to further classify the deep-sleep and REM stages. Training and validation procedures were individually performed on the data of each patient. The k-means clustering was performed based on Equation (2): Biosensors 2022, 12, 74 c is the mean of the centroid of the cth cluster in real d-dimensional space R d , K is the number of randomly selected centroids set at 2. The training procedures were calculated according to Equation (3): where x i are the data samples in subset S c ; (t) is the t-th iteration, x−y is the Euclidean distance, and the centroids µ c are updated by following Equation (4): where n c represents the total number of data samples in the cth subset. Equations (3) and (4) were then iteratively calculated until the centroid with minimal changes in 100 iterative times was achieved. The Equation (5) is as follow: where μ c (0) is the mean of the centroid of the cth cluster in real d-dimensional space R d , K is the number of randomly selected centroids set at 2. The training procedures were calculated according to Equation (3): where x i are the data samples in subset S c ; (t) is the t-th iteration, ‖x-‖ is the Euclidean distance, and the centroids μ c (t) are updated by following Equation (4): where n c represents the total number of data samples in the cth subset. Equations (3) and (4) were then iteratively calculated until the centroid with minimal changes in 100 iterative times was achieved. The Equation (5) is as follow: Figure 2. The algorithm used for sleep-stage classification. First, sleep/awake detection was coducted using the Cole-Kripke algorithm. Second, light-and deep-sleep stages were classified based on the G-value. Finally, the REM stage was detected using k-means clustering.

Validation Procedure of Sleep-Stage Detection
The motion and heart rate for algorithm validation were obtained from PSG, which is an open access database on PhysioNet [37,38]. The investigators collected physiological signals using wearable devices (e.g., Apple Watch) and the labeled sleep records from PSG. The data were recorded, which included 31 subjects who spent the night in the lab for an 8 h sleep protocol. The protocol involved recording the acceleration and heart rate of the subjects using their Apple Watch while they slept. This validation method was chosen for the proposed sleep algorithm to avoid complicated clinical validation methods. However, the data were recorded on an Apple Watch, and little differences must occur between motion data recorded on different device sensors. In addition, the sleep algorithm proposed here was developed to offer three sleep-stage classifications (i.e., including light (N1 + N2)/deep (N3)/REM) instead of only two sleep-stage classifications (i.e., only awake/sleep and NREM (N1 + N2 + N3)/REM). Thus, to render the PSG data suitable for this study, a G-value scaling method for data normalization was used. The following three methods were tested on the sleep-awake algorithm to scale up the G-values from the PSG database so that they fit the data of the current study: Figure 2. The algorithm used for sleep-stage classification. First, sleep/awake detection was coducted using the Cole-Kripke algorithm. Second, light-and deep-sleep stages were classified based on the G-value. Finally, the REM stage was detected using k-means clustering.

Validation Procedure of Sleep-Stage Detection
The motion and heart rate for algorithm validation were obtained from PSG, which is an open access database on PhysioNet [37,38]. The investigators collected physiological signals using wearable devices (e.g., Apple Watch) and the labeled sleep records from PSG. The data were recorded, which included 31 subjects who spent the night in the lab for an 8 h sleep protocol. The protocol involved recording the acceleration and heart rate of the subjects using their Apple Watch while they slept. This validation method was chosen for the proposed sleep algorithm to avoid complicated clinical validation methods. However, the data were recorded on an Apple Watch, and little differences must occur between motion data recorded on different device sensors. In addition, the sleep algorithm proposed here was developed to offer three sleep-stage classifications (i.e., including light (N1 + N2)/deep (N3)/REM) instead of only two sleep-stage classifications (i.e., only awake/sleep and NREM (N1 + N2 + N3)/REM). Thus, to render the PSG data suitable for this study, a G-value scaling method for data normalization was used. The following three methods were tested on the sleep-awake algorithm to scale up the G-values from the PSG database so that they fit the data of the current study: where G max and G min are the maximum and minimum G-values, respectively, of the smartwatch data collected in this study, and G dmax and G dmin are the maximum and minimum G-values, respectively, obtained from the PSG database. The results of the tests using Equations (6)-(8) are listed in Table 3. Equation (8) exhibited the best performance and, hence, it was implemented in the validation process. Table 3. Results of the three tested G-value scaling methods. Lastly, to exclude the REM detection errors caused by the algorithm, the following steps were followed to modify the identification of the REM stages:

Equation (6) Method Equation (7) Method Equation (8) Method
(1) The first 45 min after sleep onset, as defined by the sleep-stage classification algorithm, was considered a non-REM period; (2) Separated REM segments of less than 5 min were considered non-REM periods; (3) Epochs of 3 min or less of non-REM in between two periods of REM stages were considered as REM and could overrule the sleep-stage classification algorithm.
It is important to use an illustrative and credible indicator to quantify the abnormal REM levels in the obtained data. Here, this indicator was the percentage of abnormal REM occurrence to the total period of the REM stage. It was chosen owing to the irregularity of the abnormal REM and individual diversity of the sleep-cycle patterns. Therefore, percentage calculation could give a more objective and standardized perspective rather than calculating the total time of the REM stage. Time frames of abnormally high G-values during the REM sleep stages were determined, and their percentage out of the total time of the REM sleep stage was calculated using Equation (9): where n is the number of minutes at which the G-value is over the threshold, and T is the total number of minutes of the REM sleep stage. This method offers a standardized evaluation of REM disorder in PD patients.

Statistical Analysis
A statistical analysis was performed on the three subject groups using PASW statistics version 18 (SPSS, Chicago, IL, USA). The comparisons between the two main groups (i.e., control group and PD group) were conducted using the Wilcoxon signed-rank test, and those conducted between the three groups (i.e., control group, PD group w. clonazepam, and PD group w.o. clonazepam) were conducted using the Kruskal-Wallis test. All clinical data of the subjects were averaged and expressed as the mean value and standard deviation of the mean (mean ± SD). A probability value of p < 0.05 was used as the criterion to determine the statistical significance.
To evaluate the correlation between the data obtained from the altered wearable devices and those obtained from the questionnaire, the relationship between the PSQI results and the wearable device variables was determined using Spearman's correlation coefficient test. For multifaceted confirmation, the PSQI results included PSQI, sleep start, sleep end, sleep time, and time in bed. Significant correlations (p < 0.05) were reported between the parameters.
To achieve the optimal G-value threshold for identifying abnormal REM behavior, the Mann-Whitney U statistic test was conducted to compare the control and PD groups. A minimal p-value < 0.05 was used as the criterion to determine the statistical significance, and the corresponding G-value threshold was observed. Furthermore, the objective assessment index for the comparison of abnormal REM behavior between the control group, PD group w. clonazepam, and w.o. clonazepam was analyzed using the Friedman test, which is the non-parametric alternative to the one-way analysis of variance with repeated measures. Here, too, the significance level was set at p < 0.05.

Personalized Sleep Detection Algorithm for Rapid Eye Movement (REM) Stages
In this study, three algorithm validation methods were used for three different resolutions of the sleep stages: (1) Two-stage sleep-awake detection (awake, sleep); (2) Two-stage sleep-stage detection (REM sleep, NREM sleep); (3) Three-stage sleep-stage detection (light sleep, deep sleep, and REM sleep).
In the two-stage sleep-awake detection, self-collected data recorded by the ASUS VivoWatch BP were used instead of those collected from PSG database owing to the different definitions of the awake label between our data and those from PhysioNet. Thus, the developed sleep-awake detection algorithm was used on self-collected data for the validation of the two-stage sleep-awake detection. In the three-stage sleep-stage detection validation, the sleep-stage detection algorithm was first used on the data from PhysioNet to classify the light-sleep and deep-sleep stages. The REM-stage detection algorithm was then used to further distinguish the REM stages from the deep-sleep stages.  REM stages are characterized by an increase in heart rate [1]. Thus, to distinguish between REM and deep-sleep, k-means clustering was conducted on all heart rate data during the deep-sleep stage ( Figure 4). Figure 4A-C shows the k-means clustering results of the control group, PD group w. clonazepam, and PD group w.o. clonazepam, respectively. Low heart-rate data were assigned to the deep-sleep stage, while high heart-rate data were assigned to the REM sleep stage. Using heart rate as the cluster factor enabled accurate distinction between REM and deep-sleep stages in all three groups.  REM stages are characterized by an increase in heart rate [1]. Thus, to distinguish between REM and deep-sleep, k-means clustering was conducted on all heart rate data during the deep-sleep stage ( Figure 4). Figure 4A-C shows the k-means clustering results of the control group, PD group w. clonazepam, and PD group w.o. clonazepam, respectively. Low heart-rate data were assigned to the deep-sleep stage, while high heart-rate data were assigned to the REM sleep stage. Using heart rate as the cluster factor enabled accurate distinction between REM and deep-sleep stages in all three groups.   Figure 5A shows the sleepcycle pattern of the control group, while Figure 5B,C shows the sleep-cycle pattern of the PD group w. clonazepam and PD group w.o. clonazepam, respectively. Sleep cycles varied for each individual, typically lasting from 7 to 9 h. Black lines show the various sleep   Figure 5A shows the sleepcycle pattern of the control group, while Figure 5B,C shows the sleep-cycle pattern of the PD group w. clonazepam and PD group w.o. clonazepam, respectively. Sleep cycles varied for each individual, typically lasting from 7 to 9 h. Black lines show the various sleep stages of the individuals calculated using the proposed sleep-stage classification algorithm. The blue lines indicate the heart rate recorded using the ASUS VivoWatch BP, while the red lines show the G-values. Light-sleep stages switched to deep-sleep stages at low G-values and vice versa. The REM stage strongly corresponded to the increases in the heart rate and G-values. In addition, the percentage of the occurrence of high G-values during sleep stages in the PD groups was significantly higher than that in the control group.
Biosensors 2022, 12, x FOR PEER REVIEW Figure 5. Results of the three sleep-stage detection algorithm for the (A) control group, (B) P w. clonazepam, and (C) PD group w.o. clonazepam. The solid, black line represents the which was used to identify the three sleep stages. It revealed that the PD groups had longe and light sleep durations than those of the control group. In addition, the duration of the de in the PD groups was less than that in the control group. The blue line represents the h (bpm), which is correlated to the sleep stages. Variable heart rates were observed for the PD particularly in the REM stage.

Correlation between Clinical Data and Sleep Algorithm Results
Indices reflecting the sleep quality of the participants were easily computed b Figure 5. Results of the three sleep-stage detection algorithm for the (A) control group, (B) PD group w. clonazepam, and (C) PD group w.o. clonazepam. The solid, black line represents the G-value, which was used to identify the three sleep stages. It revealed that the PD groups had longer awake and light sleep durations than those of the control group. In addition, the duration of the deep stage in the PD groups was less than that in the control group. The blue line represents the heart rate (bpm), which is correlated to the sleep stages. Variable heart rates were observed for the PD groups, particularly in the REM stage.

Correlation between Clinical Data and Sleep Algorithm Results
Indices reflecting the sleep quality of the participants were easily computed based on the outcomes of the aforementioned sleep scoring algorithm. Two indices were considered: (a) sleep efficiency (total sleep time divided by total time in bed) and (b) total sleep time. A Spearman's correlation was used to assess the relationship between the clinical data obtained by the questionnaire and the data recorded by the ASUS VivoWatch BP in a sample of 57 subjects ( Table 4). The results showed statistical significance between the total sleep time obtained from the clinical data and that obtained from the smartwatch data (p = 0.01). However, low correlation was found between the clinical and smartwatch data in both indices, owing to the subjects' incorrect interpretation of the sleep-cycle start time.

Statistical Analysis Results
To classify the abnormal REM behavior, a G-value threshold was determined. Mann-Whitney tests were conducted on the G-value medians of both the control and PD groups to choose the G-value of the most minimum p-value as the threshold. Table 5 shows 12 tested threshold values ranging from 1200 to 4500 in increments of 300. The Mann-Whitney test indicated that when the G-value threshold was set at 1500, the difference between non-PD (median = 240) and PD patients (median = 690) showed the most statistically significant values when the p-value was at its minimum (p = 0.0117) and the T-value was at its maximum (T = 941). In the two-group data, an average PSQI global score of 6.66 ± 3.6 (mean ± S.D.) was detected in 30 control-group patients (Table 1). In contrast, a PSQI global score of 10.6 ± 5.4 was detected in 27 PD patients (p < 0.05, Wilcoxon rank sum test). The PD group showed a significant increase in the PSQI global score, indicating a sleep quality inferior to that of the control group. Additionally, time in bed values of 434 ± 78.5 and 477.7 ± 82.3 min were detected in the control group and the PD group, respectively (p < 0.05, Wilcoxon rank sum test). Thus, the PD group had longer times in bed than the control group. The start and end times of sleep as well as sleep duration of the control group significantly differed from those of the PD group.
In the three-group data, an average PSQI global score of 9.6 ± 5.1 was detected in 12 PD on clonazepam medication patients (Table 2). In contrast, a PSQI global score of 11.4 ± 5.7 was detected in 15 PD patients w.o. clonazepam (p < 0.05, Kruskal-Wallis test). The PD w. clonazepam group showed a slight decrease in the PSQI global score, indicating better sleep quality than that of the control group. In addition, the start and end of the sleep time, sleep duration, and time in bed of the PD group w. clonazepam significantly differed from those of the PD subjects w.o. clonazepam. Tables 5 and 6 show quantitative analysis results of the data obtained from the smartwatch (two-group analysis and three-group analysis, respectively). The results of the two-group analysis indicated that the percentages of the light sleep in the 18 control group subjects and 20 PD patients were 25.7 ± 21.3% and 60.0 ± 19.5%, respectively ( Table 6). The deep-sleep percentages were 38.1 ± 24.3% and 22.0 ± 15.0% in the control group and the PD group, respectively. Moreover, the RBD stage represented 36.1 ± 24.1% and 17.7 ± 11.7% of the total sleep of the control group and the PD group. Lastly, the abnormal REM in the control group and the PD group represented 1.6 ± 1.3% and 3.8 ± 5.0% of the total cycle, respectively. There was a significant difference between all smartwatch data in the control and PD groups (p < 0.05). The PD group exhibited higher percentages of abnormal REM and light sleep and lower percentages of REM and deep sleep than the control group.   Table 7 shows the results of the three-group analysis. The results indicated that the percentages of the mean ± standard deviation of the light-sleep stage were 56.2 ± 19.4% and 64.2 ± 19.7% in the PD group w. clonazepam and the PD group w.o. clonazepam, respectively. The deep sleep in the PD group w. clonazepam and the PD group w.o. clonazepam was 27.3 ± 15.0% and 16.8 ± 13.8%, respectively. The percentage of deep sleep in the PD group w.o. clonazepam was significantly lower than that in the control group and PD group w. clonazepam. The REM-stage percentages in the PD group w. clonazepam and PD group w.o. clonazepam was 16.4 ± 11.2% and 18.9 ± 12.7%, respectively. The percentages of the standard deviation of the abnormal REM in the PD group w. clonazepam and the PD group w.o. clonazepam was 2.0 ± 1.7% and 5.7 ± 7.1%, respectively. This statistically significant difference was evident in all quantification results. The percentages of abnormal REM and light sleep in the PD group w. clonazepam medication were higher than those in the other two groups. Deep sleep exhibited the lowest percentage among all parameters.

Personalized Sleep Detection Algorithm for the REM Stages
Sleep disturbances were prevalent in PD patients and showed an impact on their quality of life. Of PD patients, 30-37.5% suffered from RBD [19,39]. A suitable method for sleep monitoring, such as wearable smart devices, are proposed as an alternative to PSG because of its cost and inconvenience to patient [30,40,41]. In the present study, a wearable device (ASUS VivoWatch BP) was used to quantify and analyze the sleep of PD patients using an algorithm architecture. The algorithm was conducted on the collected heart rates, and the heart rate variation (HRV) was calculated to identify the REM and NREM stages. Similar to previous studies, an algorithm called k-means was used as a feasible algorithm to predict the sleep/wake phases of unlabeled data [14]. Because this is an unsupervised ML method, it could also be adopted as an individual physiology baseline to accurately classify the clusters into two sleep stages. The autonomous nervous system modulations reflected an increase in heart rate during the REM phase [42,43]. The parasympathetic nervous activity was elevated at the NREM stage, but the sympathetic nervous activity was higher at the REM stage [44]. Thus, PD patients with or without RBD could be identified based on the activities of the cardiac sympathetic nervous system [45]. This study demonstrated that the heart rate clusters directly corresponded to the REM stage in all three groups, particularly in the PD group.
Here, the G-values were determined at each RR interval and used to classify light and deep sleep using the proposed algorithm. The G-value threshold was used as the indicator to distinguish between the REM and NREM stages. It reflected the variability of the cardiac rhythm at different stages of sleep. The high percentage of the G-value occurrence may reflect the poor regulation of the sympathetic system activity in the PD groups. However, in the present study, a strong correlation was found between heart rate and sleep stages in both the PD and control groups, which agree with the results of previous studies [46,47].

Correlation between Clinical Data and Sleep Algorithm Results
Maglione et al. [41] studied the sleep behavior in patients with mild or moderate PD using wrist actigraphy and demonstrated that there was a significant correlation between the total sleep time and sleep efficiency. In the present study, only the total sleep time was presented and showed the same outcome (Table 4). Palotti et al. [35] noted that the systematic overestimation or underestimation of the results using actigraphy-device algorithms could lead to misidentification of the reported sleep-related disorders. Thus, sleep stages could not be identified using actigraphy. Here, sleep data were analyzed according to heart rate, RR interval, and motion signals obtained using a smartwatch. Data analysis using the proposed algorithm was validated based on open-access data from more than 30 subjects. More specific information about sleep stages (i.e., sleep/awake, NREM/REM, and light sleep/deep sleep/REM) were obtained. Although a mean absolute percentage error of 16.49% for total sleep time was obtained here, it was consistent with the previous study [48]. The results of the mean absolute error of the total sleep time were different from that obtained in a previous study [48]. However, this result further revealed a significantly higher correlation between the total sleep time reported in the clinical data and that obtained using the smartwatch. Significantly longer times in bed were observed in the PD group than in the control group, which suggests that the PD group experienced difficulty falling asleep compared to the control group.

Statistical Analysis Results
Sleep disturbances are a common non-motor syndrome among approximately 90% of PD patients [49]. Sleep quality could be assessed by questioning subjects, subjectively completing a questionnaire, or using a technology-based approach. In this study, sleep components were objectively acquired using a smartwatch. Here, the PD group exhibited significantly higher PSQI scores (p < 0.001) and time in bed (p < 0.022) than the control group. Notably, the PSQI of the PD w.o. clonazepam group showed that they experienced more sleep-related problems. Nomura et al. [50] reported that PD drug levels affect RBD in PD patients. Here, the PD group w.o. clonazepam demonstrated more RBD than the PD group w. clonazepam and the control group. While there was no significant difference between the sleep efficiency in the control group and the two PD groups, the heart rate variability (HRV) of the PD group was more unstable at night [51]. Here, the G-value threshold was set at 1500, and a statistically significant difference was found in the identification of the abnormal REM behavior. Nevertheless, the PD groups showed higher G-value percentages than the control group, indicating that the PD groups had a higher tendency for light sleep. This suggests that the PD group exhibited more abnormal REM behavior than the control group.
Typically, NREM and REM sleep represent 75-80% and 20-25%, respectively, of the sleep cycle during the night. Here, similar values were obtained. The NREM stage was subdivided into three stages and correlated to the depth of sleep. The automatic nervous system is more stable during the NREM stage. Patients with PD could develop autonomic dysfunction with unstable HRV. Low HRV is associated with PD patients including low activities of the sympathetic nervous system and parasympathetic nervous system. Zahed et al. [15] reported that light sleep increased in PD patients, while deep sleep and REM sleep decreased. It was also reported that the reduction in the deep-sleep stage was positively correlated to PD. Here, the results showed that the PD group experienced longer times in bed, increased percentage of light sleep, and reduced deep and REM sleep. These results are consistent with those obtained in previous studies [15,52]. Slow-wave sleep (SWS) (i.e., deep NREM sleep (N3)), plays an important role in neurodegenerative disorder. The decline in SWS could affect motor activities and cognitive function, such as the abilities to learn new information and memory retention, because SWS can influence pathological proteins and modulate neurodegeneration [53]. Thus, evaluation of SWS condition in PD patients is helpful to elucidate PD progression. The high proportion of light sleep for the PD group indicates poor sleep quality at night and could cause daytime sleepiness. In addition, poor sleep quality could be a risk factor for PD. Patients with PD were usually associated with low REM time and low REM to the total sleep duration. REM sleep could help maintain neuronal stability with consolidation of information and reinforced memory. A decrease in REM sleep could affect the brain's excitability and result in neurodegeneration. The PD group in this study exhibited high abnormal REM percentages, which may reflect the comorbidity of RBD in PD patients. Therefore, the smartwatch used here can accurately detect the sleep condition in PD patients and provide useful information to patients and doctors.
The wearable device proposed in this study could be used to monitor sleep conditions outside the laboratory (e.g., at home), because PSG requires well-trained individuals, a specific environment, and a complex setup. Using wearable devices to monitor sleep conditions could be a reliable method comparable to PSG, especially within large populations [40]. A shortcoming of the present study was some poor-quality data, which were not considered in the final analysis. This was attributed to usability problems, i.e., incorrect wearing of the smartwatch and unintentional touch of the stop button. Thus, the guide and method for use of the smartwatch in this study should be revised to avoid these issues.
To obtain better quality signals, first, the optimal wearing method for the smartwatch should be clarified, and the user should be instructed on how to wear and operate it with detailed guidelines before starting the protocol. In fact, the original company is developing a new version of the smartwatch with a new feature of a signal quality index and a reminder regarding the correct wearing method to ensure the stability of data collection.

Conclusions
Quality of sleep has an effect on every aspect of human life. Sleep disturbances are highly common in PD patients. Non-motor-induced symptoms, including those associated with the autonomic nervous system, are linked to PD. The heart rate response can reflect impaired automatic dysfunction. This study proposed a new method for the collection and evaluation of sleep data from PD patients using wearable devices. The algorithms used here detected and calculated the heart rate when the subjects were asleep. When actigraphy was used to identify sleep disorders in PD, significant differences were detected among individuals. Even though the PSQI results revealed that the PD groups suffered from sleep disturbances, self-reported clinical questionnaires could affect the sleep time recording results. Thus, this study proved that clinical applications of wearable devices in sleep monitoring are feasible. The smartwatch can serve as a communication tool between PD patients, clinicians, and medical transdisciplinary teams. RBD is a powerful predictor of PD progression. However, the accuracy of sleep-quality prediction using the smartwatch was lower than that obtained using standard examination equipment such as PSGs, EEGs, and ECGs. However, the method used here could differentiate between the sleep stages (sleep/awake, NREM/REM, and light/deep/REM stages) of PD patients. The use of a smartwatch enables clinical practitioners to monitor the sleep problems of PD patients in a convenient way.

Limitations of the Research
In this study, we can find some limitations with our smartwatch for detecting sleep disorders in PD and normal healthy persons. First, our smartwatch could not detect sleep apnea conditions. Obstructive sleep apnea syndrome is an important sleep disorder in the general population and PD patients [54]. The additional oximeter included in the future model will increase the ability of the smartwatch to find sleep apnea. Second, unlike PSG with video recording, our smartwatch could not investigate sleep-related movement disorders such as restless leg syndrome and periodic limb movement disorder [55]. Third, except for REM sleep behavior disorder, other parasomnias, such as sleepwalking and sleep terrors, also could not be detected by our smartwatch without video recording [56]. Theoretically, we could also use the ECG monitor, light sensor, and even microphones from the ASUS VivoWatch BP smartwatch, as part of a multi-modality sensor array, for further detection of different types of sleep disorders, but ASUS does not provide specific details about the features beyond PPG-based RR interval and motion detection.