My Year of Sleep

(Updated 2nd August 2013.)

I have trouble getting to sleep before about 3am. The reasons for this are both contentious and boring, but obviously, falling asleep at 3am isn’t compatible with most of the things people like to get done in our society, unless you want to be doing them after less than five hours sleep. Because people often make suggestions about how I could get to sleep earlier, and because I am a gigantic, tragic nerd, I started collecting information about my sleeping patterns about a year ago. The graph below shows the variation in the time I fall asleep. It ranges between a 11.45pm and 8am (excluding the one outlier at 10pm, when I was sick). 50% of the time, it’s between 1.45am and 4am, with an average of 3am.


The aim of the data collection was to work out which modifiable factors have a significant impact on the time I fall asleep, and how profound any impact is. Part of this was certainly the spite of a chronic insomniac wanting a justification to tell anybody who says, “Hurr, durr, just get up earlier” where to stick it, but also because I wanted to check whether my intuitions about what makes a difference were at all accurate. There have been times when I was travelling or got lazy that I don’t have data for, so after a year, I have complete information on about 170 nights, and the following variables, all of which are supposed to affect sleep:

  • Caffeine (yes or no; before or after 2pm)
  • Exercise (yes or no)
  • Alcohol, ie, did I stay out until 3am like an eejut (yes or no)
  • Vitamin D (yes or no)
  • Melatonin (yes or no; dose)
  • Employment type (one was 9 to 5, one was 12pm – 5pm, baseline is unemployed or working from home)
  • Hours sleep the previous night
  • Time I woke up that day

The results are as follows. If you understand the table, you can skip the three paragraphs directly underneath it.

Screen Shot 2013-08-02 at 12.44.52 PM

The second column is the “point estimate”, that is the estimated time, in minutes, that a “yes” or a one unit increase in the amount of the variable (ie hours of sleep the night before) adds to the time I fall asleep. A negative sign before that number means I fall asleep earlier if the answer is “yes” or the amount of the thing increases. The p value in the third column is the strength of the correlation – the smaller the number, the stronger the association between changes in that variable and changes in the time I fall asleep (generally we scienticians say that <0.05 is moderate, <0.01 is strong, and <0.001 is very strong). Variables in bold are the ones the computer thinks have at least a moderate relationship with the time I fall asleep.

The columns to the far right are the 95% confidence intervals, that is the range of values the computer thinks the “true” value of its point estimate probably lies within, as the estimate itself may not be perfectly accurate – for example, the computer has calculated that caffeine after 2pm adds an average of 76 minutes to the time I fall asleep, but it could be as many as 115 minutes or as few as 36 minutes. Based on the information it’s been given, the computer thinks it’s almost certainly somewhere within that range. The closer these two values are to one another, the more confident the computer is about its point estimate of the impact of that variable. I’ve only included point estimates and confidence intervals for variables the computer thought had a strong association with the time I fall asleep (because calculating them from the output my stats program gives me is annoying!).

The other thing to note is that each point estimate accounts for the impact of changes in the other variables. So for example if I’ve had eight hours asleep, waking up at 9am instead of 10am might make me fall asleep 10 minutes earlier. But if I’ve woken up at 10am, having seven hours sleep instead of eight apparently makes no difference – the time I wake up is more important than the time I fall asleep. The variables with more than two “types” are both compared to a baseline value of “none” – so the higher dose of melatonin subtracts 77 minutes relative to no melatonin, not relative to the lower dose.

Welcome back, table-understanders. The thing that leaps out at me from here is that the point estimate for waking up earlier, per hour, is not one. That is, waking up one hour earlier does not mean I fall asleep one hour earlier, and in fact, to fall asleep one hour earlier, I’d apparently have to get up six hours earlier, with a net loss of five hours sleep in the morning to gain one hour extra at night. I’m not sure if that’s normal or not, I’d be curious to hear from say, a shift worker, as to whether they think it happens to them as well. If the average person started waking up at 2am instead of 7am, would they eventually adjust and start falling asleep at 6pm instead of 11pm? Or will our internal clocks only allow us to move so far?

Beyond direct effects of the previous night’s sleep, either dose of melatonin moves me about an hour and a quarter backwards, which is substantial. Caffeine adds 45min if I have it before 2pm, and an hour and a quarter if I have it after 2pm.  Alcohol is really just in there to prevent it confusing the other results – I obviously can’t fall asleep at 1am if I’m socialising until 3am. Working 9 to 5 three days a week was clearly not great, which I could definitely have told you at the time. I was getting up at 7am some days and sleeping in until 2pm others in an attempt to catch up, which was disastrous.

Following on from the job variable, I created a variable a few months ago which is a measure of the variation in the times I’d woken up over the previous week, as getting up at the same time each day is supposed to help. Because of my patchy record keeping, though, I’ve only got it for 170 nights, which drops the total number of nights available to the program from 173 to 122 (it has to drop any nights missing any data on any variable). At this stage there’s no significant association between it and the time I fall asleep, but that might change with more data.

There are other limitations of the dataset at present. Some variables have ended up with really unbalanced numbers of observations – for example I have 236 days with caffeine (134 <2pm; 66 >2pm), and only 35 without – and that makes the estimates of the effects less certain than they would otherwise be. It seems unlikely to me that the time I have it is actually irrelevant, but the way I’ve recorded it doesn’t allow the computer to distinguish between 7am and 1pm, or 2.30pm and 8pm. In reality I would normally only drink coffee between 11am and 3pm anyway, so I guess it doesn’t really matter. I am going to try to pad out the number of days without it, though, and see what happens.

Modafinil is a drug I was prescribed to help with daytime fatigue that apparently, theoretically, allegedly, doesn’t disturb sleep. Whatever you say, Doc. Seth Roberts has blogged about vitamin D supplementation improving his sleep. I haven’t found that, although having taken enough to change my status from deficient to non-deficient, I definitely feel less tired during the day than I did before I was taking high doses.

“Exercise” is necessarily crude, because there’s no easy way to accurately quantify the effect of type, time or intensity. So far I’ve been scoring walking and swimming as “1” and more intensive things (interval training, weights, diving) as “2” in a separate variable, but doing this retrospectively makes me worry about the accuracy, so I’ve left it as yes or no in this analysis. I do suspect that intense exercise helps, but I might need more consistent data in future to look at that properly.

So, in summary, melatonin definitely helps, caffeine definitely doesn’t, and modafinil is an unholy disaster. Vitamin D doesn’t appear to make a difference, and exercise may or may not, but my difficulty in coding it might be causing some confusion. 

This entry was posted in health, statistics and tagged , , , , . Bookmark the permalink.

5 Responses to My Year of Sleep

  1. Paul Kittson says:

    Awesome project Katherine. Now that you have that knowledge is that enough to change your behaviour or is it at least reassuring to know that you have some control over the factors that influence your sleep?
    I can see from your graph how you plotted the time it took to get to sleep but how did you manage to track so many different variables at once, was this using excel or a different program?
    Finally I was doing a little sleep tracking myself using android apps and one thing i noticed that made a big difference was wearing a simple facemask over my eyes, they only cost 2 dollars and it they can really help.

    • 80power says:

      Cheers Paul. I’m definitely planning to increase my exercise, that’s something I’d already noticed made a difference (I used to teach scuba and slept a lot better doing that kind of physical work instead of having a desk job). I’m still in two minds about coffee, to be honest, but I will probably start skipping at least some days.

      I’m using a program called Stata, which is a stats program that’s primarily for biostatistics and other medical applications. It looks quite similar to excel (the data entry side is just a giant table), but it’s able to do more complex stats analyses more easily than Excel can.

      The sleep mask thing is interesting, I actually sleep with the curtains open so I get the morning light, which I think makes it a little easier to get up in the morning, but I guess it depends what you’re trying to modify exactly. I’ve found I sleep a bit more soundly with ear plugs in, for instance.

  2. Pingback: My Year of Sleep: Update | 80% Power

  3. Lars says:

    Something I forgot to ask about but meant to: exposure to light in the evening? A lot of people use f.lux ( to reduce the blue light from their monitor, when they use devices into the evening, so as not to disrupt their natural rhythm. Also, coding your activity around midnight into a shortlist of categories (on a computer / seeing people / …) would be a natural next step, if you still have the energy to keep measuring this part of your life.

    • 80% Power says:

      Hi Lars,

      I definitely think light is a factor – I notice a significant improvement when I’m camping. Camping normally involves either hiking or diving, so it could just be the exercise, but I think the light is a factor. I do use f.lux, I can’t say I think it makes a big difference. I also try only to have lamps on after the sun goes down, although I’m not super consistent about it. I’ve made a variable in the dataset for it, but it’s hard to be really accurate with it if it’s just binary, since I don’t always turn the overhead light off at the same time each evening. Making a more comprehensive variable for evening activity is an interesting idea, I might give that a go. I plan to keep tracking it indefinitely, I really don’t feel like the dataset is complete at this stage.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s