1.Introduction

The current study examines college students’ sleep patterns using the “SleepStudy” dataset collected from https://www.lock5stat.com/datapage3e.html. The dataset contains 253 observations over 27 categories, giving useful insights on college students’ sleep habits, psychological well-being, and lifestyle choices.

The major goal of this study is to answer a number of research questions by evaluating the dataset. The questions raised in this research are intended to give insight on numerous elements of college students’ sleep habits, academic performance, psychological well-being, and lifestyle choices. The findings of this analysis provide useful insights into the factors influencing students’ sleep and associated outcomes, laying the groundwork for future research and interventions to improve students’ general well-being and academic success.

2.data

load the lessR package

library(lessR)
## 
## lessR 4.3.8                         feedback: gerbing@pdx.edu 
## --------------------------------------------------------------
## > d <- Read("")   Read text, Excel, SPSS, SAS, or R data file
##   d is default data frame, data= in analysis routines optional
## 
## Many examples of reading, writing, and manipulating data, 
## graphics, testing means and proportions, regression, factor analysis,
## customization, and descriptive statistics from pivot tables
##   Enter: browseVignettes("lessR")
## 
## View lessR updates, now including time series forecasting
##   Enter: news(package="lessR")
## 
## Interactive data analysis
##   Enter: interact()
## 
## Attaching package: 'lessR'
## The following object is masked from 'package:base':
## 
##     sort_by

read data

study = read.csv("https://www.lock5stat.com/datasets3e/SleepStudy.csv")
head(study)
##   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

3. Analysis

we will explore these questions in details

-1.Is there a significant difference in the average GPA between male and female college students?

t.test(GPA~Gender, data=study, alternative = "two.sided")
## 
##  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.Is there a significant difference in the average number of early classes between the first two class years and other class years?

study$ClassYearGroup <- ifelse(study$ClassYear%in% c ("1","2"),"LowerClass","UpperClass")
t.test(NumEarlyClass~ClassYearGroup, data=study, alternative = "two.sided")
## 
##  Welch Two Sample t-test
## 
## data:  NumEarlyClass by ClassYearGroup
## t = 4.1813, df = 250.69, p-value = 0.00004009
## alternative hypothesis: true difference in means between group LowerClass and group UpperClass is not equal to 0
## 95 percent confidence interval:
##  0.4042016 1.1240309
## sample estimates:
## mean in group LowerClass mean in group UpperClass 
##                 2.070423                 1.306306

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

study$ClassPreference <- ifelse(study$LarkOwl %in% c ("Lark"),"Lark","Owl and Neither")
t.test(CognitionZscore ~ ClassPreference , data=study, alternative="two.sided")
## 
##  Welch Two Sample t-test
## 
## data:  CognitionZscore by ClassPreference
## t = 0.78217, df = 50.956, p-value = 0.4377
## alternative hypothesis: true difference in means between group Lark and group Owl and Neither is not equal to 0
## 95 percent confidence interval:
##  -0.1688076  0.3842954
## sample estimates:
##            mean in group Lark mean in group Owl and Neither 
##                     0.0902439                    -0.0175000

-4.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)?

study$EA <- ifelse(study$EarlyClass %in% c ("1"),"at least 1 early class","no early classes")
t.test(ClassesMissed ~ EA , data=study, alternative="two.sided")
## 
##  Welch Two Sample t-test
## 
## data:  ClassesMissed by EA
## t = -1.4755, df = 152.78, p-value = 0.1421
## alternative hypothesis: true difference in means between group at least 1 early class and group no early classes is not equal to 0
## 95 percent confidence interval:
##  -1.5412830  0.2233558
## sample estimates:
## mean in group at least 1 early class       mean in group no early classes 
##                             1.988095                             2.647059

-5.Is there a significant difference in the average anxiety level between students with at least moderate depression and normal depression status?

study$D <- ifelse(study$AnxietyStatus %in% c ("moderate","severe"),"moderate depression","normal depression")
t.test(Happiness~D, data=study, alternative = "two.sided")
## 
##  Welch Two Sample t-test
## 
## data:  Happiness by D
## t = -4.5016, df = 100.68, p-value = 0.00001816
## alternative hypothesis: true difference in means between group moderate depression and group normal depression is not equal to 0
## 95 percent confidence interval:
##  -5.453097 -2.117038
## sample estimates:
## mean in group moderate depression   mean in group normal depression 
##                          23.40278                          27.18785

-6.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)?

study$AllNighter <- ifelse(study$AllNighter %in% c ("1")," 1 all nighter at least","0 all nighter")
t.test(PoorSleepQuality~AllNighter, data=study, alternative = "two.sided")
## 
##  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  1 all nighter at least and group 0 all nighter is not equal to 0
## 95 percent confidence interval:
##  -0.1608449  1.9456958
## sample estimates:
## mean in group  1 all nighter at least           mean in group 0 all nighter 
##                              7.029412                              6.136986

-7.Do students who abstain from alcohol use have significantly better stress scores than those who report heavy alcohol use?

study$AlcoholUseGroup <- ifelse(study$AlcoholUse %in% c ("Abstain","Light"),"Low alcohol use","heavy alcohol use")
t.test(StressScore~AlcoholUseGroup, data=study, alternative = "two.sided")
## 
##  Welch Two Sample t-test
## 
## data:  StressScore by AlcoholUseGroup
## t = 0.24753, df = 248.92, p-value = 0.8047
## alternative hypothesis: true difference in means between group heavy alcohol use and group Low alcohol use is not equal to 0
## 95 percent confidence interval:
##  -1.722125  2.217223
## sample estimates:
## mean in group heavy alcohol use   mean in group Low alcohol use 
##                        9.580882                        9.333333

-8.Is there a significant difference in the average number of drinks per week between students of different genders?

study$Gend <- ifelse(study$Gender%in% c ("0"),"female","male")
t.test(Drinks~ Gend, data=study, alternative = "two.sided")
## 
##  Welch Two Sample t-test
## 
## data:  Drinks by Gend
## t = -6.1601, df = 142.75, p-value = 0.000000007002
## alternative hypothesis: true difference in means between group female and group male is not equal to 0
## 95 percent confidence interval:
##  -4.360009 -2.241601
## sample estimates:
## mean in group female   mean in group male 
##             4.238411             7.539216

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

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

-10.Is there a significant difference in the average hours of sleep on weekends between first two year students and other students

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

4. summary

looking back to the main goal of this project which was to answer a number of research questions by evaluating the dataset we can say that we successfully reached our main goal by providing an insight on numerous elements of college students’ sleep habits, academic performance, psychological well-being, and lifestyle choices