As a data scientist and someone who loves to exercise I decided to combine my love for both and analyze my fitbit data to see if I could find any insights about my exercise habits.
To download my fitbit data for a year 2017 september to 2018 september I had to use the Export tool from the Fitbit website https://www.fitbit.com/settings/data/export. This allows you to request all the data fitbit records for you including every heart BPM, steps taken, active minutes and sleep. The request export can take a good amount of time so you might need to wait a bit. The data comes in JSON files and is super granular. Some data cleansing needs to be done to make the JSON data in a tabular format. All the JSON files are downloaded and then the processed csv tabular files are stored in the process folder.
I process the data using the python script scripts/clean_fitbit_data.py
. This converts all the JSON files into tabular data and aggregates the data by day instead of hour to make the data more manageable.
The first step at understanding my data was to do some basic EDA (Exploratory Data Analysis) to understand which days I exercise the most, which days I sleep the most and etc. This is done using the python script scripts/fitbit_analysis.py
.
A more robust statistical analysis was done using R because the package support for statistical modules is more fleshed out in R. I wanted to investigate several relationships using a more causal framework.
- If I slept more than 7 hours, then was I more likely to reach my step goal for that day?
- If I slept more than 7 hours, then was I more likely to achieve my active minutes goal for that day?
- If I slept more than 7 hours the previous night, then was I more likely to exercise/workout the next day.
The conclusions from analyzing my fitbit data is that I am more predictable than I thought. I am more likely to stick to a strict schedule for exercise and workout during the weekends (this was a significant variable) and Monday was the day I was most likely to workout during the week. I am more likely to sleep more on the weekends and get better sleep (eg more deep sleep). I am more likely to meet my step goal on the weekends compared to the week.