Cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Sleep efficiency formula used by Fitbit API

We are currently using Fitbit API to integrate our users' Fitbit data into our system. Currently, we are developing a sleep efficiency tracker. As part of that, we need to understand how Fitbit is calculating the sleep efficiency score. 

 

I have searched far and wide but all I have found are speculative posts on the Fitbit Community forums, with no actual confirmation about the formula used, or any official articles which clearly state how the sleep efficiency score is calculated.

 

The most likely candidates I found were the following two formulas. But can anyone point me to some official documentation that discusses this? Or can someone from the Fitbit team please confirm/deny if this is how the sleep efficiency score is calculated? I would assume this is basic information which should be understood by our developers in order to properly integrate that score into our system.

 

  1. time asleep/time asleep + time restless/awake * 100
  2. minutesAsleep / (timeInBed - minutesToFallAsleep - minutesAfterWakeup)
Best Answer
0 Votes
6 REPLIES 6

Sorry, we don't publish how the score is calculated.

Best Answer
0 Votes

Hello. Could you provide an overall indication of how sleep efficiency is calculated without sharing the formula? I know it's generally time asleep divided by time in bed. But I'm trying to get a sense of whether the time it takes to initially fall asleep is considered part of the denominator or if it's excluded altogether.

Best Answer
0 Votes

I just did some research on my exports (which date back to 2014) and confirmed that the old Sleep Efficiency score that used to be included in the export can be calculated as follows, per other values that are still included in the export:

Efficency % = minutesAsleep / (minutesAsleep + minutesAwake)

 

To match the old "score" exactly, multiple the above by 100 and round to the nearest integer. Personally, I find that I get more useful data by rounding to one decimal place since the values all cluster so tightly on a day-to-day basis.

Best Answer

Can anybody decipher these results, 3consecutive days, please?

0BEF2202-5D9D-4B46-9177-D55C8F4FD433.jpeg

Best Answer
0 Votes

This website gives you some detail, but Fitbit won't release the actual algorithm. 

 

Alternatively, if you have Excel or any standard statistical package (SAS, STATA, R, Python), you could simply run a regression analysis to get an approximation of the coefficients that they use (i.e., the formula).  It's most likely a linear regression, something like Score = B0 + B1(time asleep) + B2(time light sleep) + B3(time deep sleep) + B4(time REM sleep) + B5(time awake).  They could also have used percentages for all of the above and included on more term for total minutes asleep (or total minutes asleep + awake).  

Best Answer
0 Votes

That is fine. But why don't expose the score to the devs? I would really like to understand this decision. Thanks!

Best Answer
0 Votes