1 Introduction

This report presents an analysis of sleep patterns among college students, utilizing the “SleepStudy” dataset obtained from https://www.lock5stat.com/datapage3e.html. The dataset comprises 253 observations on 27 variables, providing valuable insights into the sleep habits, psychological well-being, and lifestyle choices of college students.

The primary objective of this analysis is to address a series of research questions by examining the dataset. The questions explored in this report aim to shed light on various aspects of college students’ sleep patterns, their academic performance, psychological well-being, and lifestyle choices. The results of this analysis offer valuable insights into the factors affecting students’ sleep and related outcomes, providing a basis for further research and interventions to improve students’ overall well-being and academic performance.

summary(cars)
##      speed           dist       
##  Min.   : 4.0   Min.   :  2.00  
##  1st Qu.:12.0   1st Qu.: 26.00  
##  Median :15.0   Median : 36.00  
##  Mean   :15.4   Mean   : 42.98  
##  3rd Qu.:19.0   3rd Qu.: 56.00  
##  Max.   :25.0   Max.   :120.00

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

data= read.csv("https://www.lock5stat.com/datasets3e/SleepStudy.csv")
head(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
  1. Is there a significant difference in the average GPA between male and female college students?
t.test(GPA ~ Gender, data = data, 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
  1. Is there a significant difference in the average number of early classes between the first two class years and other class years?
data$ClassYear <- ifelse(data$ClassYear%in% c ("1","2"), "Group 1", "Group 2")
t.test(NumEarlyClass ~ ClassYear, data = data, alternative = "two.sided")
## 
##  Welch Two Sample t-test
## 
## data:  NumEarlyClass by ClassYear
## t = 4.1813, df = 250.69, p-value = 0.00004009
## alternative hypothesis: true difference in means between group Group 1 and group Group 2 is not equal to 0
## 95 percent confidence interval:
##  0.4042016 1.1240309
## sample estimates:
## mean in group Group 1 mean in group Group 2 
##              2.070423              1.306306
  1. Do students who identify as “larks” have significantly better cognitive skills (cognition z-score) compared to “owls”?
data$schedule <- ifelse (data$LarkOwl %in% c("Owl","Neither"),"notLark","Lark")

t.test(CognitionZscore ~ schedule, data = data, alternative = "two.sided")
## 
##  Welch Two Sample t-test
## 
## data:  CognitionZscore by schedule
## t = 0.78217, df = 50.956, p-value = 0.4377
## alternative hypothesis: true difference in means between group Lark and group notLark is not equal to 0
## 95 percent confidence interval:
##  -0.1688076  0.3842954
## sample estimates:
##    mean in group Lark mean in group notLark 
##             0.0902439            -0.0175000
  1. 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)?
data$AllNighter <- ifelse(data$AllNighter %in% c ("1")," 1 all nighter at least","0 all nighter")
t.test(PoorSleepQuality~AllNighter, data=data, 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
  1. Do students who abstain from alcohol use have significantly better stress scores than those who report heavy alcohol use?
data$AlcoholUseGroup <- ifelse(data$AlcoholUse %in% c ("Abstain","Light"),"Low use","high use")
t.test(StressScore~AlcoholUseGroup, data=data, 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 high use and group Low use is not equal to 0
## 95 percent confidence interval:
##  -1.722125  2.217223
## sample estimates:
## mean in group high use  mean in group Low use 
##               9.580882               9.333333

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

data$Stress <- ifelse(data$Stress%in% c ("normal"),"normal stress students","high stress")
t.test(WeekdayBed~ Stress, data=data, alternative = "two.sided")
## 
##  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 stress and group normal stress students is not equal to 0
## 95 percent confidence interval:
##  -0.4856597  0.1447968
## sample estimates:
##            mean in group high stress mean in group normal stress students 
##                             24.71500                             24.88543
  1. Is there a significant difference in the average hours of sleep on weekends between male and female students?
data$YearGroup <- ifelse(data$Gender%in% c ("1"),"male","female")
t.test(WeekendSleep~YearGroup, data=data, alternative = "two.sided")
## 
##  Welch Two Sample t-test
## 
## data:  WeekendSleep by YearGroup
## t = -0.73864, df = 240.83, p-value = 0.4608
## alternative hypothesis: true difference in means between group female and group male is not equal to 0
## 95 percent confidence interval:
##  -0.4579118  0.2081572
## sample estimates:
## mean in group female   mean in group male 
##             8.166887             8.291765
  1. 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)?
data$Earlyclass <- ifelse(data$EarlyClass %in% c ("0"),"no early classes"," 1 Early Class")
t.test(ClassesMissed ~ Earlyclass , data=data, alternative="two.sided")
## 
##  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  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  1 Early Class mean in group no early classes 
##                       1.988095                       2.647059
  1. Is there a significant difference in the average happiness level between students with at least moderate depression and normal depression status?
data$D <- ifelse(data$AnxietyStatus %in% c ("moderate","severe"),"median depression","normal depression")
t.test(Happiness~D, data=data, 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 median depression and group normal depression is not equal to 0
## 95 percent confidence interval:
##  -5.453097 -2.117038
## sample estimates:
## mean in group median depression mean in group normal depression 
##                        23.40278                        27.18785
  1. Is there a significant difference in the average number of drinks per week between students of different genders?
data$Gend <- ifelse(data$Gender%in% c ("0"),"Men","Women")
t.test(Drinks~ Gend, data=data, 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 Men and group Women is not equal to 0
## 95 percent confidence interval:
##  -4.360009 -2.241601
## sample estimates:
##   mean in group Men mean in group Women 
##            4.238411            7.539216

#Summary

In summary, the objective of this analysis was to explore research questions regarding college students’ sleep patterns, academic performance, psychological well-being, and lifestyle choices. The outcomes of the analysis provide valuable insights into the factors influencing students’ sleep and related outcomes, which can inform future research and interventions aimed at enhancing students’ well-being and academic success.