discovery about my sleep
Apr. 5th, 2012 06:09 pmI just made a big discovery from my sleep dataset (93 nights): my "Time in REM sleep" has a strong autocorrelation, i.e. I have streaks of high REM sleep nights, and low REM sleep nights.
Here are some statistics, 1-day auto-correlations for different quantities:
The data also suggests that 'Time in Deep' has a significant autocorrelation, but not as strong as 'Time in REM'.
Here's a time series of 'Time in REM':


The natural scientific question is: what factors predict (or better, cause) periods of high REM sleep? I've computed a tiredness variable, as an exponential moving average of 'Total Sleep Time' (or 'ZQ'), and it suggests that the more tired I am, the less REM sleep I will have... but this effect is estimated at 0.216, which is more modest than the autocorrelation in REM Sleep, so it could be due to confounding (i.e. I am most tired when my previous night's REM Sleep was low, which predicts the next night's REM Sleep also being low).
Note that ZQ is defined as a linear combination of the different phases of sleep, so it's not all that surprising that it seems to have some degree of autocorrelation. If Z=X+Y, can we decompose autocorrelation(Z) into components?
Here are some statistics, 1-day auto-correlations for different quantities:
| rho-hat | CI | p-value | |
| Total Sleep time | [-0.213, 0.197] | ||
| ZQ | 0.22 | [0.0114, 0.4028] | 3.8e-02 |
| Time in Deep | 0.29 | [0.0915, 0.4678] | 4.9e-03 |
| Time in REM | 0.43 | [0.247, 0.584] | 1.87e-05 |
| Time in Light | [-0.243, 0.166] |
The data also suggests that 'Time in Deep' has a significant autocorrelation, but not as strong as 'Time in REM'.
Here's a time series of 'Time in REM':

In the above plot, we see that I had a streak of 6 days in my top quartile, and a streak of 7 days in my bottom quartile... which would be unlikely without autocorrelation.
For comparison, see a series of 'Total sleep' (the really bad nights correspond to a nasty strep infection I had earlier this year):

The natural scientific question is: what factors predict (or better, cause) periods of high REM sleep? I've computed a tiredness variable, as an exponential moving average of 'Total Sleep Time' (or 'ZQ'), and it suggests that the more tired I am, the less REM sleep I will have... but this effect is estimated at 0.216, which is more modest than the autocorrelation in REM Sleep, so it could be due to confounding (i.e. I am most tired when my previous night's REM Sleep was low, which predicts the next night's REM Sleep also being low).
Note that ZQ is defined as a linear combination of the different phases of sleep, so it's not all that surprising that it seems to have some degree of autocorrelation. If Z=X+Y, can we decompose autocorrelation(Z) into components?
> summary(lm(ZQ~Time.in.Deep+Time.in.Light+Time.in.REM+Time.in.Wake, data=data))
Call:
lm(formula = ZQ ~ Time.in.Deep + Time.in.Light + Time.in.REM +
Time.in.Wake, data = data)
Residuals:
Min 1Q Median 3Q Max
-2.84975 -0.40340 0.02977 0.44843 1.54020
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) -1.100742 0.425614 -2.586 0.0113 *
Time.in.Deep 0.356660 0.003818 93.417 <2e-16 ***
Time.in.Light 0.140365 0.001582 88.715 <2e-16 ***
Time.in.REM 0.211570 0.002877 73.549 <2e-16 ***
Time.in.Wake -0.087905 0.003943 -22.292 <2e-16 ***
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 0.8444 on 88 degrees of freedom
Multiple R-squared: 0.9983, Adjusted R-squared: 0.9982
F-statistic: 1.271e+04 on 4 and 88 DF, p-value: < 2.2e-16