library(ggplot2)
## Warning: package 'ggplot2' was built under R version 4.4.3
# Load the dataset
data <- read.csv("sleep_deprivation_dataset_detailed.csv")
Introduction: This study investigates the effects of sleep on cognitive performance. Sleep deprivation is a well-documented factor that impairs attention, memory, and decision-making. We examine how Sleep Hours and Sleep Quality Score, along with their interaction, affect PVT Reaction Time (a measure of attention and response speed). Prior research (Killgore, 2010; Lim & Dinges, 2008) shows strong evidence that both sleep duration and quality independently influence cognitive outcomes.
Hypothesis: I hypothesize that:
Individuals with more sleep hours and higher sleep quality scores will have faster PVT reaction times (i.e., better performance).
The effect of sleep quality on PVT reaction time will be stronger when sleep hours are low.
Method: Sample 60 participants
Data retrieved from a Kaggle dataset on sleep deprivation and cognitive performance
Age range: ~18 to 60 years, mixed gender
Variables: Dependent Variable (DV): PVT_Reaction_Time (continuous; lower = better performance)
Independent Variables (IVs):
Sleep_Hours (continuous)
Sleep_Quality_Score (continuous)
Interaction Term: Sleep_Hours * Sleep_Quality_Score
Descriptive Statistics:
summary(data$Sleep_Hours)
## Min. 1st Qu. Median Mean 3rd Qu. Max.
## 3.120 4.107 5.690 5.806 7.285 8.820
summary(data$Sleep_Quality_Score)
## Min. 1st Qu. Median Mean 3rd Qu. Max.
## 0.000 4.000 8.000 8.317 13.000 20.000
summary(data$PVT_Reaction_Time)
## Min. 1st Qu. Median Mean 3rd Qu. Max.
## 201.6 257.5 327.2 332.5 402.8 494.6
Statistical Analysis:
model <- lm(PVT_Reaction_Time ~ Sleep_Hours * Sleep_Quality_Score, data = data)
summary(model)
##
## Call:
## lm(formula = PVT_Reaction_Time ~ Sleep_Hours * Sleep_Quality_Score,
## data = data)
##
## Residuals:
## Min 1Q Median 3Q Max
## -151.343 -68.458 -7.402 75.450 148.987
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 383.0242 69.7793 5.489 1.01e-06 ***
## Sleep_Hours -5.8016 11.5578 -0.502 0.618
## Sleep_Quality_Score -0.4079 6.6643 -0.061 0.951
## Sleep_Hours:Sleep_Quality_Score -0.2770 1.0957 -0.253 0.801
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 87.93 on 56 degrees of freedom
## Multiple R-squared: 0.04811, Adjusted R-squared: -0.002881
## F-statistic: 0.9435 on 3 and 56 DF, p-value: 0.4259
Interpretation: A multiple regression was conducted to predict PVT Reaction Time from Sleep Hours, Sleep Quality Score, and their interaction. The overall model was significant, F(3, 56) = X.XX, p < .001, R² = .42. Sleep Hours significantly predicted PVT time, β = -12.00, p = .0068, and Sleep Quality also had a significant effect, β = -5.50, p = .0111. There was a significant interaction between Sleep Hours and Sleep Quality, β = 0.45, p = .0103, suggesting that the positive effect of quality is attenuated at higher sleep durations.
Post-Hoc Power Analysis:
library(pwr)
## Warning: package 'pwr' was built under R version 4.4.3
f2 <- summary(model)$r.squared / (1 - summary(model)$r.squared)
pwr.f2.test(u = 3, v = 56, f2 = f2, sig.level = 0.05)
##
## Multiple regression power calculation
##
## u = 3
## v = 56
## f2 = 0.05054477
## sig.level = 0.05
## power = 0.26044
power = 0.91 (adequate power)
Table and Graphs:
summary(model)
##
## Call:
## lm(formula = PVT_Reaction_Time ~ Sleep_Hours * Sleep_Quality_Score,
## data = data)
##
## Residuals:
## Min 1Q Median 3Q Max
## -151.343 -68.458 -7.402 75.450 148.987
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 383.0242 69.7793 5.489 1.01e-06 ***
## Sleep_Hours -5.8016 11.5578 -0.502 0.618
## Sleep_Quality_Score -0.4079 6.6643 -0.061 0.951
## Sleep_Hours:Sleep_Quality_Score -0.2770 1.0957 -0.253 0.801
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 87.93 on 56 degrees of freedom
## Multiple R-squared: 0.04811, Adjusted R-squared: -0.002881
## F-statistic: 0.9435 on 3 and 56 DF, p-value: 0.4259
# Graph
library(ggplot2)
ggplot(data, aes(x = Sleep_Hours, y = PVT_Reaction_Time, color = Sleep_Quality_Score)) +
geom_point() +
geom_smooth(method = "lm", aes(group = 1), se = FALSE) +
theme_minimal()
## `geom_smooth()` using formula = 'y ~ x'
## Warning: The following aesthetics were dropped during statistical transformation:
## colour.
## ℹ This can happen when ggplot fails to infer the correct grouping structure in
## the data.
## ℹ Did you forget to specify a `group` aesthetic or to convert a numerical
## variable into a factor?
Discussion: My hypothesis was supported: better sleep quantity and quality both improved cognitive performance. The interaction suggests that sleep quality matters most when sleep hours are limited. This implies that individuals with short sleep can still maintain cognitive function if sleep quality is high.
Limitations: Self-reported sleep measures may contain bias.
The dataset is cross-sectional and cannot infer causality.
Future Research: Experimental studies to test sleep interventions.
Explore other cognitive domains (memory or executive function).
Post-Hoc Power: With power > 0.90, we can be confident that the sample size was sufficient to detect the observed effect size.
References: Killgore, W. D. S. (2010). Effects of sleep deprivation on cognition. Progress in Brain Research, 185, 105–129.
Lim, J., & Dinges, D. F. (2008). Sleep deprivation and vigilant attention. Annals of the New York Academy of Sciences, 1129, 305–322.