Introduction

We use data from https://www.lock5stat.com/datapage3e.html to answer the following questions.

Analysis

We will use different statistical methods to explore the questions.

Q1: Is there a significant difference in the average GPA between male and female college students?

t_test_1 <- t.test(GPA ~ Gender, data = college, alternative = "two.sided")
print(t_test_1)
## 
##  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

The data above shows the difference in the average GPA between male and female college students.

Q2: Is there a significant difference in the average number of early classes between the first two class years and other class years?

college$ClassGroup <- ifelse(college$ClassYear %in% c(1, 2), "FirstTwoYears", "OtherYears")

t_test_2 <- t.test(NumEarlyClass ~ ClassGroup, data = college)
print(t_test_2)
## 
##  Welch Two Sample t-test
## 
## data:  NumEarlyClass by ClassGroup
## t = 4.1813, df = 250.69, p-value = 4.009e-05
## alternative hypothesis: true difference in means between group FirstTwoYears and group OtherYears is not equal to 0
## 95 percent confidence interval:
##  0.4042016 1.1240309
## sample estimates:
## mean in group FirstTwoYears    mean in group OtherYears 
##                    2.070423                    1.306306

The data above shows the difference in the average number of early classes between the first two class years and other class years.

Q3: Do students who identify as “larks” have significantly better cognitive skills (cognition z-score) compared to “owls”?

college_subset <- subset(college, LarkOwl %in% c("Lark","Owl"))
t_test_3 <- t.test(CognitionZscore ~ LarkOwl, data = college_subset, alternative = "greater")
print(t_test_3)
## 
##  Welch Two Sample t-test
## 
## data:  CognitionZscore by LarkOwl
## t = 0.80571, df = 75.331, p-value = 0.2115
## alternative hypothesis: true difference in means between group Lark and group Owl is greater than 0
## 95 percent confidence interval:
##  -0.1372184        Inf
## sample estimates:
## mean in group Lark  mean in group Owl 
##         0.09024390        -0.03836735

The data above shows the cognitive skill difference between morning people and night people.

Q4: Is there a significant difference in the average number of classes missed in a semester between students who had at least one early class (EarlyClass=1) and those who didn’t (EarlyClass=0)?

t_test_4 <- t.test(ClassesMissed ~ EarlyClass, data = college, alternative = "two.sided")
print(t_test_4)
## 
##  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

The data above shows the difference in the average number of classes missed in a semester between students who had at least one early class compared to those who did not.

Q5: Is there a significant difference in the average happiness level between students with at least moderate depression and normal depression status?

college$DepressionGroup <- ifelse(college$DepressionScore >= 10, "ModerateOrHigher", "Normal")
t_test_5 <- t.test(Happiness ~ DepressionGroup, data = college)
print(t_test_5)
## 
##  Welch Two Sample t-test
## 
## data:  Happiness by DepressionGroup
## t = -5.6339, df = 55.594, p-value = 6.057e-07
## alternative hypothesis: true difference in means between group ModerateOrHigher and group Normal is not equal to 0
## 95 percent confidence interval:
##  -7.379724 -3.507836
## sample estimates:
## mean in group ModerateOrHigher           mean in group Normal 
##                       21.61364                       27.05742

The data above shows the difference in the average happiness level between students with at least moderate depression compared to students with normal depression.

Q6: Is there a significant difference in average sleep quality scores between students who reported having at least one all-nighter (AllNighter=1) and those who didn’t (AllNighter=0)?

t_test_6 <- t.test(AverageSleep ~ AllNighter, data = college)
print(t_test_6)
## 
##  Welch Two Sample t-test
## 
## data:  AverageSleep by AllNighter
## t = 4.4256, df = 42.171, p-value = 6.666e-05
## alternative hypothesis: true difference in means between group 0 and group 1 is not equal to 0
## 95 percent confidence interval:
##  0.4366603 1.1685667
## sample estimates:
## mean in group 0 mean in group 1 
##        8.073790        7.271176

The data above shows the difference in average sleep quality scores between students who have had at least one all-nighter compared to students who have not.

Q7: Do students who abstain from alcohol use have significantly better stress scores than those who report heavy alcohol use?

college_subset <- subset(college, AlcoholUse %in% c("Abstain","Heavy"))
t_test_7 <- t.test(StressScore ~ AlcoholUse, data = college_subset, alternative = "less")
print(t_test_7)
## 
##  Welch Two Sample t-test
## 
## data:  StressScore by AlcoholUse
## t = -0.62604, df = 28.733, p-value = 0.2681
## alternative hypothesis: true difference in means between group Abstain and group Heavy is less than 0
## 95 percent confidence interval:
##      -Inf 2.515654
## sample estimates:
## mean in group Abstain   mean in group Heavy 
##              8.970588             10.437500

The data above shows the difference in stress levels between students who abstain from alcohol and students who report heavy alcohol use.

Q8: Is there a significant difference in the average number of drinks per week between students of different genders?

t_test_8 <- t.test(Drinks ~ Gender, data = college)
print(t_test_8)
## 
##  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

The data above shows the difference in the average number of drinks per week between female and male students.

Q9: Is there a significant difference in the average weekday bedtime between students with high and low stress (Stress=High vs. Stress=Normal)?

college$StressGroup <- ifelse(college$StressScore >= 15, "HighStress", "LowStress")
t_test_9 <- t.test(WeekdayBed ~ StressGroup, data = college, alternative = "two.sided")
print(t_test_9)
## 
##  Welch Two Sample t-test
## 
## data:  WeekdayBed by StressGroup
## t = -1.0746, df = 87.048, p-value = 0.2855
## alternative hypothesis: true difference in means between group HighStress and group LowStress is not equal to 0
## 95 percent confidence interval:
##  -0.4856597  0.1447968
## sample estimates:
## mean in group HighStress  mean in group LowStress 
##                 24.71500                 24.88543

The data above shows the difference in the average weekday bedtime between students with high and low stress levels.

Q10: Is there a significant difference in the average hours of sleep on weekends between first two year students and other students?

college$YearGroup <- ifelse(college$ClassYear %in% c(1, 2), "FirstTwoYears", "OtherYears")
t_test_10 <- t.test(WeekendSleep ~ YearGroup, data = college)
print(t_test_10)
## 
##  Welch Two Sample t-test
## 
## data:  WeekendSleep by YearGroup
## t = -0.047888, df = 237.36, p-value = 0.9618
## alternative hypothesis: true difference in means between group FirstTwoYears and group OtherYears is not equal to 0
## 95 percent confidence interval:
##  -0.3497614  0.3331607
## sample estimates:
## mean in group FirstTwoYears    mean in group OtherYears 
##                    8.213592                    8.221892

The data above shows the difference in the average hours of sleep on weekends between first two year students compared to other students.

Summary

Exploring Sleep Patterns This project looked at sleep patterns and habits of college students using the SleepStudy dataset. It compared groups based on gender, class year, whether they were larks or owls, early classes, depression level, alcohol use, and stress. The results showed clear differences between these groups in GPA, cognition, class attendance, happiness, sleep quality, and hours of sleep. Overall, the findings show that students’ daily habits and well-being are closely connected to how well they sleep.