The effect of baby Timo on my sleep
Looking at my time asleep pre and post the arrival of baby Timo.
How did our second child effect my sleep patterns?
On the 21st of October our second child, Timo, was born. When you have a child, one of the first comments people make is in the general vicinity of ‘I hope you are sleeping well’.
My wife though is fairly kind in that regard - as she was breast feeding Malia, our first child, she didnt wake me up for feedings. This combined with my usual catatonic slumber means I usually sleep through each night.
While my immunity to late night child care is in place during the infant stage, it unfortunately does not span into the post-breast feeding stage. So I expected that if there is a change in my sleep patterns, it’s more likely to occur when our latest family addition transitioned from waking for feeds, to waking due to nightmares, potty needs, etc. This lead me to ask the following questions:
The topic of this post: Did the birth of Timo have a meaningful impact on my sleep duration.
Topic of a future place as the event is still to come: Was the effect delayed till Timo transitioned to not having night feeds.
The source data
Within my Apple health data, I have 6 sources of data that record durations of sleep. Some are physical measurement devices like my Health Mate sleeping mat, my old fitbit, and my Apple Watch. Others are apps built on other data, like Autosleep. The clock and iPhone data appear to be based off proxies, like last time I use my phone at night and first time I use it in the morning.
The Withings Health Mate sleep mat was a relatively new purchase, that I set up ~2 months before Timo arrived. This device is a mat that lies under your mattress, and measures when you are in bed and when you are in bed asleep. It also claims to break your sleep up into REM, deep and light sleep. I read in blogs that the REM sleep estimation is algorithmic, and there was some controversy on these types of devices being able to measure deep vs light sleep meaningfully. So I will focus just on it’s ability to measure sleep vs awake.
If I jump straight to a box plot, looking pre and post Timo’s birth (stratified by weekday or weekend), it looks like there may be a small shift in my sleep duration after Timo’s birth.
Another issue that jumps out is the variance is pretty high - which makes sense, as I do have pretty random sleep patterns. If I happen to be doing something interesting, I can easily stay up to midnight or later. And then each day I a have a hard ‘alarm clock’ in the form of a 3 year old, who will jump on me between 7 to 7.30am if I’m still in bed.
Going a bit more granular though, a different pattern appears. If you look immediately before and after Timo’s birth (next plot), there looks to be little effect on the duration of sleep. What is likely influencing the box plot is a shift more than a month after Timo’s birth. I’m not 100% sure what that is driven by, some potential culprits are the decision to migrate my site from Jekyll to Hugo, a renewed interest in playing around CICD tools, and the general disruption of Xmas and New Years.
In the spirit of not being as dependent on R, and the fact I think the Python library Seaborn
has better looking Violin plots than what I’ve seen via R packages, I also
reticulate to make a variation on the earlier box plot.
‘Duration’ of sleep is not capturing the full picture though. The total time asleep each night could remain stable despite numerous late awakenings if I went to bed earlier and woke up later. So another metric I took from the data was times I ‘woke’ between going to bed and waking. Looking at the following plot - it looks like the times I wake may increase post Timo - but it also flags an issue with the data. The plot gives a rolling median of me ‘waking’ for more than 1 minute 2 times a night. I have no memory of this occuring. I could have finessed the data through some ‘cleaning’ (e.g. require a period of 10+ minutes awake) but I guess this flags some concerns on the accuracy of the data.
Based on the earlier exploratory plots, it appears there is no real evidence of Timo’s arrival impacting my sleeping patterns. I could do a formal hypothesis test, but then the raw data implies any observed effect would be defined by where I cut the data, due to a shift more than a month later (around new years) where my sleeping duration decreased.
When am I asleep?
As a post-hoc analysis, I was also interested when I’m asleep. As a simple way to represent the question, I took the sum of hours asleep for each day, divided by the total time observed for that hour. This gave a rough ‘probability’ I was asleep at any given moment.
I’m a little suspicious about me being awake ~30% of the time between midnight and 3am on a Friday night (Saturday morning), but this is most likely due to the random 1-10 minute waking periods, and the fact that in my code I summed awake at any point (so the real metric is closely to probability I’m awake for more than 1 minute during that hour).