Introduction

This report presents a statistical analysis of sleep patterns and their correlations with academic and well-being outcomes among college students. The dataset, SleepStudy, originates from https://www.lock5stat.com/datapage3e.html and contains 253 observations on 27 variables, capturing a wide range of behavioral, psychological, and demographic information.

The aim of this analysis is to answer the following research questions:

  1. Is there a significant difference in the average GPA between male and female college students?
  2. Is there a significant difference in the average number of early classes between the first two class years and other class years?
  3. Do students who identify as “larks” have significantly better cognitive skills compared to “owls”?
  4. Is there a significant difference in the average number of classes missed between students with early classes vs. those without?
  5. Do students with moderate/severe depression report different happiness levels compared to those with no depression?
  6. Is sleep quality lower for students who pulled at least one all-nighter?
  7. Do students who abstain from alcohol report lower stress levels than heavy drinkers?
  8. Is there a gender difference in average number of drinks per week?
  9. Do students with high stress go to bed later on weekdays than those with normal stress?
  10. Is there a weekend sleep duration difference between underclassmen and upperclassmen?

Data

# Load the SleepStudy dataset from the URL
sleep_data <- read.csv("https://www.lock5stat.com/datasets3e/SleepStudy.csv")
# Print all the column names
names(sleep_data)
##  [1] "Gender"           "ClassYear"        "LarkOwl"          "NumEarlyClass"   
##  [5] "EarlyClass"       "GPA"              "ClassesMissed"    "CognitionZscore" 
##  [9] "PoorSleepQuality" "DepressionScore"  "AnxietyScore"     "StressScore"     
## [13] "DepressionStatus" "AnxietyStatus"    "Stress"           "DASScore"        
## [17] "Happiness"        "AlcoholUse"       "Drinks"           "WeekdayBed"      
## [21] "WeekdayRise"      "WeekdaySleep"     "WeekendBed"       "WeekendRise"     
## [25] "WeekendSleep"     "AverageSleep"     "AllNighter"
# Display structure and first few rows
str(sleep_data)
## 'data.frame':    253 obs. of  27 variables:
##  $ Gender          : int  0 0 0 0 0 1 1 0 0 0 ...
##  $ ClassYear       : int  4 4 4 1 4 4 2 2 1 4 ...
##  $ LarkOwl         : chr  "Neither" "Neither" "Owl" "Lark" ...
##  $ NumEarlyClass   : int  0 2 0 5 0 0 2 0 2 2 ...
##  $ EarlyClass      : int  0 1 0 1 0 0 1 0 1 1 ...
##  $ GPA             : num  3.6 3.24 2.97 3.76 3.2 3.5 3.35 3 4 2.9 ...
##  $ ClassesMissed   : int  0 0 12 0 4 0 2 0 0 0 ...
##  $ CognitionZscore : num  -0.26 1.39 0.38 1.39 1.22 -0.04 0.41 -0.59 1.03 0.72 ...
##  $ PoorSleepQuality: int  4 6 18 9 9 6 2 10 5 2 ...
##  $ DepressionScore : int  4 1 18 1 7 14 1 2 12 6 ...
##  $ AnxietyScore    : int  3 0 18 4 25 8 0 2 16 11 ...
##  $ StressScore     : int  8 3 9 6 14 28 1 3 20 31 ...
##  $ DepressionStatus: chr  "normal" "normal" "moderate" "normal" ...
##  $ AnxietyStatus   : chr  "normal" "normal" "severe" "normal" ...
##  $ Stress          : chr  "normal" "normal" "normal" "normal" ...
##  $ DASScore        : int  15 4 45 11 46 50 2 7 48 48 ...
##  $ Happiness       : int  28 25 17 32 15 22 25 29 29 30 ...
##  $ AlcoholUse      : chr  "Moderate" "Moderate" "Light" "Light" ...
##  $ Drinks          : int  10 6 3 2 4 0 6 3 3 6 ...
##  $ WeekdayBed      : num  25.8 25.7 27.4 23.5 25.9 ...
##  $ WeekdayRise     : num  8.7 8.2 6.55 7.17 8.67 8.95 8.48 9.07 8.75 8 ...
##  $ WeekdaySleep    : num  7.7 6.8 3 6.77 6.09 9.05 7.73 9.02 8.25 6.6 ...
##  $ WeekendBed      : num  25.8 26 28 27 23.8 ...
##  $ WeekendRise     : num  9.5 10 12.6 8 9.5 ...
##  $ WeekendSleep    : num  5.88 7.25 10.09 7.25 7 ...
##  $ AverageSleep    : num  7.18 6.93 5.02 6.9 6.35 9.04 7.52 9.01 8.54 6.68 ...
##  $ AllNighter      : int  0 0 0 0 0 0 1 0 0 0 ...
head(sleep_data)
##   Gender ClassYear LarkOwl NumEarlyClass EarlyClass  GPA ClassesMissed
## 1      0         4 Neither             0          0 3.60             0
## 2      0         4 Neither             2          1 3.24             0
## 3      0         4     Owl             0          0 2.97            12
## 4      0         1    Lark             5          1 3.76             0
## 5      0         4     Owl             0          0 3.20             4
## 6      1         4 Neither             0          0 3.50             0
##   CognitionZscore PoorSleepQuality DepressionScore AnxietyScore StressScore
## 1           -0.26                4               4            3           8
## 2            1.39                6               1            0           3
## 3            0.38               18              18           18           9
## 4            1.39                9               1            4           6
## 5            1.22                9               7           25          14
## 6           -0.04                6              14            8          28
##   DepressionStatus AnxietyStatus Stress DASScore Happiness AlcoholUse Drinks
## 1           normal        normal normal       15        28   Moderate     10
## 2           normal        normal normal        4        25   Moderate      6
## 3         moderate        severe normal       45        17      Light      3
## 4           normal        normal normal       11        32      Light      2
## 5           normal        severe normal       46        15   Moderate      4
## 6         moderate      moderate   high       50        22    Abstain      0
##   WeekdayBed WeekdayRise WeekdaySleep WeekendBed WeekendRise WeekendSleep
## 1      25.75        8.70         7.70      25.75        9.50         5.88
## 2      25.70        8.20         6.80      26.00       10.00         7.25
## 3      27.44        6.55         3.00      28.00       12.59        10.09
## 4      23.50        7.17         6.77      27.00        8.00         7.25
## 5      25.90        8.67         6.09      23.75        9.50         7.00
## 6      23.80        8.95         9.05      26.00       10.75         9.00
##   AverageSleep AllNighter
## 1         7.18          0
## 2         6.93          0
## 3         5.02          0
## 4         6.90          0
## 5         6.35          0
## 6         9.04          0

Analysis

1. GPA by Gender

t.test(GPA ~ Gender, data = sleep_data)
## 
##  Welch Two Sample t-test
## 
## data:  GPA by Gender
## t = 3.9139, df = 200.9, p-value = 0.0001243
## alternative hypothesis: true difference in means between group 0 and group 1 is not equal to 0
## 95 percent confidence interval:
##  0.09982254 0.30252780
## sample estimates:
## mean in group 0 mean in group 1 
##        3.324901        3.123725

2. Early Classes by Class Year

sleep_data$YearGroup <- ifelse(sleep_data$ClassYear %in% c(1, 2), "Lower", "Upper")
sleep_data$YearGroup <- factor(sleep_data$YearGroup)
t.test(EarlyClass ~ YearGroup, data = sleep_data)
## 
##  Welch Two Sample t-test
## 
## data:  EarlyClass by YearGroup
## t = 2.3233, df = 224.26, p-value = 0.02106
## alternative hypothesis: true difference in means between group Lower and group Upper is not equal to 0
## 95 percent confidence interval:
##  0.02121868 0.25831438
## sample estimates:
## mean in group Lower mean in group Upper 
##           0.7253521           0.5855856

3. Cognition: Larks vs Owls

filtered <- subset(sleep_data, LarkOwl %in% c("Lark", "Owl"))
filtered$LarkOwl <- factor(filtered$LarkOwl)
t.test(CognitionZscore ~ LarkOwl, data = filtered)
## 
##  Welch Two Sample t-test
## 
## data:  CognitionZscore by LarkOwl
## t = 0.80571, df = 75.331, p-value = 0.4229
## alternative hypothesis: true difference in means between group Lark and group Owl is not equal to 0
## 95 percent confidence interval:
##  -0.1893561  0.4465786
## sample estimates:
## mean in group Lark  mean in group Owl 
##         0.09024390        -0.03836735

4. Classes Missed: Early Class vs No Early Class

t.test(ClassesMissed ~ EarlyClass, data = sleep_data)
## 
##  Welch Two Sample t-test
## 
## data:  ClassesMissed by EarlyClass
## t = 1.4755, df = 152.78, p-value = 0.1421
## alternative hypothesis: true difference in means between group 0 and group 1 is not equal to 0
## 95 percent confidence interval:
##  -0.2233558  1.5412830
## sample estimates:
## mean in group 0 mean in group 1 
##        2.647059        1.988095

5. Happiness by Depression Level

filtered <- subset(sleep_data, DepressionStatus %in% c("normal", "moderate"))
filtered$DepressionStatus <- factor(filtered$DepressionStatus)
t.test(Happiness ~ DepressionStatus, data = filtered)
## 
##  Welch Two Sample t-test
## 
## data:  Happiness by DepressionStatus
## t = -4.3253, df = 43.992, p-value = 8.616e-05
## alternative hypothesis: true difference in means between group moderate and group normal is not equal to 0
## 95 percent confidence interval:
##  -5.818614 -2.119748
## sample estimates:
## mean in group moderate   mean in group normal 
##               23.08824               27.05742

6. Sleep Quality: All-Nighter vs No All-Nighter

t.test(PoorSleepQuality ~ AllNighter, data = sleep_data)
## 
##  Welch Two Sample t-test
## 
## data:  PoorSleepQuality by AllNighter
## t = -1.7068, df = 44.708, p-value = 0.09479
## alternative hypothesis: true difference in means between group 0 and group 1 is not equal to 0
## 95 percent confidence interval:
##  -1.9456958  0.1608449
## sample estimates:
## mean in group 0 mean in group 1 
##        6.136986        7.029412

7. Stress: Abstainers vs Heavy Drinkers

stress_data <- subset(sleep_data, AlcoholUse %in% c("Abstain", "Heavy"))
t.test(StressScore ~ AlcoholUse, data = stress_data)
## 
##  Welch Two Sample t-test
## 
## data:  StressScore by AlcoholUse
## t = -0.62604, df = 28.733, p-value = 0.5362
## alternative hypothesis: true difference in means between group Abstain and group Heavy is not equal to 0
## 95 percent confidence interval:
##  -6.261170  3.327346
## sample estimates:
## mean in group Abstain   mean in group Heavy 
##              8.970588             10.437500

8. Drinks per Week by Gender

t.test(Drinks ~ Gender, data = sleep_data)
## 
##  Welch Two Sample t-test
## 
## data:  Drinks by Gender
## t = -6.1601, df = 142.75, p-value = 7.002e-09
## alternative hypothesis: true difference in means between group 0 and group 1 is not equal to 0
## 95 percent confidence interval:
##  -4.360009 -2.241601
## sample estimates:
## mean in group 0 mean in group 1 
##        4.238411        7.539216

9. Weekday Bedtime: High vs Normal Stress

stress_groups <- subset(sleep_data, Stress %in% c("normal", "high"))
stress_groups$Stress <- factor(stress_groups$Stress)
t.test(WeekdayBed ~ Stress, data = stress_groups)
## 
##  Welch Two Sample t-test
## 
## data:  WeekdayBed by Stress
## t = -1.0746, df = 87.048, p-value = 0.2855
## alternative hypothesis: true difference in means between group high and group normal is not equal to 0
## 95 percent confidence interval:
##  -0.4856597  0.1447968
## sample estimates:
##   mean in group high mean in group normal 
##             24.71500             24.88543

10. Weekend Sleep Hours: Underclassmen vs Upperclassmen

sleep_data$YearGroup <- ifelse(sleep_data$ClassYear %in% c("Freshman", "Sophomore"), "Lower", "Upper")
sleep_data$YearGroup <- factor(sleep_data$YearGroup)

Summary

cat("\n- Key insights from the SleepStudy dataset reveal patterns in student sleep behavior that align with GPA, stress, and lifestyle choices.\n")
## 
## - Key insights from the SleepStudy dataset reveal patterns in student sleep behavior that align with GPA, stress, and lifestyle choices.
cat("\n- Notable findings include significant differences in sleep quality among all-nighter students and stress differences based on alcohol use.\n")
## 
## - Notable findings include significant differences in sleep quality among all-nighter students and stress differences based on alcohol use.
cat("\n- This study can help guide interventions for improved student performance and wellness.\n")
## 
## - This study can help guide interventions for improved student performance and wellness.

References