Abstract
Introduction
REM-sleep without atonia (RWA) is a distinctive and essential feature of REM-sleep behaviour disorder (RBD), a parasomnia characterized by a clinical history of acting out of dreams during REM-sleep, leading to behaviours which are potentially injurious to the patient or bed partner. The isolated form of RBD is recognized as prodromal state for clinical α-synucleinopathies such as Parkinson’s disease and Lewy-body dementia. Many approaches have been proposed to score and quantify RWA, primarily for diagnostic purposes (reviewed by Refs.1,2). Up to now there is no general consensus on one accepted methodology, but recommendations have been published recently attempting to harmonize existing methods. 3 All current methods utilize electro-myographic (EMG) activity of at least the chin muscle, which is one of the essentials for scoring REM-sleep and hence part of regular nocturnal polysomnography (PSG). Several methods include the EMG activity of supplementary muscles as well, notably in legs and/or arms. Almost all methods distinguish phasic and tonic (sometimes “short” and “long”) muscular activity with considerable variation in duration- and amplitude criteria. Furthermore, all methods arbitrarily subdivide the REM-periods in mini-epochs of different lengths, usually one to several seconds, to account for short-lasting muscular activations.
In our clinic we quantify RWA with a computer algorithm that generates three kinds of output. The first two are based on the so-called Montreal method (tonic and phasic EMG activation), which has been the first published and validated method to visually quantify RWA,4–6 and for which, at least to the best of our knowledge, no readily available automated version exists. The third output, Ikelos-RWA, is based on a method developed by us with the aim of being methodologically as lean and concise as possible, removing all possible non-essential conditions and presuppositions, without compromising the ability to reliably estimate muscle activation during REM-sleep. As such, it should be readily applicable, not so much for diagnostic purposes, but rather and preferably in repeated measures situations, achieving one comprehensive value each time, so that pathological progression or regression over time can be easily documented. It is precisely in this regard that we used it in a study exploring the utility of RWA as a marker of progression in α-synucleinopathies. 7
The aims of the present study are fourfold. The first is to give a detailed description of the computer algorithm, of which readers can obtain the source code upon request. Hypothesizing that the computer algorithm identifies RWA episodes as accurately as visual scorers, the second aim is to evaluate the computer algorithm by comparing the output to visual scorings of PSGs from a cohort of RBD patients. Furthermore, based on published literature on the Montreal method,4–6 we hypothesize that the algorithm differentiates RBD patients well from controls. Hence, the third goal is to clinically evaluate the automatic RWA scores of patients with RBD against a cohort of control subjects without RBD. To maximally challenge the comparative analysis, we refrained from recruiting a group of healthy subjects and instead used patients with periodic limb movement disorder (PLMD) as controls. PLMD is a sleep pathology that is also characterized by a major motor component, but of a different character and, unlike RBD, is not due to neurodegeneration. Finally, the fourth aim is to compare the algorithm output based on the well-established Montreal method with that of our newly developed, simplified tool, Ikelos-RWA. We were interested in applying both approaches to a patient sample potentially large enough to encompass the pathology of RBD at all stages of progression and in all possible cross-sectional varieties. Thus, we sought the largest sample size available and decided to use the PSGs of all patients diagnosed with RBD in our clinic. This sample represents one of the largest single-centre RBD cohorts published to date.
Materials and Methods
Patients
Twenty patients were randomly selected from 67 consecutive patients diagnosed with RBD between March 2012 and November 2016, for retrospective EMG analysis of PSG recordings, in order to compare the computer algorithm output with visual RWA scoring. Randomization was ensured by sorting patients alphabetically and, in that order, successively applying the inclusion and control matching criteria. Inclusion criteria: isolated RBD, apnea/hypopnea-index <15/h, PLM-index <15/h, at least 2 REM episodes in the second night with at least 5% REM time of the sleep period time. Their average age was 68.2 ± 7.2 years (mean ± SD), six of them were female. An additional group of 20 patients with PLMD was used as sex- and age-matched control. Their average age was 65.9 ± 6.7 years. Their average PLM-index was 53.1 ± 31.4 per hour and these patients were seen between May 2015 and December 2016.
For further analysis of the computer algorithm, the PSGs of a large group were used, consisting of 232 consecutive patients, diagnosed with RBD between November 2004 and December 2021 (average age: 68.5 ± 9.3 years, 47 females). Obstructive sleep apnea (OSAS) and PLMD were present as comorbidities in 69 and 104 patients, respectively, of which 31 had both comorbidities. Nocturnal video-supported PSG (vPSG) was preceded by a detailed examination by a sleep specialist, including psychiatric, neurologic and general medical evaluation. RBD was diagnosed according to ICSD-3, 8 based on: (a) a history of dream enactment and (b) a vPSG demonstration of RWA in parallel to complex behaviour. All patients had provided written informed consent for their clinical data to be analysed and published anonymously.
Nocturnal Video-Polysomnography
All patients underwent full night vPSG on three consecutive nights with a digital recording system (Monet 24-CPU, TMS International, Enschede, The Netherlands), with Rembrandt 7.5 software (Medcare Automation, Amsterdam, The Netherlands). It included electrooculography, electroencephalography (sample rate 160 Hz, filter settings 0.3 to 70 Hz, with the 10-20 system derivations F3, F4, C3, C4, O1, O2, each referred to the contra-lateral mastoid), bipolar surface EMG of m. mentalis and both mm. tibiales anterior (sample rate 200 Hz, filter settings 10-100 Hz, with 50 Hz notch filter), ECG, deep-body temperature (rectal thermistor), nasal-oral flow, thoracic and abdominal respiratory effort, oxygen saturation, snoring detection and digitally synchronized video (infra-red, 25 fps) and audio recording (44.1 kHz, 16 bits, mono).
The first night was considered as adaption and the following two nights for diagnostic purposes. Biocalibration was performed prior to the start of each recording to ensure adequate signal quality. Each recording took place in a dark, low-noise bed room.
Scoring
Sleep stages and associated events were scored by two experienced scorers (FB, MH, established inter-rater reliability of >0.9) in 30-second epochs of the PSG in accordance with standard criteria. Because muscle atonia – required to score REM-sleep – is disturbed with RBD, the scoring of REM-sleep was modified according to methods proposed by the Montreal group.4–6 Thus, the onset of a REM-sleep episode was determined by the occurrence of the first rapid eye movement, the end of a REM episode by either the occurrence of specific NREM EEG features or by the absence of rapid eye movements during six consecutive 30-second epochs.
RWA evaluation was performed on the second night. Thirty minutes of REM-sleep had to be present without technical problems concerning the signal acquisition. If this criterion was not met, night 3 was taken instead (in the RBD group 2/20, in the PLMD group 4/20, in the large RBD group 28/232 nights). RWA scoring was performed for all REM epochs and determined from the surface EMG signal of m. mentalis only. Epochs contaminated by breathing related RWA events had been visually labelled during sleep stage scoring and excluded from the analysis.
The procedure generates two scores based on the criteria of the Montreal method, one for tonic and another for phasic EMG activity. When tonic EMG with amplitude of at least twice the background EMG activity was present for more than 50% of the epoch, that epoch was scored as tonic. The Montreal method originally uses 20-second epochs for sleep stage scoring and defines phasic EMG activity as the percentage of 2-second mini-epochs containing EMG events lasting 0.1 to 10 seconds (which is half of an epoch), with an amplitude exceeding four times the amplitude of background EMG activity. 6 While using 30-second epochs for sleep stage scoring, we adapted the Montreal approach at this point and followed the approach of the Mayo Clinic, 9 by defining phasic events as the percentage of 3-second mini-epochs that contain EMG events lasting 0.1 to 14.9 seconds, and keeping the original amplitude criterion. The return of muscle activity to EMG background levels for at least 0.2 seconds defines the end of a phasic burst.
In addition, the automated procedure also generates a simplified RWA measure that we called Ikelos-RWA, after the god and personification of nightmares in the Greek mythology. We intended to design a measure that would be methodologically as lean and simple as possible, without compromising the ability to obtain a reliable estimate of muscle activation. Thus, with Ikelos-RWA we refrained from distinguishing between phasic and tonic EMG activity, and from using predetermined mini-epochs. RWA is defined as any muscle activity longer than 1 second within REM-sleep, with amplitudes exceeding 4 times the background EMG activity. Interruptions of RWA with activity below this threshold and shorter than 1 second are included in the score. By consequence, transient, ‘spiky’ EMG activity like phasic twitches can be detected if multiple such events occur at sequential intervals of less than one second (see an example in Figure 1). Ikelos-RWA is then expressed as percentage of total time spent in REM-sleep.

Example of RWA scoring in one epoch while using the tonic Montreal (TM), phasic Montreal (PM) and ikelos (I) criteria. This epoch contains <15 seconds of EMG activity passing the threshold for tonic activity, so no score on TM is indicated. Phasic activity is present in six mini-epochs. Ikelos-RWA starts counting just before the start of the 11th second and ends almost just before the start of the 18th second, gaps with sub-threshold activity <1 second are included. The EMG bursts in the 21st and 24th second are <1 second and hence not counted with Ikelos-RWA.
Description of the Algorithm
For brevity, we will here give a concise description of the algorithm. For a detailed description we refer to the Supplementary Information. The algorithm is a MATLAB based function written by the author. It includes several sub functions representing 12 different analysis steps of the algorithm (see Supplementary Figure 1).
Step 1. Load Information
The algorithm input comprises: (a) The raw EMG and ECG signals as a standard European Data Format (EDF) file. 10 In the present analysis the mental EMG is used, but the user of the algorithm may choose any other EMG signal and eventually form any preferred combination of EMG signals. (b) The visually scored sleep stages as a sequential text file. (c) The NREM-REM cycle information, indicating the starting and ending REM epoch of each successive REM episode.
Step 2. Signal Quality
The EMG power spectrum of each REM epoch in a REM episode is evaluated, in a frequency band sensitive to power line interference. This analysis returns a mean value across the REM epochs in the REM episode. The procedure thus provides a quality indicator for each separate REM episode. The REM episodes which do not fulfill specific criteria will be excluded and a warning message will appear in the final report.
Step 3. Filter
Since the human scorers during the RWA visual scoring use a given preferred bandpass filter, a similar bandpass filter is used in the algorithm in order to provide a similar signal for analysis in the algorithm. Our data were collected from 2004 onward, using a sampling frequency of 200 Hz and therefore, we could not apply a recently recommended bandpass between 5 and 500 Hz. 3 However, the cut-off frequencies of the bandpass filtering are an input parameter of the algorithm, allowing the user to adjust these according to his specific requirements.
Step 4. EMG Background
Since the quality of the raw EMG signal may change during the night (eg, incidental loss of electrode contact due to movement, deteriorating signal quality due to increasing electrode impedance over time, etc.) the algorithm calculates lowest EMG background amplitude (EMGBG) for each REM episode (k) separately. If EMGBGk is outside a valid range (0.3-5 µV), a warning message will appear in the final report, and this episode is excluded from the RWA calculation ‘without technical problems’.
Step 5. Exclusion of High EMG Amplitudes
Since EMG amplitudes exceeding 500 µV have no physiological significance, these values are set to zero (ie, labelled as ‘false’) and excluded from the analysis. A quality factor is estimated and if this exceeds a given range, a warning message ‘REM episode with too high EMG amplitude’ in the final report appears. Similarly to steps 2 and 4, the REM episode is marked as an episode with technical problems and hence excluded from the RWA calculation ‘without technical problems’.
Step 6. Amplitude Threshold
Since tonic activation has a threshold of two times the EMGBG and phasic activation a threshold of four times the EMGBG, there are two separate streams of samples for further analysis. One stream (a) will pass for further analysis all those samples with amplitude exceeding two times the EMGBG, assigning these the value of 1 (meaning “true”) and the second stream (b) will assign the value of 1 to the samples with amplitude exceeding 4 times the EMGBG. The second stream will be also used for the Ikelos-RWA criteria.
Step 7. ECG Correction
In order to evaluate the intrusion of ECG in the EMG signal, we first define the samples with high ECG amplitude. An approach similar to the EMG signal detection is followed, calculating in this step the lowest ECGBG.
The ECG correction assigns a value of zero (ie, remove from further analysis) to all those samples that simultaneously have ECG amplitude exceeding two times the lowest ECGBG and EMG amplitude exceeding two times the lowest EMGBG. Correspondingly, a warning message will appear in the final report.
Step 8. Bipolarity
Since the EMG signal is a bipolar signal, with samples having positive or negative amplitudes, the determination of EMG activity events should take this characteristic into consideration. If a sample (i) of the EMG signal has passed the threshold criterion (steps 6a and 6b) and has a polarity (p), it will pass the bipolarity criterion only if the samples next to it have passed the threshold criteria with the opposite polarity (-p). The bipolarity control thus ensures the existence of EMG activation in the positive as well as in the negative amplitude range.
Step 9. Interruption Duration
Phasic Montreal. With the phasic Montreal criteria, interruptions (of detected EMG activation) by sub-threshold activity of up to 0.2 seconds should be ignored. In this step, interruptions of less than 0.2 seconds are detected and their samples are assigned the value 1 (meaning ‘true’).
Ikelos-RWA. With the Ikelos
Step 10. Activation Duration
Phasic Montreal. With the phasic Montreal criteria the activation duration needs to be at least 0.1 seconds and at maximum 14.9 seconds In this step, activations shorter than 0.1 seconds are detected, as well as those longer than 14.9 second, and their samples are assigned the value 0 (‘false’).
Ikelos-RWA. With the Ikelos-RWA criteria, the required activation duration is equal or longer than 1 second. Activations shorter than 1 second are detected and their samples are assigned the value 0. The final Ikelos-RWA percentage is the percentage of the samples in epochs scored as REM in all REM episodes having a value of 1.
Step 11. Epochs and Mini-Epochs
Phasic Montreal. The stored intermediate results are analysed in consecutive steps of 3 seconds, according to subdivision of the visually scored 30 seconds sleep epochs into 10 equal mini-epochs. The final phasic Montreal RWA percentage is calculated.
Tonic Montreal. The stored intermediate results are analysed in steps of 30 seconds, matching the 30-second epochs used for the visual sleep staging. The final tonic Montreal RWA percentage is calculated.
Step 12. Final Report
A report file is saved with all relevant information of the subject, the sleep recording, and the RWA calculations separating the REM episodes without technical problems from all REM episodes. In addition, the EMGBG and further technical information for each REM episode is reported in an algorithm output overview.
Statistics
Because part of our data was non-normal distributed, the Spearman correlation coefficient (r) was used to assess the variability between the automatic and visual RWA scorings. The coefficient r was also used in order to evaluate the similarities and differences among the RWA criteria of Montreal and Ikelos. Cohen's Kappa coefficient was used to assess agreement between automatic and visual RWA scorings per sample. 11 Finally the sensitivities, specificities in the optimal operating points (OOP) and the area under the curve (AUC) of the receiving operating characteristic (ROC) values were calculated for the groups of 20 RBD and PLMD patients. All plotting and statistical procedures were made in MATLAB.
Results
The average REM-sleep duration of the respective 20 patients in the RBD group was 86.8 ± 31.8 and 73.5 ± 20.0 minutes in the control group. A total time of 1735 (1685.5 without artefacts) minutes of REM-sleep was analysed for the RBD group and 1398 (1361 without artefacts) minutes for the control group.
Figure 2 provides the correlation between the visual RWA scorings (y-axis) and the automatic RWA scoring (x-axis) for the 20 RBD patients. The Spearman correlation coefficients r were rTM = 0.77, rPM = 0.78 and rI = 0.97 and were highly significant (p < 0.001).

Visual versus automatic RWA scorings, using tonic Montreal, phasic Montreal and Ikelos-RWA criteria in 20 RBD patients. The different symbols represent the individual patients. Spearman correlation coefficients (r) with p-values are indicated.
To provide a detailed evaluation of the comparability between visual and algorithm automatic RWA scorings, the agreement (aTM = 0.90; aPM = 0.91; aI = 0.90), as well as Cohen's Kappa coefficient (kTM = 0.71; kPM = 0.79; kI = 0.77) for 20,226,000 samples of REM-sleep in the RBD group (equivalent to 1685.5 minutes with 200 Hz sampling frequency) were calculated. The outcome showed a good to excellent agreement between visual and automatic RWA scorings.
The ROC curves were constructed using the automatic scorings for the 20 RBD and the 20 control patients (Figure 3). The OOP for the tonic Montreal automatic scorings was 3.7% having in this point a sensitivity of 100% and a specificity of 84%. The AUCTM was 0.96. The OOP for the phasic Montreal automatic scorings was 15.8% having in this point a sensitivity of 95% and a specificity of 90%. The AUCPM was 0.98. The OOP for the Ikelos-RWA automatic scorings was 8.2% having in this point a sensitivity of 95% and a specificity of 95%. The AUCI was 0.98.

Receiver operating characteristic (ROC) curve for the automatic RWA scorings, using the tonic Montreal, phasic Montreal and Ikelos-RWA criteria in 20 RBD patients. The optimal operating points are presented with circular grey markers. AUC: area under the curve.
In addition to the tonic and phasic Montreal RWA scores, the ‘overall RBD polysomnographic score’ was calculated. 5 This overall RWA score is the average of tonic and phasic EMG activity, containing the epochs with elevated muscle tone and the mini-epochs containing bursts of muscle activity. Figure 4 shows the automatic RWA scores of Ikelos-RWA versus tonic Montreal (TM), phasic Montreal (PM) and overall score ((PM + TM)/2) for 232 RBD patients, in the left, middle and right panels respectively. The average REM-sleep duration over the 232 nights was 75.7 ± 28.8 minutes and the analysed REM-sleep duration without technical problems 74.2 ± 28.8 minutes. The total REM-sleep time was 17,552.5 minutes and the analysed total REM-sleep time without technical problems 17,219 minutes. The TM, PM and overall RWA scorings were correlated significantly (p < 0.0001) with the Ikelos-RWA (I) (rTM{I} = 0.95; rPM{I} = 0.91; roverall{I} = 0.97).

The RWA results for 232 RBD patients are shown for the Ikelos-RWA on the ordinate, as a function of tonic Montreal (TM), phasic Montreal (PM) and their addition divided with a factor of 2. Spearman correlation coefficients (r) with p-values are indicated.
Discussion
This study demonstrated that our algorithm can provide a valid and reliable automatic RWA scoring, based on the first published and widely accepted visual scoring method (the Montreal method). In addition, the implemented simplified RWA approach (Ikelos-RWA), without characterizing EMG activation events as tonic or phasic, without predefining analysis time segments (mini-epochs), and taking signal quality changes over the night into account, demonstrated highly reliable estimates of RWA.
The automatic RWA scores correlated significantly with the visual RWA scores. The comparison of automatic and visual scorings showed greater dispersion for TM, compared to PM and Ikelos (Figure 2). This might be explained by considering that the TM scoring criteria use the longest analysis window (30 seconds) compared to PM and Ikelos (3 seconds and none, respectively). Hence, any actual scoring difference between automatic and visual method will have a larger impact on the total RWA score in TM compared to PM and Ikelos.
The verification of commonality between automatic and visual RWA scores was evaluated by calculating the agreement and Cohen's Kappa coefficient, which showed substantial similarity. 12
Moreover, as expected, the ROC analysis and the estimation of the AUC's showed that the Montreal RWA is a very good classification method, distinguishing well between RBD and non-RBD patients. Here as well, the simplified scoring by Ikelos-RWA showed similar high discrimination characteristics.
Finally, the application of the algorithm in a larger group of patients with RBD presents an overview of the pathological EMG variation among our patients but also a relation between the RWA parameters. Figure 4 (middle panel) shows that the phasic Montreal RWA values never exceed 70%. The Ikelos-RWA scores are higher than tonic Montreal or phasic Montreal since it includes both phasic and tonic events. However, Ikelos-RWA is not equal to the average of tonic and phasic Montreal scores, since there are activation time segments which are characterized as phasic-only or as tonic-only, which may overlap. In other words, the markers in the right-hand graph of Figure 4 would align on the dashed line if all activation events were tonic and phasic at the same time.
Determining the lowest EMG background activity is a critical point in this approach of RWA estimation, where the threshold of activation is two or four times the EMG background. Therefore, we chose to evaluate EMG background repeatedly across the recording, determining it for each individual REM episode, and providing warning messages as soon as it got out of range (0.3-5 µV). Our focus was to exclude time segments with gaps (eg, transient amplifier blocking due to artefacts), so EMG background was not allowed to be lower than 0.3 µV. In addition, very noisy REM episodes had to be discarded. This was achieved by including an upper limit in the EMG background value of 5 µV. Moreover, the envelope of the signal was used for the definition of EMG background, since the rapid changes in amplitude are not important in this regard. Finally, the investigation of the characteristics of the EMG signal in the frequency domain and the evaluation of the critical area around the power supply frequency excluded contaminated REM episodes, or even whole nights, from our analysis. Since our European lab uses 50 Hz power supply, this frequency was taken into consideration. In case of 60 Hz power supply environment, an extra implementation will be required.
An algorithm for automatic REM atonia scoring based on a similar time resolution as Ikelos-RWA, is the REM atonia index (RAI).13,14 This approach, while scoring REM time segments with atonia, is intrinsically complementary to Ikelos-RWA and all other RWA scoring methods, which by definition score the REM time segments without atonia. With RAI, bandpass filtered chin EMG signal is divided into 1-second mini-epochs and evaluated in a strictly quantitative approach. It represents the proportion of mini-epochs with average amplitude <1 μV over all mini-epochs in REM-sleep (with exception of mini-epochs with amplitude between 1 μV and 2 μV). The RAI could differentiate well between individuals with and without RBD, showing a sensitivity of 84% and specificity of 81% for a cut-off value of <0.8 with AUC of 0.83. 15 In contrast to RAI, Ikelos-RWA uses a flexible background threshold, in order to adjust for varying EMG background activity across successive REM-periods, as for instance may occur with slowly increasing electrode impedance and hence EMG background noise across the night, which is not uncommon.
Yang et al. 2020 had provided an algorithm partially using the Montreal RWA, but no comparison between algorithm and visual scoring was stated. 16 They used a fixed amplitude threshold of 10 μV to define tonic activity, and a combination of activation in mental and tibialis EMG to define phasic activity, without referencing the REM episode EMG background. Furthermore, they did not calculate the sum of mini-epochs with phasic activation but defined phasic epochs (epochs with more than 5 mini-epochs with phasic activation). This probably is the reason of lower AUC values compared to our results and those of McCarter 2014. 9
The presented algorithm can effectively and objectively provide RWA scores, as well as signal quality estimations per REM episode based on the EMG background, spectrum power control and excess of 500 μV EMG amplitudes. This gives the opportunity to assess results only from high quality signals, which will give more reliable RWA scores. In addition, it will raise warnings in case of (suspected) technical problems, giving the opportunity to the technicians to identify and resolve potential technical problems of the measurement setups. This could also be used to evaluate different devices. Our lab is determined to share this algorithm with the RBD research community.
Supplemental Material
sj-docx-1-eeg-10.1177_15500594231175320 - Supplemental material for Ikelos-RWA. Validation of an Automatic Tool to Quantify REM Sleep Without Atonia
Supplemental material, sj-docx-1-eeg-10.1177_15500594231175320 for Ikelos-RWA. Validation of an Automatic Tool to Quantify REM Sleep Without Atonia by Alexandra Papakonstantinou, Jannis Klemming, Martin Haberecht, Dieter Kunz and Frederik Bes in Clinical EEG and Neuroscience
Footnotes
Author Contribuitions
AP and JK contributed to conception and design, acquisition, analysis and interpretation, drafted the manuscript and gave final approval. MH contributed to acquisition and analysis, critically revised the manuscript and gave final approval. DK contributed to conception and design, critically revised the manuscript and gave final approval. FB contributed to conception and design, acquisition, analysis and interpretation, drafted and critically revised the manuscript and gave final approval.
Declaration of Conflicting Interests
The authors declared no potential conflicts of interest with respect to the research, authorship, and/or publication of this article.
Ethical Approval
The ethics committee of Charité – Universitätsmedizin Berlin approved publication of the results of the post hoc data analysis.
Funding
The authors received no financial support for the research, authorship, and/or publication of this article.
Supplemental Material
Supplemental material for this article is available online.
References
Supplementary Material
Please find the following supplemental material available below.
For Open Access articles published under a Creative Commons License, all supplemental material carries the same license as the article it is associated with.
For non-Open Access articles published, all supplemental material carries a non-exclusive license, and permission requests for re-use of supplemental material or any part of supplemental material shall be sent directly to the copyright owner as specified in the copyright notice associated with the article.
