Ece Erke/Data Analyst
← Back to portfolio

Exploratory data analysis · R

Sleep Efficiency & Lifestyle Choices

An exploratory analysis of how sleep stages and everyday lifestyle factors relate to sleep efficiency, using the Kaggle Sleep Efficiency dataset.

Project brief

01

Question

Which sleep-stage and lifestyle measures are most closely associated with sleep efficiency?

02

Data

The cleaned Kaggle dataset contains 388 records and 13 variables spanning sleep stages, habits, and demographics.

03

Method

Exploratory plots, group comparisons, and simple linear regression models were used to identify patterns.

Explore the analysis

A guided view of the findings.

Regression model 01

Deep sleep and efficiency

The simple linear model shows a clear positive relationship: higher deep-sleep percentages coincide with higher sleep efficiency in this sample.

  • R² = .6217; statistically significant (p < .001).
  • Each one-point increase in deep sleep corresponds to an estimated .0069 increase in efficiency.
  • Deep sleep was the strongest positive predictor tested.
Deep sleep and efficiency chart 1

Regression model 02

Light sleep and efficiency

Light sleep percentage has the strongest overall relationship with sleep efficiency, and the direction is negative.

  • R² = .6665; statistically significant (p < .001).
  • Each one-point increase in light sleep corresponds to an estimated .0072 decrease in efficiency.
  • This was the best-fitting of the three sleep-stage models.
Light sleep and efficiency chart 1

Regression model 03

REM sleep shows little relationship

The fitted line rises slightly, but REM sleep percentage did not meaningfully explain differences in sleep efficiency in this dataset.

  • R² = .0015.
  • The relationship was not statistically significant (p = .208).
  • The chart should be interpreted as no clear pattern, rather than a reliable positive effect.
REM sleep shows little relationship chart 1

Section summary

Light sleep is the clearest model

Comparing the models places light sleep first, followed closely by deep sleep. REM sleep contributed almost no explanatory power.

  • Light sleep: R² = .6665
  • Deep sleep: R² = .6217
  • REM sleep: R² = .0015

Model fit (R²)

Light sleep
.6665
Deep sleep
.6217
REM sleep
.0015
Deep and light sleep models: p < .001
REM sleep model: p = .208

1 / 4

Awakenings 01

Uninterrupted sleep has the highest efficiency

Participants with no awakenings had the highest median and mean sleep efficiency, with a more concentrated distribution than the other groups.

  • Efficiency is highest when no awakenings are reported.
  • Group distributions spread out as awakenings increase.
Uninterrupted sleep has the highest efficiency chart 1

Awakenings 02

Efficiency declines as awakenings accumulate

The smoothed relationship reinforces the same pattern: more nighttime interruptions are associated with lower sleep efficiency.

  • This is an observed association, not evidence that awakenings alone cause lower efficiency.
  • The downward trend is visible across the full spread of observations.
Efficiency declines as awakenings accumulate chart 1

1 / 2

Exercise 01

More exercise aligns with higher efficiency

The mean bar chart and box plot both point in the same direction: typical sleep efficiency rises across exercise levels. The no-, light-, and medium-exercise groups show considerably more spread, while the heavy-exercise group is more tightly concentrated at the higher end of the scale.

  • Heavy exercise (4–5 times weekly) has the highest mean and median efficiency.
  • A small number of heavy-exercise observations are lower, so the pattern is not universal.
  • These are descriptive associations—not evidence that exercise alone causes the difference.
More exercise aligns with higher efficiency chart 1
More exercise aligns with higher efficiency chart 2
1 / 2

Exercise 02

Exercise relates to sleep composition

Looking beyond overall efficiency, the sleep-stage charts distinguish the no-exercise group from everyone who reported some exercise. Participants who exercised tended to have a higher share of deep sleep and a lower share of light sleep—two patterns that align with the regression findings.

  • Deep sleep is generally higher among groups that exercise.
  • Light sleep is markedly higher and more variable in the no-exercise group.
  • The charts describe a pattern across groups; other differences between participants may also contribute.
Exercise relates to sleep composition chart 1
Exercise relates to sleep composition chart 2
1 / 2

Exercise 03

Awakenings are lowest in the heavy-exercise group

Average nighttime awakenings decrease as exercise level rises, with the largest drop in the heavy-exercise group. The violin plot adds context to the averages by showing that high-awakening values occur much less often in that group.

  • No-exercise participants have the highest mean number of awakenings.
  • The heavy-exercise group has the lowest mean and the narrowest concentration near one awakening.
  • Fewer awakenings may be one pathway connecting exercise level with higher sleep efficiency.
Awakenings are lowest in the heavy-exercise group chart 1
Awakenings are lowest in the heavy-exercise group chart 2
1 / 2

1 / 3

Bedtime 01

Deep sleep by bedtime

Participants who went to sleep before midnight tended to show longer deep sleep, a pattern associated with higher efficiency in the regression analysis.

  • Before-midnight observations are more tightly clustered.
  • Deep sleep is positively associated with efficiency.
Deep sleep by bedtime chart 1

Bedtime 02

Light sleep by bedtime

The two groups have a similar median light-sleep percentage, but their distributions differ substantially. Participants going to bed after midnight show a much wider upper range of light sleep, whereas the before-midnight group remains more concentrated at lower percentages.

  • Median light sleep is 18% in both groups.
  • The after-midnight group has a markedly higher upper quartile (45% versus 21%).
  • Higher light sleep was associated with lower efficiency in the regression analysis.
Light sleep by bedtime chart 1

Bedtime 03

A modest difference by gender and bedtime

The bedtime pattern appeared more pronounced among female participants: those going to bed before midnight had a somewhat higher mean efficiency. The same difference was not evident among male participants.

  • This is a subgroup pattern and should be interpreted cautiously.
  • The effect is smaller than the sleep-stage relationships.
A modest difference by gender and bedtime chart 1

1 / 3

Lifestyle factor 01

Caffeine showed little difference

Sleep-efficiency distributions are very similar for people who did and did not report caffeine intake within the 24 hours before bedtime. The central values overlap closely, and neither the box plot nor the density curves indicate a meaningful separation.

  • No substantial difference in sleep efficiency is apparent in this sample.
  • Recent caffeine use is a broad measure; it does not capture dose, timing, or individual sensitivity.
  • This result should not be read as evidence that caffeine never affects sleep.
Caffeine showed little difference chart 1
Caffeine showed little difference chart 2
1 / 2

Lifestyle factor 02

Alcohol intake aligns with lower efficiency

Participants who reported alcohol consumption in the 24 hours before bedtime had a lower median sleep efficiency. The distribution view also shows more alcohol-intake observations at the lower end of the efficiency scale, while the no-alcohol group clusters more heavily toward higher values.

  • The median is visibly lower in the alcohol-intake group.
  • The two distributions overlap, so alcohol intake does not explain every individual outcome.
  • The result is an observed association in this dataset.
Alcohol intake aligns with lower efficiency chart 1
Alcohol intake aligns with lower efficiency chart 2
1 / 2

Lifestyle factor 03

Smoking aligns with lower and more variable efficiency

Smokers had a lower median sleep efficiency and a broader distribution than non-smokers. Non-smoker observations cluster more closely near the upper end of the scale, whereas the smoker distribution includes a more pronounced low-efficiency group.

  • The central 50% of smoker observations is more dispersed.
  • Non-smokers show a stronger concentration around high efficiency values.
  • Smoking status is associated with lower efficiency here, but the analysis does not establish causality.
Smoking aligns with lower and more variable efficiency chart 1
Smoking aligns with lower and more variable efficiency chart 2
1 / 2

1 / 3

Key findings

01

Deep sleep

Higher deep-sleep percentages were positively associated with sleep efficiency.

02

Light sleep

Higher light-sleep percentages had the strongest negative association with efficiency.

03

Exercise

More frequent exercise coincided with higher typical sleep efficiency.

04

Awakenings

Sleep efficiency declined as the number of nighttime awakenings increased.

05

Lifestyle

Alcohol use and smoking were associated with lower efficiency; caffeine showed little difference.

Conclusion

Sleep efficiency is most closely tied to sleep composition and interrupted rest.

  • More deep sleep and less light sleep were associated with higher efficiency.
  • Nighttime awakenings and lower exercise frequency aligned with lower efficiency.
  • Alcohol consumption and smoking aligned with lower efficiency; caffeine did not show a clear effect.
Explore the source dataset ↗