# Sleep

A particular individual sometimes has difficulty falling asleep, and sometimes awakens during the night repeatedly or for significant amounts of time. Upon consulting a sleep doctor and having his sleep monitored, he was told told that his sleep patterns were characteristic of a normal sleeper who spends too much time in bed. The doctor's hypothesis is that a typical human needs a certain amount of sleep per night (which may vary across humans), so if the human is habitually given much more time in bed, they will just sleep less efficiently. The subject was instructed to keep a sleep log for several weeks, find the average amount of actual total sleep time (TST), add about half an hour, and that was the amount of time he should regularly spend in bed trying to sleep. Other factors may also be involved in sleep patterns and quality. Exercise is supposed to help with sleep. Alcohol is supposed to decrease the amount of time it takes to fall asleep, but also decrease the quality of sleep, leading to more frequent awakenings during the night. The subject's mother read somewhere that calcium-magnesium supplements taken at dinnertime are supposed to help one fall asleep faster and sleep better. Staying up later than typical may decrease the time to fall asleep. The quantity and/or quality of the previous night's sleep could affect the current night. The subject's sleep log, recorded over the course of several months (excluding trips out of town and the days immediately after returning). In this file, you will find the following variables:

• Date (recorded in the morning after arising)
• Bedtime (recorded as a four-digit number where the first two are the number of hours past noon and the last two are the number of minutes past that, e.g., a bedtime of 11:30PM is recorded as 1130, a bedtime of 1:05AM is recorded as 1305)
• Time To Sleep (TTS, the number of minutes it took to fall asleep)
• Total Sleep Time (TST, the total number of minutes spent asleep)
• Total Bed Time (TBT, the total number of minutes spent in bed attempting to sleep)
• Alc (an indicator for the consumption of alcohol later than the end of dinner)
• Cal (an indicator for the consumption of a calcium-magnesium supplement with dinner)
• Run (the number of miles run that day)

Of course, there may be measurement error in the TTS and TST variables, but since it's not clearly biased in either direction, ignore possible measurement errors for the sake of this problem.Questions:

1. According to the doctor, how much time (TBT) should the subject spending in bed trying to sleep?
2. Is the sleep doctor's hypothesis of a fixed amount of require sleep reasonable, given this dataset?
3. Do calcium-magnesium supplements help with either falling asleep or staying asleep during the night?
4. Do any other factors affect sleep patterns?

Source: Herbie Lee