Skip to content

Sleep Health and Lifestyle

This synthetic dataset contains sleep and cardiovascular metrics as well as lifestyle factors of close to 400 fictive persons.

The workspace is set up with one CSV file, data.csv, with the following columns:

  • Person ID
  • Gender
  • Age
  • Occupation
  • Sleep Duration: Average number of hours of sleep per day
  • Quality of Sleep: A subjective rating on a 1-10 scale
  • Physical Activity Level: Average number of minutes the person engages in physical activity daily
  • Stress Level: A subjective rating on a 1-10 scale
  • BMI Category
  • Blood Pressure: Indicated as systolic pressure over diastolic pressure
  • Heart Rate: In beats per minute
  • Daily Steps
  • Sleep Disorder: One of None, Insomnia or Sleep Apnea

1. Which factors could contribute to a sleep disorder?

The data indicates that individuals with sleep disorders are more likely to have a BMI that falls into the overweight or obese category.

Spinner
DataFrameas
df3
variable
SELECT occupation, gender,
"Sleep Disorder",
"Sleep Duration",
"Daily Steps",
"Physical Activity Level", 
"Stress Level", 
"BMI Category",
FROM 'data.csv'
WHERE "Sleep disorder" IS NOT NULL;

2. Does an increased physical activity level result in a better quality of sleep? The data shows that the majority of people with lower physical activity levels tend to experience poor quality of sleep.

Spinner
DataFrameas
df
variable
SELECT gender,
"Quality of Sleep",
"Daily Steps",
"Physical Activity Level",
FROM 'data.csv'
ORDER BY gender, "Daily Steps", "Physical Activity Level" DESC;

3. Does stress level impact the quality of sleep?

Yes. The data shows that when stress level increased, the quality of sleep then decreased.

Spinner
DataFrameas
df1
variable
SELECT Gender, "Quality of Sleep", "Stress Level", "Sleep Disorder"
FROM 'data.csv'
WHERE "Sleep Disorder" ='None'
GROUP BY Gender, "Quality of Sleep", "Stress Level", "Sleep Disorder"
ORDER BY "Stress Level" DESC;

4. Does increase of body weight result in the quality of sleep?

As body weight increases, the average quality of sleep tends to decrease slightly. While the drop isn’t huge, there’s a small downward trend: people with higher body weight generally report lower sleep quality, especially when they have a sleep disorder like insomnia or sleep apnea.

Spinner
DataFrameas
df2
variable
SELECT 
  "BMI Category",
  "Sleep Disorder",
  ROUND(AVG("Quality of Sleep"), 0) AS "Average Quality of Sleep"
FROM 'data.csv'
WHERE "Sleep Disorder" IS NOT NULL
GROUP BY "BMI Category", "Sleep Disorder"
ORDER BY "Average Quality of Sleep" DESC;