October 31, 2019 3:00 PM

A Consumer Sleep Tracker Researchers Can Actually Use

It’s hard to know if wearable devices give accurate sleep reports, so experts validated their own algorithm to score sleep using the Apple watch.

Sleep track image


Sleep trackers are exciting for people who want to analyze their ZZZs night after night, but frustrating for scientists who desperately want to use them to further the field of sleep medicine.

So far, wearables have held promise, but not results, when it comes to research or to patient care. Companies don’t share how they score sleep, nor do they publish the kind of rigorous research a sleep medicine expert would want to review to determine if they can trust the sleep report given.

“The manufacturers don’t compare the output of their device to the gold standard, polysomnography, to determine if their products are accurate,” says Cathy Goldstein, M.D., M.S., an associate professor of neurology at Michigan Medicine and a physician in its Sleep Disorders Centers.

And in the few studies where researchers have compared the output of a consumer sleep tracker to polysomnography, the results became somewhat irrelevant once a device was replaced by a newer model or the app associated with the device was updated because manufacturers don’t disclose their sleep estimation methods.

But because so many people own them, it makes sense to figure out how to use consumer wearables to improve sleep health, say Michigan Medicine researchers.

Getting ahead

To get ahead of the outdated technology cycle, Goldstein and colleagues published a paper describing a new open-source algorithm that tracks slumber using heart rate and acceleration in the journal Sleep.

“We sent patients into the sleep laboratory for an overnight sleep study, wearing Apple watches, and used that data to develop our own algorithm to analyze acceleration and heart rate signal from the watch to estimate sleep,” she said.

The design, when applied to signals from the Apple Watch, exceeded previously reported performance of the more expensive, medical, wrist-worn sleep tracker known as actigraphy.


That means the University of Michigan algorithm makes it feasible to use an off-the shelf consumer wearable device to track sleep for research or patient care in a more transparent, scientifically rigorous way than the popular apps associated with consumer sleep trackers that use trade secret methods.

The new algorithm differentiated sleep from wake with an accuracy of 90% in the 31 patients studied. In keeping with trends in other sleep tracking research, the algorithm showed higher sensitivity (93%) than specificity (60%), meaning it detected about 93% of sleep correctly but sometimes misclassified wakefulness as sleep. This is not uncommon with sleep estimation methods that use movement as people might lie in stillness when awake, Goldstein says.

Researchers then tested their design again on a large dataset that collected motion and heart rate data alongside polysomnogram in an older population (a 188 patient subsample of subjects enrolled in the Multi-Ethnic Study of Atherosclerosis), and found they could successfully predict sleep comparable to the performance on their own study subjects.

“We think this is really disruptive work,” says Goldstein, the study’s senior author. “If manufacturers open access to the raw signal acquired by their devices, validated algorithms like ours can be used to estimate sleep from that data.”

“Other fields have adopted over-the-counter tools to augment their practice (think pregnancy tests and glucose monitors) and it’s time the sleep field find a way to do this as well, while maintaining accuracy and transparency,” she says.

"In the future, we’ll use self-tracking as part of precision medicine; we just have to find the right ways to adopt it, and we’re getting closer with advances like this validated sleep tracking algorithm."
Cathy Goldstein, M.D., M.S.

Prioritizing open source and longevity

To make wearables more useful for research, Goldstein says it was important to create a way to track sleep that anyone could use, and one that won’t become outdated.

“Every time a device changes its hardware or software, you need a new validation study, and by the time you finish that validation study, there might be a new version of the device on the market,” says lead author Olivia Walch, Ph.D., a post-doctoral research fellow in neurology, who built the algorithm using machine learning.

Apple doesn’t offer a native sleep tracking feature on its smartwatch, but researchers picked the Apple watch in creating this algorithm because it’s possible to access raw data from your Apple device.

The Apple watch has an accelerometer and also tracks heart rate with an optical method (what most sleep trackers use). The researcher can source those measurements from whatever device is taking them, so the method doesn’t depend on the specific device, Walch says.

Walch’s algorithm is a research prototype, so it isn’t currently available for download on the app store. But Walch says anyone can use this open-source formula to reproduce and improve upon the work across different patient populations.

An activity of the worried well?

Sleep tracking may be the latest medical application for smart watches, but it follows some concern from medical experts about the implications of constant monitoring.

For example, cardiologists have questioned whether tracking every heartbeat with a smart device is helpful. For people without known risk factors, it could lead to unnecessary stress and medical tests – and an ECG on a smart watch isn’t a guarantee that someone’s heart rhythm condition will be detected, either.

 “We’ve never had the capability to measure sleep from night to night, over the long term, so it’s hard to know what the relevance is in someone who’s feeling good,” Goldstein says.

MORE FROM THE LAB: Subscribe to our weekly newsletter

And when you know every detail about your performance, you can become obsessed with getting that perfect night of sleep. For some, the obsession can harm instead of help the quality of their sleep.

“Some people have developed orthosomnia, where they became overly focused on the output of their devices,” Goldstein says. “These people develop more insomnia and more anxiety because of their hyperfocus on a measure that may not be accurate. It’s important to remember that everyone has bad nights of sleep once in a while.”

Interesting today; useful tomorrow

Goldstein says the main utility in sleep trackers today is the ability to look at trends over time, rather than diagnose a sleep disorder.

For example, she notes, people may notice how their wearable reports their sleep quality and duration as they lose weight, or on the nights after they consumed caffeine or alcohol.

“It’s helpful when someone notices sleep disruption on their device and it prompts them to seek care when they wouldn’t have otherwise,” Goldstein says. Then, the physician and patient can explore symptoms and make decisions together.

“In the future, we’ll use self-tracking as part of precision medicine; we just have to find the right ways to adopt it. We’re getting closer with advances like this validated sleep tracking algorithm that could be device agnostic, provided manufacturers let us access motion and heart rate data.”

Code to access the accelerometer and heart rate data in the Apple Watch available at https://github.com/ojwalch/sleep_accel. Code used to perform the analysis is available at https://github.com/ojwalch/sleep_classifiers.

Paper cited: “Sleep stage prediction with raw acceleration and photoplethysmography heart rate data derived from a consumer wearable device”, Sleep. DOI: 10.1093/sleep/zsz180

Additional authors on the paper include Yitong Huang, of Dartmouth College; Daniel Forger, of the University of Michigan.