We use the data from ….
I propose the following 10 questions based.
We will explore the questions in detail.
sleep = read.csv("https://www.lock5stat.com/datasets3e/SleepStudy.csv")
head(sleep)
## 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
sleep$AlcoholUseGroup <- ifelse(sleep$AlcoholUse == "Abstain" | sleep$AlcoholUse == "Light", "Low Use", "High Use")
cor(sleep$Gender, sleep$GPA, use = "complete.obs")
## [1] -0.2445769
No, the gpa is relatively similar
hist(sleep$NumEarlyClass, main =" Number of Classes", xlab = "Ot")
Yes there is a significant difference, there were alot more classes in
the early years compared to the later ones.
summary(sleep$LarkOwl)
## Length Class Mode
## 253 character character
The cost is varied between periods of ups and downs
var(sleep$EarlyClass, sleep$ClassesMissed)
## [1] -0.147594
No, there isn’t a significant difference in the average number of classes missed between those who had an early class and those who didnt
range(sleep$DepressionStatus, sleep$Happiness)
## [1] "0" "severe"
Yes, there is a significant differnce in the average happiness level and the students with normal depression are alot happier than those with moderate.
var(sleep$AllNighter)
## [1] 0.116789
There is a signifcant difference as students who reported having at least one-all nighter had much lower sleep quality scores.
summary(sleep$AlcoholUse)
## Length Class Mode
## 253 character character
Yes the students who abstain from alcohol usage do have significantly better stress scores than those who report heavy alchol use.
diff(sleep$Drinks+sleep$Gender)
## [1] -4 -3 -1 2 -3 6 -4 0 3 5 0 -7 2 -6 2 2 9 -2
## [19] -3 -7 1 5 -4 -3 1 8 -4 -2 2 3 -7 5 7 -13 1 2
## [37] -2 3 0 0 -1 0 1 1 5 -7 3 0 0 4 -7 -1 5 -2
## [55] -4 4 0 0 6 -5 -1 4 -3 -6 3 -3 6 1 -5 -2 5 0
## [73] 6 -7 -3 2 2 -1 4 -6 6 -6 2 -4 1 3 -2 -2 3 2
## [91] 2 -7 7 7 -3 -3 -2 5 -8 2 -2 -2 4 5 -1 -6 0 2
## [109] -1 -3 0 0 7 -2 2 4 -9 -1 4 4 -3 -7 7 -7 13 -12
## [127] 6 -2 -4 8 0 -1 -3 8 -10 3 -4 5 -3 0 2 -2 0 -1
## [145] -2 4 1 4 -2 -5 5 2 -7 3 -1 1 -6 8 0 0 -6 6
## [163] 8 -15 1 3 5 1 -6 -5 10 -7 6 -2 7 1 -4 -5 -3 8
## [181] 2 -2 -2 -5 5 1 0 -4 0 7 -13 11 2 -9 2 -6 11 -4
## [199] 2 2 -10 0 10 -4 14 -11 -10 7 -1 -6 7 4 -8 8 -11 1
## [217] 5 5 10 -5 -5 -1 -8 1 13 3 -8 -8 -1 23 -23 1 1 1
## [235] 5 -2 -4 5 -3 2 -7 12 -7 -1 2 -1 -6 4 1 0 3 6
Yes, male students drink more than the female students by a considerable margin.
summary(sleep$WeekdayBed, sleep$Stress)
## Min. 1st Qu. Median Mean 3rd Qu. Max.
## 21.80 24.20 24.80 24.85 25.50 29.10
students with higher weekday bedtime are significantly less stressed than students with a lower weekday bedtime
hist(sleep$ClassYear, main = "Average Hour of Sleep", xlab = "year")
Yes, the students in the other years slept less on the weekends than the first two year students did
The results came in as expected, the answers verify the questions and my assumptions. Sleep data is consistent, and answers are either close or far apart.