About a year ago, for 70 days, I ran an experiment on myself to determine the effect of melatonin on my sleep. These are the results.

“Experimental” setup

Each day, at 10:30 PM, I used a random number generator to determine whether to take a 300 microgram melatonin pill or not. I then measured my sleep with my Amazfit Bip. On some days, I knew I would not be going to sleep anywhere close to 11 (this was the case on many weekends). On these days, I would wait to use the random number generator until I thought I would probably be able to go to sleep soon. Note that this isn't blinded, so there is no placebo control. So all the effects here might just be placebo, but in that case, I don't really care.


I ran several regression models. Each contained one control variable, which was the time that I flipped the random number generator. The models were as follows:

  1. Predicting melatonin’s effect on deep sleep time.
  2. Predicting melatonin’s effect on “after random” time. This is defined as the time between using the random number generator (and taking melatonin or not) and actually falling asleep.
  3. Predicting melatonin’s effect on total sleep time. This had “after random” time as a control variable.


  1. Taking melatonin did NOT affect the amount, or fraction, of deep sleep that I was getting.
  2. Taking melatonin is significantly related to how long it takes for me to go to sleep, by reducing “after random” time. I estimate that it caused me to fall asleep 37 minutes earlier on average (80% CI: 19-54; 95% CI: 10-64). This was probably due to two factors: first, the melatonin might have made me fall asleep faster once in my bed, and second, it may have made me more tired and get into bed earlier.
  3. Falling asleep earlier meant that I both slept longer and woke up earlier. Every minute earlier I fell asleep was associated with 0.66 minutes of additional total sleep (80% CI: 0.50-0.82; 95% CI: 0.41-0.9). By definition, this means that I woke up about 0.33 minutes earlier.
  4. The estimated total effect of taking melatonin was that it caused me to sleep 24 minutes longer, and wake up 13 minutes earlier.
  5. Melatonin did not have any other significant effects on my sleep.
  6. If I include only days when I took Melatonin at the “standard time” of 10:30 PM, it caused me to fall asleep 52 minutes earlier (80% CI: 31-74, 95% CI: 19-85). On these days, melatonin resulted in sleeping 26 minutes longer and waking up 26 minutes earlier.


Apparently, melatonin mostly causes me to sleep earlier, which causes me to wake up earlier and sleep longer. Is this good? Maybe. Sleeping longer would probably be good if I didn’t sleep enough, but I sleep 7.93 hours on average. Usually though, my time at night is not very valuable compared to morning time (here I am not counting the kind of days when I put off doing the random number generator). In addition, there is some evidence (though my f test violates every assumption) that melatonin reduced the variance of my sleep onset time, and sleep time consistency has been shown to be important.

So, I think I’ll continue to take melatonin a bit before I want to go to bed, if only because it seems to make it more likely that I’ll actually go to bed at that time.