10월 26, 2025

Overview: Tea, Sleep Connection

Background

  • Tea is more than a drink. It is part of daily relaxation and bedtime routines. Many people sip tea in the evening to unwind. Depending on tea types, it may include caffeine that can delay sleep onset and reduce total sleep. This leads to a practical question for everyday behavior : does drinking tea later at night reduce how long we sleep?.

Scientific Evidence

Key ideas

  • Modeled sleep duration as a function of tea time and test whether the slope is negative.
  • Formula : \(\text{Sleep} = \beta_0 + \beta_1 \cdot \text{Tea Time} + \varepsilon\)
  • Expecting : \(\beta_1 < 0\)

Dataset: Tea Consumption and Sleep

Dataset overview

  • Note : Illustrative data for demonstration purposes
  • Each row : one person/day
  • X : Time of Tea (24 hours), Y : Sleep Duration (hours)
  • Type : Green / Black / Herbal
  • Goal : Test if later tea time makes shorter sleep

Table

ID time sleep tea_type
1 13 8.0 Green
2 15 7.7 Black
3 17 7.0 Herbal
4 19 6.8 Green
5 21 6.0 Black
6 23 5.5 Herbal
7 14 7.9 Green
8 16 7.5 Black
9 18 6.9 Herbal

Modeling: Tea, Sleep Relationship

Goal : Does drinking tea later affects less sleep?

Formula

Model : \(\text{Sleep} = \color{green}{\beta_0} + \color{green}{\beta_1} \cdot \text{Tea Time} + \varepsilon\)

Interpretation

  • \(\beta_0\): baseline sleep
  • \(\beta_1\): change in sleep for a +1 hour later tea time
  • Expect : \(\beta_1 < 0\)

Hypotheses

  • \(H_0:\ \beta_1 = 0\): No effect
  • \(H_1:\ \beta_1 < 0\): Later tea → Less sleep

Analyzing: Tea’s Effect on Sleep

Data Source Note : This is example data for learning. I have created it based on a real study that found caffeine reduces sleep time. The numbers aren’t real, but the pattern is realistic.

mod <- lm(sleep ~ time, data = df)
summary(mod)
Call:
lm(formula = sleep ~ time, data = df)

Residuals:
      Min        1Q    Median        3Q       Max 
-0.151938 -0.086822  0.006202  0.064341  0.196899 

Coefficients:
            Estimate Std. Error t value Pr(>|t|)    
(Intercept) 11.50775    0.23725   48.51 4.14e-10 ***
time        -0.25814    0.01347  -19.16 2.63e-07 ***
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Residual standard error: 0.125 on 7 degrees of freedom
Multiple R-squared:  0.9813,    Adjusted R-squared:  0.9786 
F-statistic:   367 on 1 and 7 DF,  p-value: 2.63e-07

Evidence: Later Tea, Less Sleep

ggplot(aes(x = time, y = sleep), data = df) + geom_point(aes(color = tea_type),
    size = 4, alpha = 1) + geom_smooth(method = "lm", se = TRUE,
    color = "black", fill = "lightgreen") + labs(x = "Time of Tea",
    y = "Sleep Duration", title = "Tea Timing Effect on Sleep Duration",
    color = "Tea Type")

Graph Explanation : Dot colors indicate tea type: red (=Black), green (=Green), and blue (=Herbal). The brownish dots are Black tea (because of the filled color). The black line is the linear regression fit, the light-green band is the confidence interval, and later tea times are associated with less sleep.

Sleep Patterns in Our Sample

Note : Tea types were consumed at different times in this data.

ggplot(aes(x = tea_type, y = sleep, fill = tea_type), data = df) +
    geom_boxplot(alpha = 0.6) + geom_jitter(width = 0.2, size = 3,
    alpha = 0.7) + labs(x = "Tea Type", y = "Sleep Duration",
    title = "Sleep Duration by Tea Type")

Graph Explanation : Black dots are the actual data points (one person/day), jittered so they don’t overlap. The colored boxplots summarize each tea type.

3D View: Tea Time, Type, and Sleep Together

df$tea_numeric <- as.numeric(df$tea_type)

xax <- list(title = "Time of Tea", titlefont = list(family = "Poppins",
    size = 14))
yax <- list(title = "Sleep Duration", titlefont = list(family = "Poppins",
    size = 14))
zax <- list(title = "Tea Type", titlefont = list(family = "Poppins",
    size = 14))

plot_ly(df, x = ~time, y = ~sleep, z = ~tea_numeric, color = ~tea_type,
    colors = c("grey", "green", "skyblue"), type = "scatter3d",
    mode = "markers", marker = list(size = 8)) %>%
    layout(scene = list(xaxis = xax, yaxis = yax, zaxis = zax),
        title = list(text = "3D View: Time, Sleep, and Tea Type",
            font = list(family = "Poppins", size = 18)))

Graph Explanation : 3D scatter with time of tea on the x-axis, sleep hours on the y-axis, and tea type on the z-axis, dot colors are gray for Black, green for Green, and blue for Herbal, and the dots show that drinking tea later goes with less sleep while types were often consumed at different times.

Key Findings

Regression Output

  • Slope-\(\beta_1\) : Approximately -0.25 hours per hour later.
  • Interpretation : For every 1 hour later tea is consumed, sleep decreases by ~0.25 hours.
  • Statistical Significance : Strong negative relationship (p < 0.05).

Conclusion

  • Clear evidence that drinking tea later → less sleep
  • Limitation : Tea type and time are confounded in this data
  • Cannot separate effect of tea type from timing effect