Introduction
Bellabeat is a successful small company, but they have the potential to become a larger player in the global smart device market. Urška Sršen, cofounder and Chief Creative Officer of Bellabeat, believes that analyzing smart device fitness data could help unlock new growth opportunities for the company.focus on one of Bellabeat’s products and analyze smart device data to gain insight into how consumers are using their smart devices. The insights that is discover will then help guide marketing strategy for the company.
ASK
● What is the problem you are trying to solve? The main objective is to determine what are some trends in smart device usage and how these trends apply to Bellbeat customers. Create a marketing strategy for these trends to help influence Bellabeat products.
● How can your insights drive business decisions? The understanding will benefit the marketing team. Discovering how people use non-Bellbeat smart devices.
Business Task.
● Analyze Fitbit data to gain insight and help guide marketing strategy for Bellabeat to grow as a global player. Stakeholders.
● Primary stakeholders: Urška Sršen and Sando Mur, executive team members.
● Secondary stakeholders: Bellabeat marketing analytics team.
Deliverable.
A concise summary of the business task and a description of all data sources used. Document any data cleaning or alteration, as well as a summary of the analysis, supporting visuals, and noteworthy conclusion. Top high-level content recommendation based on the analysis.
Prepare
Overview of the Data
The Data Source:
● Data is publicly available at FitBit Fitness Tracker Data on Kaggle (https://www.kaggle.com/arashnic/fitbit) and contains 18 csv files.
● Data includes 12 March 2016 to 12 May 2016. 33 FitBit users consented to the submission of personal tracker data.
● Data collected includes physical activity recorded in minutes, heart rate, sleep monitoring, daily activity and steps.
Limitations of the Dataset:
● Data was collected 8 years ago in 2016. Therefore, data may be outdated as users’ daily activity, fitness and sleeping habits, diet and food consumption may have changed since then.
● Absence of key characteristics of the userss, such as gender, age, location, lifestyle.
● As data is collected in a survey, we are unable to ascertain its integrity or accuracy.
Are there issues with bias or credibility in this data? Does your data ROCCC?
● A good data source is ROCCC which stands for Reliable, Original, Comprehensive, Current, and Cited.
● Reliable — LOW — Not reliable as it only has 33 respondents
and
some of the dataset have less than that.
● Original — LOW — Third party provider. Comprehensive — MED — Parameters match most of Bellabeat products’ parameters
● Current — LOW — Data is 8 years old and may not be relevant
● Cited — LOW — Data collected from third party, hence unknown.
The data integrity and credibility is not sufficient to provide a comprehensive analysis of the company. Therefore, the following analysis can only provide high-level direction and should be verified with.
Setting up the Working Environment
The analysis is to be carried out using RStudio. First, all relevant packages are loaded.
install.packages("tidyverse")
## Installing package into '/cloud/lib/x86_64-pc-linux-gnu-library/4.4'
## (as 'lib' is unspecified)
library(tidyverse)
## ── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
## ✔ dplyr 1.1.4 ✔ readr 2.1.5
## ✔ forcats 1.0.0 ✔ stringr 1.5.1
## ✔ ggplot2 3.5.1 ✔ tibble 3.2.1
## ✔ lubridate 1.9.3 ✔ tidyr 1.3.1
## ✔ purrr 1.0.2
## ── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
## ✖ dplyr::filter() masks stats::filter()
## ✖ dplyr::lag() masks stats::lag()
## ℹ Use the conflicted package (<http://conflicted.r-lib.org/>) to force all conflicts to become errors
install.packages("here")
## Installing package into '/cloud/lib/x86_64-pc-linux-gnu-library/4.4'
## (as 'lib' is unspecified)
library("here")
## here() starts at /cloud/project
install.packages("skimr")
## Installing package into '/cloud/lib/x86_64-pc-linux-gnu-library/4.4'
## (as 'lib' is unspecified)
library("skimr")
install.packages("janitor")
## Installing package into '/cloud/lib/x86_64-pc-linux-gnu-library/4.4'
## (as 'lib' is unspecified)
library("janitor")
##
## Attaching package: 'janitor'
## The following objects are masked from 'package:stats':
##
## chisq.test, fisher.test
install.packages("dplyr")
## Installing package into '/cloud/lib/x86_64-pc-linux-gnu-library/4.4'
## (as 'lib' is unspecified)
library("dplyr")
library("lubridate")
library("tidyr")
library("ggplot2")
Process
Importing Data
As there is only a small sample size of the datasets, it is prudent focus on the “daily” data which is more likely to provide high level insights.
daily_activity <- read.csv("dailyActivity_merged.csv")
daily_calories <- read.csv("dailyCalories_merged.csv")
daily_intensities <- read.csv("dailyIntensities_merged.csv")
daily_steps <- read.csv("dailySteps_merged.csv")
daily_sleep <- read.csv("sleepDay_merged.csv")
Cleaning the Data
Review the data to look for useful starting points and patterns.
head(daily_activity)
## Id ActivityDate TotalSteps TotalDistance TrackerDistance
## 1 1503960366 4/12/2016 13162 8.50 8.50
## 2 1503960366 4/13/2016 10735 6.97 6.97
## 3 1503960366 4/14/2016 10460 6.74 6.74
## 4 1503960366 4/15/2016 9762 6.28 6.28
## 5 1503960366 4/16/2016 12669 8.16 8.16
## 6 1503960366 4/17/2016 9705 6.48 6.48
## LoggedActivitiesDistance VeryActiveDistance ModeratelyActiveDistance
## 1 0 1.88 0.55
## 2 0 1.57 0.69
## 3 0 2.44 0.40
## 4 0 2.14 1.26
## 5 0 2.71 0.41
## 6 0 3.19 0.78
## LightActiveDistance SedentaryActiveDistance VeryActiveMinutes
## 1 6.06 0 25
## 2 4.71 0 21
## 3 3.91 0 30
## 4 2.83 0 29
## 5 5.04 0 36
## 6 2.51 0 38
## FairlyActiveMinutes LightlyActiveMinutes SedentaryMinutes Calories
## 1 13 328 728 1985
## 2 19 217 776 1797
## 3 11 181 1218 1776
## 4 34 209 726 1745
## 5 10 221 773 1863
## 6 20 164 539 1728
head(daily_calories)
## Id ActivityDay Calories
## 1 1503960366 4/12/2016 1985
## 2 1503960366 4/13/2016 1797
## 3 1503960366 4/14/2016 1776
## 4 1503960366 4/15/2016 1745
## 5 1503960366 4/16/2016 1863
## 6 1503960366 4/17/2016 1728
head(daily_intensities)
## Id ActivityDay SedentaryMinutes LightlyActiveMinutes
## 1 1503960366 4/12/2016 728 328
## 2 1503960366 4/13/2016 776 217
## 3 1503960366 4/14/2016 1218 181
## 4 1503960366 4/15/2016 726 209
## 5 1503960366 4/16/2016 773 221
## 6 1503960366 4/17/2016 539 164
## FairlyActiveMinutes VeryActiveMinutes SedentaryActiveDistance
## 1 13 25 0
## 2 19 21 0
## 3 11 30 0
## 4 34 29 0
## 5 10 36 0
## 6 20 38 0
## LightActiveDistance ModeratelyActiveDistance VeryActiveDistance
## 1 6.06 0.55 1.88
## 2 4.71 0.69 1.57
## 3 3.91 0.40 2.44
## 4 2.83 1.26 2.14
## 5 5.04 0.41 2.71
## 6 2.51 0.78 3.19
head(daily_steps)
## Id ActivityDay StepTotal
## 1 1503960366 4/12/2016 13162
## 2 1503960366 4/13/2016 10735
## 3 1503960366 4/14/2016 10460
## 4 1503960366 4/15/2016 9762
## 5 1503960366 4/16/2016 12669
## 6 1503960366 4/17/2016 9705
head(daily_sleep)
## Id SleepDay TotalSleepRecords TotalMinutesAsleep
## 1 1503960366 4/12/2016 12:00:00 AM 1 327
## 2 1503960366 4/13/2016 12:00:00 AM 2 384
## 3 1503960366 4/15/2016 12:00:00 AM 1 412
## 4 1503960366 4/16/2016 12:00:00 AM 2 340
## 5 1503960366 4/17/2016 12:00:00 AM 1 700
## 6 1503960366 4/19/2016 12:00:00 AM 1 304
## TotalTimeInBed
## 1 346
## 2 407
## 3 442
## 4 367
## 5 712
## 6 320
Check to see how many distinct ID’s (users) are in each data set.
n_distinct(daily_activity$Id)
## [1] 33
n_distinct(daily_calories$Id)
## [1] 33
n_distinct(daily_intensities$Id)
## [1] 33
n_distinct(daily_steps$Id)
## [1] 33
n_distinct(daily_sleep$Id)
## [1] 24
The sleep data has 9 fewer users.All other data sets have 33 users. Following a closer inspection, the daily_activity data set contains the relevant data found in daily_calories, daily_intensities and daily_steps. Therefore, the focus can be dedicated to the daily_activity and daily_sleep data sets.
Check for (and remove) duplicates. The sleep data had three identical rows which were removed.
daily_sleep_updated <- distinct(daily_sleep)
Next, the date columns are to be converted to the correct “date” format.
daily_activity$ActivityDate <-as.Date(daily_activity$ActivityDate, format = "%m/%d/%Y")
The sleep data has time included in the date column. Prior to formatting the column, it is to be split so that the date is on its own.The time data is not necessary and so is removed. Two additional columns were added with the minutes asleep and minutes in bed converted to hours.
Analyze
How many observations are there in each dataframe?
nrow(daily_activity)
## [1] 940
nrow(daily_sleep)
## [1] 413
A summary of several variables related to the activity and sleep data is shown below.
daily_activity %>%
select(TotalSteps,
TotalDistance,
SedentaryMinutes) %>%
summary()
## TotalSteps TotalDistance SedentaryMinutes
## Min. : 0 Min. : 0.000 Min. : 0.0
## 1st Qu.: 3790 1st Qu.: 2.620 1st Qu.: 729.8
## Median : 7406 Median : 5.245 Median :1057.5
## Mean : 7638 Mean : 5.490 Mean : 991.2
## 3rd Qu.:10727 3rd Qu.: 7.713 3rd Qu.:1229.5
## Max. :36019 Max. :28.030 Max. :1440.0
daily_sleep %>%
select(TotalSleepRecords,
TotalMinutesAsleep,
TotalTimeInBed) %>%
summary()
## TotalSleepRecords TotalMinutesAsleep TotalTimeInBed
## Min. :1.000 Min. : 58.0 Min. : 61.0
## 1st Qu.:1.000 1st Qu.:361.0 1st Qu.:403.0
## Median :1.000 Median :433.0 Median :463.0
## Mean :1.119 Mean :419.5 Mean :458.6
## 3rd Qu.:1.000 3rd Qu.:490.0 3rd Qu.:526.0
## Max. :3.000 Max. :796.0 Max. :961.0
library(ggplot2)
the relationship between steps taken in a day and sedentary minutes?
ggplot(data=daily_activity, aes(x=TotalSteps, y=SedentaryMinutes)) + geom_point()
Observations:
● Average number of steps taken per day was 7638.
● Average sedentary time was 991.2 minutes (16.52 hours).
● Average very active time was 21.16 minutes.
● The average amount of calories burnt per day was around 2304 kcal.
● Participants spent, on average, 7.64 hours in bed with an average time actually sleeping of 6.99 hours.
Share
Visualizations are shown below to highlight trends and patterns.
If more steps are taken, are more calories burned?
ggplot(data=daily_activity) +
geom_point(mapping=aes(x=TotalSteps, y=Calories), color="blue") +
geom_smooth(mapping=aes(x=TotalSteps, y=Calories), color="red") +
labs(title="The Relationship Between Total Steps and Calories Burned", x="Total Steps", y="Calories Burned (kcal)") +
theme(plot.title = element_text(hjust = 0.5))
## `geom_smooth()` using method = 'loess' and formula = 'y ~ x'
The above graph indicates that users who logged more steps typically
burned more calories.
Is there a correlation between level (or intensity) of the activity and how many calories are burned?
ggplot(data=daily_activity) +
geom_point(mapping=aes(x=SedentaryMinutes, y=Calories), color="red") +
geom_smooth(mapping=aes(x=SedentaryMinutes, y=Calories)) +
labs(title="Calories Burned Relative to Sedentary Time", x="Sedentary Time (Min)", y="Calories Burned (kcal)")+ theme(plot.title = element_text(hjust = 0.5))
## `geom_smooth()` using method = 'loess' and formula = 'y ~ x'
ggplot(data=daily_activity) +
geom_point(mapping=aes(x=FairlyActiveMinutes, y=Calories), color="red") +
geom_smooth(mapping=aes(x=FairlyActiveMinutes, y=Calories)) +
labs(title="Calories Burned Relative to Fairly Active Time", x="Fairly Active (Min)", y="Calories Burned (kcal)")+ theme(plot.title = element_text(hjust = 0.5))
## `geom_smooth()` using method = 'loess' and formula = 'y ~ x'
ggplot(data=daily_activity) +
geom_point(mapping=aes(x=LightlyActiveMinutes, y=Calories), color="red") +
geom_smooth(mapping=aes(x=LightlyActiveMinutes, y=Calories)) +
labs(title="Calories Burned Relative to Light Activity Time", x="Lightly Active (Min)", y="Calories Burned (kcal)")+ theme(plot.title = element_text(hjust = 0.5))
## `geom_smooth()` using method = 'loess' and formula = 'y ~ x'
In general, there is correlation between higher intensity activity
resulting in more calories burned.
Is there a correlation between time spent in bed and how much actual sleep a user gets
ggplot(data=daily_activity) +
geom_point(mapping=aes(x=VeryActiveMinutes, y=Calories), color="red") +
geom_smooth(mapping=aes(x=VeryActiveMinutes, y=Calories)) +
labs(title="Calories Burned Relative to Very Active Time", x="Very Active (Min)", y="Calories Burned (kcal)")+ theme(plot.title = element_text(hjust = 0.5))
## `geom_smooth()` using method = 'loess' and formula = 'y ~ x'
The amount of sleep a user got increased fairly linearly with how much
time they actually spent in bed.
What percentage of the logged time was active (and to what intensity of activity)?
sum(daily_activity$SedentaryMinutes)
## [1] 931738
activity_status <- c("Sedentary", "LightlyActive", "FairlyActive", "VeryActive")
total_time <- c(
sum(daily_activity$SedentaryMinutes),
sum(daily_activity$LightlyActiveMinutes),
sum(daily_activity$FairlyActiveMinutes),
sum(daily_activity$VeryActiveMinutes))
total_time_combined <- sum(total_time)
percentage <- c(
(sum(daily_activity$SedentaryMinutes)*100/total_time_combined),
(sum(daily_activity$LightlyActiveMinutes)*100/total_time_combined),
(sum(daily_activity$FairlyActiveMinutes)*100/total_time_combined),
(sum(daily_activity$VeryActiveMinutes)*100/total_time_combined))
total_activity_status <- data.frame(activity_status, total_time, percentage)
pie(total_activity_status$total_time, main="Activity Breakdown", labels = paste0(activity_status, " = ", round(percentage, 0), "%"), edges = 200, radius = 1, col=rainbow(4), init.angle = 15, cex = 1)
A significant majority of the activity logged was sedentary time. Actual
activity made up only a fifth of the time, with fairly and very active
intensity being a small percentage.
ACT
● The data indicates that as more steps were taken, more calories were burned. It is recommended that an incentive be employed to encourage users to walk. Discuss promotion of more consistent usage.
● The data also illustrates that the more intense activity resulted in more calories burned. A disproportionate amount of the activity is less intense. Ways to promote higher intensity activity, such as guided workouts, is recommended.
● Users were fairly consistent with their app usage, however,Inspiring reminders and notifications could be a potential simple way to correct this.
● Emphasize better more consistent sleeping habits.
Based on the limitations of the FitBit data, here are some recommendations for future analysis:
● A larger sample size should be used in order to improve the statistical significance of the analysis.
● A longer period of tracking data, ideally 6-12 months, to account for behavioural changes due to the seasonal change.
● Additional metrics such as personal attributes (age) and hydration may also be useful to analyse.