How Can a Wellness Technology Company Play It Smart?
Bellabeat, a wellness technology company, focuses on manufacturing smart, health-focused products for women. The company has a range of smart devices that track fitness, sleep, hydration, and stress. Bellabeat, while already successful, is exploring ways to grow in the competitive smart device market. Their products include the Bellabeat app, the Leaf wellness tracker, the Time watch, the Spring water bottle, and a subscription-based membership program offering personalized health advice.
The company heavily invests in digital marketing through platforms such as Google Search, Facebook, Instagram, YouTube, and the Google Display Network, along with running traditional media campaigns.
Bellabeat’s Chief Creative Officer, Urška Sršen, has tasked the marketing analytics team to analyze data from smart device usage in order to identify trends that will guide Bellabeat's marketing strategy and drive growth.
The objective is to conduct an in-depth analysis of smart device usage data, specifically from non-Bellabeat devices, to uncover user behavior and usage patterns. By analyzing this data, the aim is to generate insights that can be applied to Bellabeat products to enhance user engagement and inform future marketing strategies. The data will help identify potential opportunities for Bellabeat to optimize its digital marketing efforts, improve product positioning, and develop targeted campaigns based on customer behavior.
The key deliverable is to present these findings and high-level recommendations to the Bellabeat executive team. These recommendations should demonstrate how the identified trends can be leveraged to influence marketing strategies, drive customer engagement, and ultimately improve sales of Bellabeat’s smart devices and subscriptions.
What trends in smart device usage can we identify?
Trends such as peak activity hours, correlations between sleep and activity, hydration patterns, and how these behaviors vary across user segments (e.g., age, gender, activity level) need to be examined.
How can these trends apply to Bellabeat customers?
By understanding customer behavior, Bellabeat can develop personalized experiences, create fitness challenges, sleep optimization recommendations, or hydration tracking goals that resonate with their audience.
How can these trends influence Bellabeat's marketing strategy?
The trends can guide Bellabeat to fine-tune its digital marketing campaigns by focusing on users’ high-engagement times (e.g., morning routines for hydration or fitness), promoting relevant features to different customer segments, and leveraging social media campaigns to target customer needs in real-time.
Urška Sršen – Cofounder and Chief Creative Officer, Bellabeat.
Sando Mur – Cofounder and Mathematician, key decision-maker.
Bellabeat Marketing Analytics Team – Responsible for implementing and analyzing data-driven marketing strategies.
The data used for this analysis is the FitBit Fitness Tracker Dataset from Kaggle, made available through Mobius. This dataset includes personal fitness tracker data from 30 FitBit users who consented to share their personal activity and sleep data, recorded from March to May 2016. The dataset includes detailed minute-level outputs for physical activity, heart rate, sleep, and other wellness metrics.
Dataset Link: FitBit Fitness Tracker Data - Kaggle
The dataset is organized in long format across 18 CSV files, each capturing different aspects of daily activity, heart rate, and sleep patterns.
Key CSV files include:
dailyActivity_merged.csv: Summarizes daily steps, distances, activity intensity, and calories burned.
sleepDay_merged.csv: Tracks sleep records including total time asleep and time in bed.
hourlyCalories_merged.csv: Provides calorie burn data at an hourly level.
heartrate_seconds_merged.csv: Captures second-level heart rate data.
Reliability:
LOW: The data is collected from only 30 users, which is a relatively small sample size. While sufficient for exploratory analysis, it does not represent a diverse or large population. More user data would increase confidence in the insights.
Originality:
LOW: The data was collected via Amazon Mechanical Turk, a third-party service. Although the users consented to the use of their data, it was not directly collected by Bellabeat, which limits control over data collection methods.
Comprehensive:
MEDIUM: The dataset covers various metrics, such as steps, calories, activity intensity, and sleep. However, it lacks demographic data (age, gender, lifestyle), which limits the ability to segment users and customize marketing strategies effectively.
Current:
LOW: The dataset was collected in 2016. As technology and wellness habits have likely evolved since then, the data may not fully represent current user behavior or preferences.
Cited:
LOW: The source of data is not Bellabeat, which limits its direct applicability and raises questions about its citation.
Downloaded and Stored the Data:
The dataset has been downloaded from Kaggle and stored in a secure folder for analysis. The 18 CSV files are stored in their original format.
Data Organization:
The dataset is organized in long format, where each entry represents a unique observation. For example, each row in the dailyActivity_merged.csv file corresponds to a user's activity on a given day.
Sorting and Filtering:
To prepare the data for analysis, data was cleaned to remove duplicates, incorrect entries, and rows with missing values.
The data was grouped by Id and ActivityDate to ensure consistency across daily activity and sleep metrics.
Determined Data Credibility:
Although the dataset provides valuable insights, the limitations of sample size and outdated data have been considered when preparing the data for analysis. Additional data sources may be required to validate findings
BigQuery: A powerful cloud-based SQL platform was used for data cleaning, transformation, and querying due to its ability to handle large datasets efficiently and run complex queries.
Spreadsheets (Google Sheets/Excel): After running the queries in BigQuery, results can be exported to spreadsheets for further data manipulation, summary statistics, or creating visuals.
Tableau: For advanced visualization, Tableau can be utilized after data processing to generate interactive dashboards that present trends and insights clearly.
Data validation is crucial for ensuring the integrity of the data before analysis. I validated key columns (e.g., Id, ActivityDate) and checked date-time formats using regular expressions.
Key Query:
SELECT ActivityDate,
REGEXP_CONTAINS(STRING(ActivityDate), r'^\d{4}-\d{1,2}-\d{1,2}') AS valid_date
FROM `data-analytics-cert-435119.fitbit.dailyActivity_merged`
LIMIT 5;
Purpose: Ensure that the ActivityDate follows a valid date format
Checking if Id exists in all tables:
SELECT table_name,
SUM(CASE WHEN column_name = 'Id' THEN 1 ELSE 0 END) AS has_id_column
FROM `data-analytics-cert-435119.fitbit.INFORMATION_SCHEMA.COLUMNS`
GROUP BY table_name
ORDER BY 1;
Purpose: To ensure the Id column exists in every relevant table for later joins.
After ensuring that the data is valid, I performed cleaning operations such as removing duplicates, handling missing values, and aligning datasets for merging.
Duplicate Removal: I removed duplicates in sleep logs based on Id and SleepDay.
Missing Values: I used COALESCE to handle null values where necessary during joins.
Next, I transformed the data to analyze user activity and intensity levels based on the time of day and day of the week. By grouping data at the person level, I smoothed over anomalous days and calculated aggregate metrics such as total intensity, average intensity, and intensity deciles.
The following query categorizes each activity into specific time intervals (morning, afternoon, evening, and night), and segments data by the day of the week (weekend vs. weekday). It calculates both total and average intensity per time period.
WITH user_dow_summary AS (
SELECT
Id,
FORMAT_TIMESTAMP("%w", ActivityHour) AS dow_number,
FORMAT_TIMESTAMP("%A", ActivityHour) AS day_of_week,
CASE
WHEN FORMAT_TIMESTAMP("%A", ActivityHour) IN ("Sunday", "Saturday") THEN "Weekend"
WHEN FORMAT_TIMESTAMP("%A", ActivityHour) NOT IN ("Sunday", "Saturday") THEN "Weekday"
ELSE "ERROR"
END AS part_of_week,
CASE
-- Morning: 6:00 AM - 12:00 PM
WHEN TIME(ActivityHour) BETWEEN TIME(6, 0, 0) AND TIME(12, 0, 0) THEN "Morning"
-- Afternoon: 12:00 PM - 6:00 PM
WHEN TIME(ActivityHour) BETWEEN TIME(12, 0, 0) AND TIME(18, 0, 0) THEN "Afternoon"
-- Evening: 6:00 PM - 9:00 PM
WHEN TIME(ActivityHour) BETWEEN TIME(18, 0, 0) AND TIME(21, 0, 0) THEN "Evening"
-- Night: After 9:00 PM or before 6:00 AM
WHEN TIME(ActivityHour) >= TIME(21, 0, 0) OR TIME(TIMESTAMP_TRUNC(ActivityHour, MINUTE)) <= TIME(6, 0, 0) THEN "Night"
ELSE "ERROR"
END AS time_of_day,
SUM(TotalIntensity) AS total_intensity,
SUM(AverageIntensity) AS total_average_intensity,
AVG(AverageIntensity) AS average_intensity,
MAX(AverageIntensity) AS max_intensity,
MIN(AverageIntensity) AS min_intensity
FROM
`data-analytics-cert-435119.fitbit.hourlyIntensities_merged`
GROUP BY
1, 2, 3, 4, 5
),
intensity_deciles AS (
SELECT
DISTINCT dow_number,
part_of_week,
day_of_week,
time_of_day,
ROUND(PERCENTILE_CONT(total_intensity, 0.1) OVER (PARTITION BY dow_number, part_of_week, day_of_week, time_of_day), 4) AS total_intensity_first_decile,
ROUND(PERCENTILE_CONT(total_intensity, 0.2) OVER (PARTITION BY dow_number, part_of_week, day_of_week, time_of_day), 4) AS total_intensity_second_decile,
ROUND(PERCENTILE_CONT(total_intensity, 0.3) OVER (PARTITION BY dow_number, part_of_week, day_of_week, time_of_day), 4) AS total_intensity_third_decile,
ROUND(PERCENTILE_CONT(total_intensity, 0.4) OVER (PARTITION BY dow_number, part_of_week, day_of_week, time_of_day), 4) AS total_intensity_fourth_decile,
ROUND(PERCENTILE_CONT(total_intensity, 0.6) OVER (PARTITION BY dow_number, part_of_week, day_of_week, time_of_day), 4) AS total_intensity_sixth_decile,
ROUND(PERCENTILE_CONT(total_intensity, 0.7) OVER (PARTITION BY dow_number, part_of_week, day_of_week, time_of_day), 4) AS total_intensity_seventh_decile,
ROUND(PERCENTILE_CONT(total_intensity, 0.8) OVER (PARTITION BY dow_number, part_of_week, day_of_week, time_of_day), 4) AS total_intensity_eighth_decile,
ROUND(PERCENTILE_CONT(total_intensity, 0.9) OVER (PARTITION BY dow_number, part_of_week, day_of_week, time_of_day), 4) AS total_intensity_ninth_decile
FROM user_dow_summary
),
basic_summary AS (
SELECT
part_of_week,
day_of_week,
time_of_day,
SUM(total_intensity) AS total_total_intensity,
AVG(total_intensity) AS average_total_intensity,
SUM(total_average_intensity) AS total_total_average_intensity,
AVG(total_average_intensity) AS average_total_average_intensity,
SUM(average_intensity) AS total_average_intensity,
AVG(average_intensity) AS average_average_intensity,
AVG(max_intensity) AS average_max_intensity,
AVG(min_intensity) AS average_min_intensity
FROM user_dow_summary
GROUP BY
1, dow_number, 2, 3
)
SELECT
*
FROM basic_summary
LEFT JOIN intensity_deciles
USING (part_of_week, day_of_week, time_of_day)
ORDER BY 1, dow_number, 2, CASE
WHEN time_of_day = "Morning" THEN 0
WHEN time_of_day = "Afternoon" THEN 1
WHEN time_of_day = "Evening" THEN 2
WHEN time_of_day = "Night" THEN 3
END;
Merging multiple tables (e.g., daily activity, sleep, and nap data) was a critical step for creating a unified dataset that could be analyzed holistically. I used LEFT JOIN to ensure that no data points were missed during the merge.
SELECT
A.Id,
A.Calories,
* EXCEPT(Id,
Calories,
ActivityDay,
SleepDay,
SedentaryMinutes,
LightlyActiveMinutes,
FairlyActiveMinutes,
VeryActiveMinutes,
SedentaryActiveDistance,
LightActiveDistance,
ModeratelyActiveDistance,
VeryActiveDistance),
I.SedentaryMinutes,
I.LightlyActiveMinutes,
I.FairlyActiveMinutes,
I.VeryActiveMinutes,
I.SedentaryActiveDistance,
I.LightActiveDistance,
I.ModeratelyActiveDistance,
I.VeryActiveDistance
FROM
`data-analytics-cert-435119.fitbit.dailyActivity_merged` A
LEFT JOIN
`data-analytics-cert-435119.fitbit.dailyCalories_merged` C
ON
A.Id = C.Id
AND A.ActivityDate=C.ActivityDay
AND A.Calories = C.Calories
LEFT JOIN
`data-analytics-cert-435119.fitbit.dailyIntensities_merged` I
ON
A.Id = I.Id
AND A.ActivityDate=I.ActivityDay
AND A.FairlyActiveMinutes = I.FairlyActiveMinutes
AND A.LightActiveDistance = I.LightActiveDistance
AND A.LightlyActiveMinutes = I.LightlyActiveMinutes
AND A.ModeratelyActiveDistance = I.ModeratelyActiveDistance
AND A.SedentaryActiveDistance = I.SedentaryActiveDistance
AND A.SedentaryMinutes = I.SedentaryMinutes
AND A.VeryActiveDistance = I.VeryActiveDistance
AND A.VeryActiveMinutes = I.VeryActiveMinutes
LEFT JOIN
`data-analytics-cert-435119.fitbit.dailySteps_merged` S
ON
A.Id = S.Id
AND A.ActivityDate=S.ActivityDay
LEFT JOIN
`data-analytics-cert-435119.fitbit.sleepDay_merged` Sl
ON
A.Id = Sl.Id
AND A.ActivityDate=CAST(Sl.SleepDay AS DATE);
SELECT
w.BMI, AVG(a.TotalSteps) as avg_steps, AVG(a.Calories) as avg_calories
FROM
data-analytics-cert-435119.fitbit.weightLogInfo_merged w
JOIN
data-analytics-cert-435119.fitbit.dailyActivity_merged a
ON
w.Id = a.Id
GROUP BY
w.BMI
ORDER BY
w.BMI;
-- Say we are considering sleep related products as a possibility, let's take a moment to see if/ how people nap during the day
-- To do this we are assuming that a nap is any time someone sleeps but goes to sleep and wakes up on the same day
SELECT
Id,
sleep_start AS sleep_date,
COUNT(logId) AS number_naps,
SUM(EXTRACT(HOUR
FROM
time_sleeping)) AS total_time_sleeping
FROM (
SELECT
Id,
logId,
MIN(DATE(date)) AS sleep_start,
MAX(DATE(date)) AS sleep_end,
TIME( TIMESTAMP_DIFF(MAX(date),MIN(date),HOUR),
MOD(TIMESTAMP_DIFF(MAX(date),MIN(date),MINUTE),60),
MOD(MOD(TIMESTAMP_DIFF(MAX(date),MIN(date),SECOND),3600),60) ) AS time_sleeping
FROM
`data-analytics-cert-435119.fitbit.minuteSleep_merged`
WHERE
value=1
GROUP BY
1,
2)
WHERE
sleep_start=sleep_end
GROUP BY
1,
2
ORDER BY
3 DESC;
Purpose: Combine activity, sleep, and nap data to create a comprehensive view of users' daily patterns.
In the Analyze phase, I focused on identifying trends in activity and sleep patterns, the impact of naps on total activity, and sleep efficiency analysis.
First, I calculated average metrics across several categories (e.g., steps, activity levels) to understand general trends in user behavior.
SELECT AVG(Calories) AS TotalAverageCalories,
AVG(TotalSteps) AS TotalAverageSteps,
AVG(TotalDistance)AS TotalAverageDistance,
AVG(SedentaryMinutes) AS AvergaeSedentaryActivity,
AVG(LightlyActiveMinutes) AS AverageLightActivity,
AVG(FairlyActiveMinutes)AS AverageFairActivity,
AVG(VeryActiveMinutes)AS AverageVeryActivity,
FROM `data-analytics-cert-435119.fitbit.daily_activity_temp`
;
Purpose: Identify average activity levels to understand user engagement with fitness tracking
The average step count of 7652 steps per day is close to the recommended 10,000 steps per day for a healthy lifestyle. However, most users are quite sedentary, spending a significant portion of their day in sedentary activities.
In simpler terms, METs quantify how much energy an activity requires compared to resting. For example, an activity with 4 METs uses four times the energy of resting. If someone performs a 4 MET activity for 30 minutes, it equates to 120 MET-minutes (4 x 30) or 2.0 MET-hours.
Calorie Burn Formula
To calculate the number of calories burned per minute during an activity, use the following formula
This formula estimates how many calories you burn based on the activity's MET value and your body weight.
SQL Query
The query calculated the total METs and calories burned per day for each user by joining two tables—minute_met_narrow and minuteCaloriesNarrow_merged. The result was then used to visualize the relationship between these two variables.
-- Calculate average METs per day per user and compare with the calories burned
SELECT DISTINCT
minute_met_narrow.Id,
CAST(minute_met_narrow.ActivityMinute AS DATE) AS activity_date,
SUM(minute_met_narrow.METs) AS total_mets,
SUM(minuteCaloriesNarrow_merged.Calories) AS total_calories
FROM
`data-analytics-cert-435119.fitbit.minute_met_narrow` AS minute_met_narrow
INNER JOIN
`data-analytics-cert-435119.fitbit.minuteCaloriesNarrow_merged` AS minuteCaloriesNarrow_merged
ON
minute_met_narrow.Id = minuteCaloriesNarrow_merged.Id
AND minute_met_narrow.ActivityMinute = minuteCaloriesNarrow_merged.ActivityMinute
GROUP BY
minute_met_narrow.Id,
activity_date
ORDER BY
Activity_date;
The scatter plot of Total METs (X-axis) vs. Total Calories (Y-axis) revealed a positive linear relationship:
The linear regression formula obtained was:
Total Calories = 0.113516 * Total METs + (-1784.56)
R-squared: 0.61032
P-value: < 0.0001
The R-squared value of 0.61032 indicates a moderate to strong linear relationship between METs and calories burned, suggesting that approximately 61% of the variation in calories burned can be explained by the total METs (activity intensity). The P-value being less than 0.0001 confirms the statistical significance of this relationship.
From this, it’s evident that the more METs (activity intensity) a user accumulates, the higher their total calorie expenditure, aligning with general fitness principles. Users who log more high-intensity activity will likely burn more calories, supporting the efficacy of tracking METs as an indicator of energy output.
Calorie Burn Prediction: The strong correlation suggests that Bellabeat users who engage in more intense activities (as measured by METs) consistently burn more calories. This insight can guide recommendations for increasing activity intensity to users aiming to enhance weight management or fitness levels.
Personalized Activity Tracking: The relationship between METs and calorie burn can be used to provide more accurate, personalized feedback to users in the app, motivating them to increase their METs to meet daily calorie burn goals.
Consistency Across Users: The strong statistical significance (P-value < 0.0001) shows that this relationship holds consistently across the dataset, making it a reliable indicator for activity-based calorie burn.
This section groups users based on how often they recorded steps, sleep, and weight data. The queries identify users with "Low", "Moderate", or "High" logging frequency for each metric. By understanding how often users interact with the app, we gain insights into user engagement and their tracking behaviors.
Query
-- Selecting sleep logs without duplicates
WITH sleep_no_duplicates AS (
SELECT Id, SleepDay
FROM `data-analytics-cert-435119.fitbit.sleepDay_merged`
GROUP BY Id, SleepDay
HAVING COUNT(*) = 1
)
-- Using the de-duplicated data for further analysis
SELECT *
FROM sleep_no_duplicates;
SELECT
Id,
CAST(SleepDay AS DATE) AS SleepDay_converted
FROM `data-analytics-cert-435119.fitbit.sleepDay_merged`;
SELECT
Id,
CAST(Date AS DATE) AS weight_date_converted
FROM `data-analytics-cert-435119.fitbit.weightLogInfo_merged`;
-- Grouping users based on step count frequency
WITH step_frequency AS (
SELECT Id, COUNT(*) AS step_records
FROM `data-analytics-cert-435119.fitbit.dailyActivity_merged`
GROUP BY Id
)
SELECT Id, step_records,
CASE
WHEN step_records <= 10 THEN 'Low'
WHEN step_records <= 20 THEN 'Moderate'
ELSE 'High'
END AS steps_group
FROM step_frequency;
-- Grouping users based on sleep log frequency
WITH sleep_frequency AS (
SELECT Id, COUNT(*) AS sleep_records
FROM `data-analytics-cert-435119.fitbit.sleepDay_merged`
GROUP BY Id
)
SELECT Id, sleep_records,
CASE
WHEN sleep_records <= 10 THEN 'Low'
WHEN sleep_records <= 20 THEN 'Moderate'
ELSE 'High'
END AS sleep_group
FROM sleep_frequency;
-- Grouping users based on weight log frequency
WITH weight_frequency AS (
SELECT Id, COUNT(*) AS weight_records
FROM `data-analytics-cert-435119.fitbit.weightLogInfo_merged`
GROUP BY Id
)
SELECT Id, weight_records,
CASE
WHEN weight_records <= 10 THEN 'Low'
WHEN weight_records <= 20 THEN 'Moderate'
ELSE 'High'
END AS weight_group
FROM weight_frequency;
-- Combining all the groups into a single table
WITH step_frequency AS (
SELECT Id, COUNT(*) AS step_records
FROM `data-analytics-cert-435119.fitbit.dailyActivity_merged`
GROUP BY Id
),
step_groups AS (
SELECT Id, step_records,
CASE
WHEN step_records <= 10 THEN 'Low'
WHEN step_records <= 20 THEN 'Moderate'
ELSE 'High'
END AS steps_group
FROM step_frequency
),
sleep_frequency AS (
SELECT Id, COUNT(*) AS sleep_records
FROM `data-analytics-cert-435119.fitbit.sleepDay_merged`
GROUP BY Id
),
sleep_groups AS (
SELECT Id, sleep_records,
CASE
WHEN sleep_records <= 10 THEN 'Low'
WHEN sleep_records <= 20 THEN 'Moderate'
ELSE 'High'
END AS sleep_group
FROM sleep_frequency
),
weight_frequency AS (
SELECT Id, COUNT(*) AS weight_records
FROM `data-analytics-cert-435119.fitbit.weightLogInfo_merged`
GROUP BY Id
),
weight_groups AS (
SELECT Id, weight_records,
CASE
WHEN weight_records <= 10 THEN 'Low'
WHEN weight_records <= 20 THEN 'Moderate'
ELSE 'High'
END AS weight_group
FROM weight_frequency
)
-- Final merged table
SELECT
COALESCE(sg.Id, slg.Id, wg.Id) AS Id,
COALESCE(sg.step_records, 0) AS step_records,
COALESCE(sg.steps_group, 'Never') AS steps_group,
COALESCE(slg.sleep_records, 0) AS sleep_records,
COALESCE(slg.sleep_group, 'Never') AS sleep_group,
COALESCE(wg.weight_records, 0) AS weight_records,
COALESCE(wg.weight_group, 'Never') AS weight_group
FROM step_groups sg
FULL JOIN sleep_groups slg
ON sg.Id = slg.Id
FULL JOIN weight_groups wg
ON sg.Id = wg.Id;
-- Grouping the table by id to check login frequency
SELECT*
FROM `data-analytics-cert-435119.fitbit.login_frequency`
order by Id;
I) Recording Frequency, Bar chart
This will visualize the change in group sizes between step counts, sleep, and weight recording.
Recording Frequency (n):
Low: n ≤ 10
Moderate: 10 < n ≤ 20
High: 20 < n ≤ 31
Chart
A bar chart was generated to show the relative sizes of each user group (Low, Moderate, High) across steps, sleep, and weight tracking. The clear disparity between step logging and sleep/weight logging indicates where user engagement is strong and where it is lacking.
Interpretations:
Steps Frequency: Users were classified based on their step-recording frequency, revealing that most participants recorded their steps for at least 20 days.
Sleep Frequency: Sleep tracking was much less frequent than steps, with fewer users reaching the "Moderate" and "High" categories.
Weight Frequency: Weight tracking was the least common, with a very small percentage of users engaging in regular weight logging..
This data provides key insights into which features of the app are most utilized by users. The high frequency of step-tracking suggests that users prioritize physical activity, but there is less emphasis on sleep and weight tracking.
II) Login Frequency and Activity Levels
Objective:
The goal here was to explore whether there is a correlation between how often users log their data and their physical activity levels, measured by average daily steps.
Query
SELECT
Id,
COUNT(ActivityDate) AS record_count, -- Number of recorded days
AVG(TotalSteps) AS avg_steps -- Average steps taken per day
FROM
`data-analytics-cert-435119.fitbit.daily_activity_temp`
GROUP BY
Id
ORDER BY
record_count DESC;
Insights
There is a moderate positive correlation between login frequency and the number of daily steps. Users who log more frequently tend to have higher daily activity levels, but the correlation is not strong enough to conclude that frequent logging causes higher activity levels. Instead, it suggests that users who are already motivated to be active may be more likely to log their steps regularly.
III) Trends in Time
Objective:
The aim of this analysis is to investigate patterns in the times users log their activity, hypothesizing that exercise times will align with the typical 9-5 job schedule. By examining both average steps per hour and quartile-based analysis, we can explore how activity levels differ throughout the day among more or less active users.
Step 1: Average Steps per Hour
SQL Query 1: Extract hour and get step totals per hour
-- Query 1: Extract hour and get step totals per hour
SELECT
Id,
EXTRACT(HOUR FROM ActivityHour) AS hour,
StepTotal
FROM
`data-analytics-cert-435119.fitbit.hourlySteps_merged`;
SQL Query 2: Calculate average steps per hour
-- Query 2: Isolate hour and calculate average steps per hour
SELECT
EXTRACT(HOUR FROM ActivityHour) AS hour,
AVG(StepTotal) AS avg_steps_hourly
FROM
`data-analytics-cert-435119.fitbit.hourlySteps_merged`
GROUP BY
hour
ORDER BY
hour;
The data shows that users are most active in the afternoon and evening, consistent with breaks in a typical 9-5 workday. There is a peak in activity around these times, which indicates that many users may log activity around work breaks or post-work exercise routines.
There could still be more to data as some factors that may affect when someone decides to log their steps can vary on many things. In our data, we can identify and account for at least one of those factors – activity level.
Let’s take a look at the distribution of the total steps each participant took. I decided to plot the distribution of total steps each participant took over the course of the recorded 31 days to estimate their fitness lifestyle. I chose to work with the sum of monthly steps because I would like to consider people who are more consistent with their fitness schedule as “more active”. In other words, people who logged more steps are considered to be more active than those who logged less steps over the 31 days.
Step 2: Distribution of Total Steps and Activity Quartiles
SQL Query: Calculate quartiles based on monthly steps
-- Calculate quartiles based on monthly steps using PERCENT_RANK
WITH ranked_data AS (
SELECT
Id,
PERCENT_RANK() OVER (ORDER BY SUM(StepTotal)) AS quartile_rank,
SUM(StepTotal) AS sum_steps_monthly
FROM
`data-analytics-cert-435119.fitbit.hourlySteps_merged`
GROUP BY
Id
)
SELECT
Id,
CASE
WHEN quartile_rank <= 0.25 THEN 'Quartile 1'
WHEN quartile_rank <= 0.5 THEN 'Quartile 2'
WHEN quartile_rank <= 0.75 THEN 'Quartile 3'
ELSE 'Quartile 4'
END AS sum_quartile,
sum_steps_monthly
FROM
ranked_data;
The most active of this sample are on the right side of this histogram, whereas the least active people of this sample are on the left side.
To check if there are differences in time-related habits between people who are more or less active, we can divide the histogram above into four parts, otherwise known as quartiles. Usually, we would not want to convert continuous variables, such as activity, into categorical variables because we loose nuance and statistical power. However, because I am looking at fitness as a quality shared by groups of people in the sample, I decided it will be the clearest to show as groups of fitness level.
This histogram shows the distribution of total steps taken by participants in 31 days but is now color coded into the quartiles. Again, the most active people of the sample are quartile 4 (purple) and the least active people of the sample are quartile 1 (red).
Insights:
Quartile Grouping: By plotting the distribution of total steps taken over the course of 31 days, users are categorized into four quartiles based on their activity levels:
Quartile 4 (most active) shows users who log more steps, representing highly consistent fitness behaviors.
Quartile 1 (least active) represents users who log fewer steps and demonstrate irregular or lower activity.
Visual Analysis: In the quartile-based histogram, Quartile 4 users, who are the most active, dominate the right side of the graph, while Quartile 1 users, the least active, fall on the left side. The grouping allows us to easily observe the difference in fitness levels across the sample.
By dividing users into quartiles, the analysis revealed that the most active users show clear activity peaks throughout the day, while less active users are more sporadic in their activity logging.
Now, using these same groups, we can recreate the line graph of average steps per house.
We see that the top two most active groups of this sample peaks three times: around morning, afternoon and evening. These times coincide around breaks of a typical 9-5 job. The second to least active group (quartile 2) has a small peak in the morning time, but I see the afternoon and evening peaks as stronger and clearer. Then lastly, we have quartile 1 (or the least active of the sample) seems to have one small peak in the late morning.
in summary, dividing the sample into groups based on activity revealed more information that looking at the group as a whole. This can serve as encouragement for Bellabeat’s marketing and development team to tailor user experience based on consumer habits and fitness skill. As an example, perhaps if the app identifies hours of the day in which they are active, it can remind them to hydrate as they prepare to go on their daily workout, further encouraging our consumer’s to continue to engage with the product.
Insights:
Activity Peaks by Group: The line graph representing average steps by hour, broken down by quartile, reveals that:
Quartile 4 (most active) users exhibit peaks in the morning, afternoon, and evening, coinciding with breaks in a typical workday. This suggests that these users are highly consistent in engaging in physical activity during regular intervals.
Quartile 2 shows peaks primarily in the afternoon and evening, indicating moderate engagement.
Quartile 1 (least active) users show only minor peaks, mostly in the late morning, reflecting less consistency in their activity.
Behavioral Insight: This quartile-based segmentation reveals that the most active users are disciplined with their activity, whereas the least active users exhibit erratic or minimal engagement.
4.3.1 Sleep Efficiency Analysis
Correlation Between Sleep and Activity Levels
This analysis investigates whether there is a correlation between users' daytime activity (measured by steps) and their sleep quality (measured by total sleep duration).
SELECT d.Id, d.TotalSteps, s.TotalMinutesAsleep, d.ActivityDate
FROM `data-analytics-cert-435119.fitbit.dailyActivity_merged` AS d
JOIN `data-analytics-cert-435119.fitbit.sleepDay_merged` AS s
ON d.Id = s.Id -- Join by Id to ens
AND d.ActivityDate = CAST(s.SleepDay AS DATE) -- Join by date to match activities to sleep
WHERE d.TotalSteps IS NOT NULL
AND s.TotalMinutesAsleep IS NOT NULL;
Key Findings:
R² = 0.036, indicating a weak correlation between total steps and sleep duration.
P-value = 0.0001054, which shows statistical significance, meaning the weak correlation is unlikely to be due to random chance.
While the relationship between steps and sleep duration, though weak, is statistically significant. This implies that although steps have some influence on sleep, they are not a major determining factor, and other variables likely contribute more to variations in sleep duration.
The significance of the p-value suggests this weak trend could still be used to inform product recommendations (e.g., suggesting sleep tracking for highly active users), but other factors, such as stress, bedtime routines, or diet, likely play a larger role in determining sleep quality.
Impact of Time Spent in Bed vs Time Asleep (Sleep Delay)
Understanding the difference between time in bed and actual sleep duration is critical for assessing sleep quality.
Calculating sleep delay for each user:
SELECT Id, SleepDay, TotalTimeInBed, TotalMinutesAsleep,
(TotalTimeInBed - TotalMinutesAsleep) AS sleep_delay
FROM `data-analytics-cert-435119.fitbit.sleepDay_merged`
WHERE TotalMinutesAsleep IS NOT NULL AND TotalTimeInBed IS NOT NULL;
Identifying the average delay between going to bed and falling asleep can give insights into sleep quality.
The chart depicts the distribution of sleep delays for 24 Bellabeat users. Each user is color-coded (based on ID), showing the variation in how long it takes them to fall asleep across multiple days. The data provides insights into users' sleep habits and patterns related to sleep delays, with a focus on individual behaviors.
Analysis
User-specific patterns: The color-coded IDs reveal that some users consistently exhibit longer sleep delays, while others fall asleep more quickly. For example, certain users appear to have a more significant delay during specific time periods, indicating possible stress factors, evening routines, or other behaviors that delay sleep onset.
Clustering behavior: Users with shorter sleep delays appear grouped closely, potentially representing healthy sleep routines or better management of pre-sleep habits. Conversely, those with longer delays are distributed more widely, hinting at inconsistent sleep behaviors.
Outliers: Certain individuals (highlighted by distinct color patterns) show erratic or extreme sleep delays that might warrant personalized coaching or interventions to improve sleep hygiene.
4.4.1 Effects of Nap on NIght Sleep
WITH sleep_data AS (
SELECT
s.Id,
s.SleepDay,
SUM(s.TotalMinutesAsleep) AS nighttime_sleep,
COALESCE(SUM(n.total_time_sleeping), 0) AS nap_sleep -- Corrected column name here
FROM `data-analytics-cert-435119.fitbit.sleepDay_merged` AS s
LEFT JOIN `data-analytics-cert-435119.fitbit.sleep_nap_temp` AS n
ON s.Id = n.Id AND DATE(s.SleepDay) = n.sleep_date -- Convert TIMESTAMP to DATE
GROUP BY s.Id, s.SleepDay
)
SELECT
Id,
SleepDay,
nighttime_sleep,
nap_sleep,
(nighttime_sleep + nap_sleep) AS total_sleep_time
FROM sleep_data;
The scatter plot above visualizes the relationship between Average Total Nap Time (in hours) and Average Total Night Sleep (in hours) across various participants. A trendline is also shown, indicating a negative correlation between these two variables.
Key Observations:
Negative Correlation:
As the total nap time increases, the total night sleep duration tends to decrease. This is depicted by the downward slope of the trendline, suggesting that individuals who nap more during the day tend to sleep less at night.
Sleep Distribution:
Most participants who average more than 6 hours of naps show very little night sleep (close to 0–1 hours).
Participants who take shorter naps (less than 2 hours on average) exhibit a wide range of night sleep durations, with many achieving 6-8 hours of sleep.
Outliers:
A few participants with average nap times around 6 hours also show 1–3 hours of night sleep. These could represent individuals who nap extensively but still manage some night sleep, although significantly less than those with fewer naps.
Total Sleep Displacement:
It appears that daytime naps compensate for nighttime sleep for many individuals in this dataset. Those with higher nap times seem to substitute naps for what could be considered a typical full night’s sleep (7–9 hours).
2. Nap Effect on Activity
SELECT
da.Id,
da.ActivityDate,
da.TotalSteps,
sn.total_time_sleeping AS total_nap_time
FROM `data-analytics-cert-435119.fitbit.daily_activity_temp` da
LEFT JOIN `data-analytics-cert-435119.fitbit.sleep_nap_temp` sn
ON da.Id = sn.Id
AND da.ActivityDate = sn.sleep_date
ORDER BY da.ActivityDate;
Analysis of Nap Patterns:
The data shows that naps play a crucial role in user sleep routines and physical activity, as illustrated by the relationship between nap duration, nighttime sleep, and total steps:
Key Insights:
Moderate naps are associated with higher physical activity, indicating that short naps can recharge energy levels.
Users with longer naps tend to be less active, suggesting that excessive naps may lead to lethargy.
The relationship between naps, sleep quality, and physical activity highlights that users' nap behaviors significantly impact their overall wellness. For Bellabeat, this data offers an opportunity to refine its product offerings by providing personalized insights and recommendations based on nap and sleep behaviors.
Activity Trends
General Activity: Users average 7,652 steps/day, close to the 10,000-step guideline, yet most remain sedentary.
METs and Calories: A strong positive correlation between METs and calories suggests users who engage in higher-intensity activities consistently burn more calories.
Feature Usage
Tracking Frequency: Step tracking was the most-used feature, followed by sleep logging, while weight tracking saw minimal use. More frequent loggers recorded slightly higher daily steps.
Time-Based Patterns
Activity Peaks: The most active users log steps consistently around typical workday breaks (morning, midday, evening). Less active users show fewer peaks.
Sleep Trends
Sleep and Steps: A weak but significant correlation between steps and sleep duration suggests other factors impact sleep more.
Naps and Night Sleep: Increased nap time correlates with reduced night sleep, while moderate nappers tend to be more active.
Drive Engagement with Gamification and Rewards
Implement a point system and daily/weekly streaks to encourage regular activity and logging (e.g., similar to Duolingo’s goals).
Offer rewards for meeting fitness, sleep, and hydration milestones, boosting motivation and retention.
Simplify Tracking with Automated Entry
Introduce Bluetooth-compatible devices (e.g., scales) for seamless weight and sleep logging.
Provide reminders for daily device charging and prompt tracking at optimal times.
Offer interchangeable, comfortable and fashionable straps/cases for devices
Personalized Activity and Sleep Coaching
Use MET and calorie data to tailor activity prompts based on individual fitness trends.
Offer in-app guidance on sleep hygiene, linking credible resources, and reminders to wind down before bed.
Develop a "Total Sleep Efficiency" metric that combines nap data with night sleep.
Timely, Adaptive Notifications
Send personalized, behavior-driven notifications during peak activity hours (e.g., hydration reminders, gentle nudges to stay active).
Adapt workout recommendations to match user engagement levels—high-intensity suggestions for active users and gradual routines for beginners.