A data science project analyzing the impact of sleep duration on health outcomes using real-world lifestyle data. We conduct exploratory data analysis (EDA) and apply A/B testing to investigate correlations and statistically significant differences across groups.
- Cleaned and analyzed a dataset of 374 individuals
- Explored trends using histograms, pie charts, and correlation heatmaps
- Applied Welch's t-test to compare health outcomes between:
- Treatment group: Sleep ≥ median hours
- Control group: Sleep < median hours
Participants were split based on median sleep duration:
- Treatment Group: Sleep ≥ median
- Control Group: Sleep < median
We tested whether sleep duration affects:
- Stress Level
- Heart Rate
- Quality of Sleep
- Physical Activity Level
Results were statistically tested using Welch's t-test.
We chose Welch's t-test over the standard Student's t-test because:
- Unequal sample sizes between treatment and control groups
- Different variances across health outcome variables
- Welch’s t-test does not assume equal variance or group size
- More robust for real-world, observational data like ours
We split the dataset into two groups based on median sleep duration and ran Welch’s t-test on each key metric:
| Metric | T-statistic | P-value | Significant |
|---|---|---|---|
| Stress Level | -16.299 | 0.0000 | Yes |
| Heart Rate | -7.962 | 0.0000 | Yes |
| Quality of Sleep | 23.309 | 0.0000 | Yes |
| Physical Activity Level | 7.068 | 0.0000 | Yes |
I ranked each metric based on the absolute value of the t-statistic — the higher the value, the stronger the observed effect from increased sleep duration.
| Rank | Metric | T-statistic | Interpretation |
|---|---|---|---|
| 1 | Quality of Sleep | 23.309 | Most impacted — people who sleep more report dramatically higher sleep quality. |
| 2 | Stress Level | -16.299 | Strong inverse relationship — more sleep means lower stress. |
| 3 | Heart Rate | -7.962 | Moderate effect — better sleep linked to lower resting heart rate. |
| 4 | Physical Activity Level | 7.068 | Still significant — slightly higher physical activity with more sleep. |
- Sleep Quality shows the strongest positive effect from longer sleep duration.
- Stress Levels notably decrease with more sleep — highlighting mental health benefits.
- Heart Rate and Activity Level also benefit, but with comparatively smaller effects.
-
Clone the repo:
git clone https://github.com/yourname/sleep-ab-test.git cd sleep-ab-test -
Add your kaggle.json file to the root.
-
Install dependencies (recommended: uv):
uv venv uv pip install -r pyproject.toml
-
Run data download script:
python src/download_data.py



