```{r} library(readxl) library(ggpubr) A5Q2 <- read_excel(“C:/Users/User/Downloads/A5Q2.xlsx”) ggscatter( A5Q2, x = “sleep”, y = “phone”, add = “reg.line”, xlab = “sleep”, ylab = “phone” ) # The relationship is linear. # The relationship is negative. # There are outliers. mean(A5Q2\(sleep) sd(A5Q2\)sleep) median(A5Q2$sleep)
mean(A5Q2\(phone) sd(A5Q2\)phone) median(A5Q2\(phone) hist(A5Q2\)sleep, main = ” sleep”, breaks = 20, col = “lightblue”, border = “white”, cex.main = 1, cex.axis = 1, cex.lab = 1)
hist(A5Q2$phone, main = “phone”, breaks = 20, col = “lightcoral”, border = “white”, cex.main = 1, cex.axis = 1, cex.lab = 1) # Variable 1: sleep # The variable looks abnormally distributed. # The data is negatively skewed. # The data does not have a proper bell curve.
shapiro.test(A5Q2$sleep)
shapiro.test(A5Q2$phone) # Variable 1: Sleep # The variable is abnormally distributed (p = .00).
cor.test( A5Q2\(sleep, A5Q2\)phone, method = “spearman” ) # A Spearman correlation was conducted to test the relationship between sleep (Mdn = 7.52) and phone (Mdn = 3.27).