Sleep

Predicting sleep state from continuous positive airway pressure flow in patients with obstructive sleep apnea.

TL;DR

Epoch-by-epoch sleep and wake can be effectively predicted by a machine learning model using CPAP flow signals and demographics, with overall accuracy of 0.82 and Cohen's Kappa of 0.51, which may complement usage data from CPAP devices to better assess CPAP effectiveness.

Key Findings

A machine learning algorithm using CPAP flow signals and demographic data predicted sleep vs. wake states with an overall accuracy of 0.82 and Cohen's Kappa of 0.51.

  • The model was trained on 69,520 epochs (74% sleep) and tested on 19,124 epochs (76% sleep)
  • 130 total features were used: 126 derived from CPAP flow data, plus age, sex, BMI, and CPAP level
  • Data came from 100 adult OSA patients undergoing CPAP titration at Yale Sleep Center (n=70 training, n=30 testing)
  • Sleep stages were scored by AASM-certified technologists using polysomnography records
  • No significant differences were found between training and test samples in demographic or clinical characteristics

The model demonstrated high sensitivity and positive predictive value for detecting sleep epochs, but lower performance for detecting wake epochs.

  • Sensitivity for sleep was 86.4% and PPV for sleep was 89.0%
  • Sensitivity for wake was 66.4% and PPV for wake was 60.7%
  • The dataset contained a higher proportion of sleep epochs (74% in training, 76% in testing), which likely contributed to the asymmetry in performance between sleep and wake detection

The study population consisted of adult OSA patients with a median age of 61 years, elevated BMI, and well-controlled residual apnea during CPAP titration.

  • The dataset included 48 women and 52 men
  • Median (interquartile range) age was 61 (46.3–69.0) years
  • Median BMI was 33.8 (27.8–39.6) kg/m2
  • Median residual apnea-hypopnea index was 3.0 (1.0–6.0) events/hour during CPAP titration

Current CPAP adherence monitoring measures only hours of mask usage per night, which does not distinguish whether patients are actually sleeping while wearing the mask.

  • CPAP adherence is assessed by hours of mask usage per night as the standard clinical metric
  • The authors aimed to predict sleep from CPAP flow signals to determine whether patients using CPAP are sleeping while wearing their mask and thus may benefit from therapy
  • The authors propose that sleep state prediction may complement usage data from CPAP devices to better assess CPAP effectiveness

The authors concluded that epoch-by-epoch sleep and wake prediction from CPAP flow data is feasible and could improve assessment of CPAP effectiveness beyond simple mask-on time.

  • The model predicted sleep states at the epoch level (epoch-by-epoch) rather than as a summary measure
  • The approach uses only data already available from CPAP devices (flow signals) plus basic demographics, requiring no additional sensors
  • The authors suggest this information may complement existing CPAP usage data to better assess whether patients are benefiting from therapy

What This Means

This research suggests that it is possible to determine whether a person is actually asleep or awake while wearing their CPAP mask by analyzing the airflow patterns recorded by the CPAP device itself. Currently, CPAP compliance is measured only by how many hours per night a patient wears the mask—but wearing the mask does not necessarily mean the patient is sleeping. Using data from 100 sleep apnea patients who underwent overnight sleep studies at Yale Sleep Center, the researchers developed a computer algorithm that analyzed 126 features extracted from CPAP airflow signals, combined with the patient's age, sex, BMI, and CPAP pressure level, to predict whether each 30-second segment of the night was sleep or wakefulness. The algorithm achieved an overall accuracy of 82% and was particularly good at identifying sleep segments (detecting 86.4% of actual sleep epochs correctly), though it was less accurate at identifying wake segments (detecting 66.4% of actual wake epochs). This gap in performance is partly explained by the fact that most of the recorded time was spent asleep, giving the model more examples of sleep to learn from. The agreement between the algorithm and human-scored sleep studies, measured by Cohen's Kappa of 0.51, reflects moderate-to-good agreement. This research suggests that CPAP machines—which are already in millions of patients' homes—could potentially provide richer information about sleep beyond just mask-wearing time. If a patient wears their CPAP for 7 hours but is actually awake for much of that time, the current system would count that as good adherence even though the patient is not benefiting from therapy. A sleep-detection algorithm like this one could help clinicians better understand whether patients are truly getting effective treatment, and could eventually help identify those who may need additional support or alternative interventions.

Check Your Own Numbers

Upload your bloodwork. We'll cross-reference your results against this study and 4,700 others.

Upload Your Labs

Have a question about this study?

Citation

Ahsan M, Chen H, Chen C, Anwar A, Tolbert T, Rapoport D, et al.. (2026). Predicting sleep state from continuous positive airway pressure flow in patients with obstructive sleep apnea.. Sleep medicine. https://doi.org/10.1016/j.sleep.2026.109044