2026-10-18

Research Question

Is physical activity associated with longer sleep duration?

We will examine the relationship between:

  • Physical activity (minutes per day)
  • Sleep duration (hours)

Using correlation and linear regression, we will determine the strength of this relationship.

Why Does This Matter?

Sleep is essential for physical health, mental well-being, and daily performance.

Exercise is often recommended as a way to improve sleep, but how strong is the relationship?

Goal: Examine whether physical activity is associated with sleep duration.

Dataset Overview

Dataset: Sleep Health and Lifestyle Dataset (Kaggle)

  • 374 observations and 13 variables
  • Physical Activity Level: Minutes of activity per day
  • Sleep Duration: Hours of sleep per day
  • Quality of Sleep: Rating from 1–10

Goal: Examine whether physical activity is associated with sleep duration and quality.

Physical Activity vs. Sleep Duration

Understanding Correlation

Correlation measures the strength and direction of a linear relationship.

\[ r = \frac{\operatorname{Cov}(X,Y)}{\sigma_X \sigma_Y} \]

  • r = 1: Perfect positive correlation
  • r = 0: No linear correlation
  • r = -1: Perfect negative correlation

Correlation Results

Pearson Correlation: r = 0.2124

  • There is a weak positive correlation between exercise and sleep duration.
  • People with higher activity levels tend to sleep slightly longer.
  • However, the correlation is fairly weak, so exercise isn’t a strong predictor of sleep duration.

Key Insight: Physical activity and sleep duration are positively correlated, but other factors may also influence sleep.

Linear Regression

Linear regression models the relationship between physical activity and sleep duration.

\[ \hat{y} = b_0 + b_1x \]

Where:

  • \(\hat{y}\) = Predicted sleep duration (hours)
  • \(x\) = Physical activity (minutes/day)
  • \(b_0\) = Intercept
  • \(b_1\) = Slope

Goal: Estimate how sleep duration changes with physical activity.

Predicting Sleep Duration

Regression Results

Regression Equation:

\[ \widehat{Sleep} = 6.6521 + 0.00811(Activity) \]

Key Findings:

  • An additional 30 minutes of activity is associated with approximately 14.6 more minutes of predicted sleep.
  • \(R^2 = 0.0451\): Only 4.5% of sleep variation is explained by activity.
  • \(p < 0.001\): The relationship is statistically significant.

Insight: Exercise has a weak but statistically significant positive association with sleep duration.

R Code: Statistical Analysis

# Calculate Pearson correlation
cor(sleep$Physical.Activity.Level,
    sleep$Sleep.Duration)

# Fit a linear regression model
model <- lm(Sleep.Duration ~ Physical.Activity.Level,
            data = sleep)

# Display regression results
summary(model)

Interactive Visualization

Conclusion

Is physical activity associated with longer sleep?

Our analysis found:

  • A weak positive correlation between physical activity and sleep duration (r = 0.2124).
  • Physical activity explained only 4.5% of the variation in sleep duration.
  • The relationship was statistically significant (p < 0.001).

Takeaway: More physical activity is associated with slightly longer sleep, but the relationship is weak.

Limitation: The dataset is synthetic, and correlation does not establish causation.

Data Source