SleepInc: Helping you find better sleep ๐ด
๐ Background
SleepInc, a sleep health company that recently launched a sleep-tracking app called SleepScope. The app monitors sleep patterns and collects users' self-reported data on lifestyle habits. SleepInc wants to identify lifestyle, health, and demographic factors that strongly correlate with poor sleep quality.
๐พ The data
SleepInc has provided us with an anonymized dataset of sleep and lifestyle metrics for 374 individuals. This dataset contains average values for each person calculated over the past six months.
The dataset includes 13 columns covering sleep duration, quality, disorders, exercise, stress, diet, demographics, and other factors related to sleep health.
| Column | Description |
|---|---|
Person ID | An identifier for each individual. |
Gender | The gender of the person (Male/Female). |
Age | The age of the person in years. |
Occupation | The occupation or profession of the person. |
Sleep Duration (hours) | The average number of hours the person sleeps per day. |
Quality of Sleep (scale: 1-10) | A subjective rating of the quality of sleep, ranging from 1 to 10. |
Physical Activity Level (minutes/day) | The average number of minutes the person engages in physical activity daily. |
Stress Level (scale: 1-10) | A subjective rating of the stress level experienced by the person, ranging from 1 to 10. |
BMI Category | The BMI category of the person (e.g., Underweight, Normal, Overweight). |
Blood Pressure (systolic/diastolic) | The average blood pressure measurement of the person, indicated as systolic pressure over diastolic pressure. |
Heart Rate (bpm) | The average resting heart rate of the person in beats per minute. |
Daily Steps | The average number of steps the person takes per day. |
Sleep Disorder | The presence or absence of a sleep disorder in the person (None, Insomnia, Sleep Apnea). |
Acknowledgments: Laksika Tharmalingam, Kaggle: https://www.kaggle.com/datasets/uom190346a/sleep-health-and-lifestyle-dataset (this is a fictitious dataset)
Introduction
The sleep health company has recently developed a new sleep-tracking app called SleepScope. This app records users' sleep data and collects data reported by them. This company wants to determine factors, including profession, age, and gender, that strongly affect the sleep quality and give some recommendations to improve it based on your insights.
Data
The data comprises 374 rows and 13 columns. It captures sleep related data for each of the 374 individuals based on 13 features. Every individual is identified by a unique identifier(ID), and the dataset includes details such as gender, age, occupation, sleep duration, sleep quality, physical acitivity, stress level, body mass index, blood pressure, heart rate, daily steps and sleep disorder.
Our objective in this dataset is to figure out what factors causes poor sleep quality in individuals' lives and to understand the elements that can contribute to its improvement.
Visualisations and Insights
1 hidden cell
summary(sleep_data)Gender and sleep quality/duration
library(dplyr)
library(ggplot2)
ggplot(data=sleep_data,mapping=aes(x=Gender,fill=Gender))+
geom_bar()#quality of sleep of male is lower than female
ggplot(data=sleep_data,mapping = aes(x=Gender,y=sleep_data$`Sleep Duration`,fill=Gender))+
geom_boxplot()#quality of sleep of male is lower than female
ggplot(data=sleep_data,mapping = aes(x=Gender,y=sleep_data$`Quality of Sleep`,fill=Gender))+
geom_boxplot()Findings
-
In the barplot, we could see that we have slightly more males than females in the dataset.
-
we could also see that both males and females have an average sleep duration of 7.3 hours.
-
Notably, females reported a higher sleep quality compared to males.
Occupation
ggplot(data=sleep_data,mapping=aes(x=Occupation,fill=Occupation))+
geom_bar()+
theme(axis.text.x = element_text(angle = 45, hjust = 1))+
guides(fill=FALSE)โ
โ