library(readxl)
library(ggpubr)
## Loading required package: ggplot2
ds2 <- read_excel("~/Downloads/ds2.xlsx")
                                                                                                         
ggscatter(
     ds2,
     x = "sleep",
     y = "phone",
     add = "reg.line",
     xlab = "sleep",
     ylab = "phone"
 )

The relationship is linear. The relationship is negative. The relationship is medium to strong. There are no outliers.

mean(ds2$sleep)
## [1] 7.559076
sd(ds2$sleep)
## [1] 1.208797
median(ds2$sleep)
## [1] 7.524099
mean(ds2$phone)
## [1] 3.804609
sd(ds2$phone)
## [1] 2.661866
median(ds2$phone)
## [1] 3.270839
hist(ds2$sleep,
      main = "sleep",
      breaks = 20,
      col = "lightblue",
      border = "white",
      cex.main = 1,
      cex.axis = 1,
      cex.lab = 1)

hist(ds2$phone,
      main = "phone",
      breaks = 20,
      col = "lightcoral",
      border = "white",
      cex.main = 1,
      cex.axis = 1,
      cex.lab = 1)

Variable 1: sleep The first variable looks abnormally distributed. The data is negatively skewed. The data has a proper bell curve.

Variable 2: phone The second variable looks abnormally distributed. The data is positively skewed. The data has a proper bell curve.

shapiro.test(ds2$sleep)
## 
##  Shapiro-Wilk normality test
## 
## data:  ds2$sleep
## W = 0.91407, p-value = 8.964e-08
shapiro.test(ds2$phone)
## 
##  Shapiro-Wilk normality test
## 
## data:  ds2$phone
## W = 0.89755, p-value = 9.641e-09

Variable 1: sleep The first variable is normally distributed (p = 8.96). Variable 2: phone The second variable is normally distributed (p = 9.64).

cor.test(ds2$sleep, ds2$phone, method = "pearson")
## 
##  Pearson's product-moment correlation
## 
## data:  ds2$sleep and ds2$phone
## t = -11.813, df = 148, p-value < 2.2e-16
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  -0.7708489 -0.6038001
## sample estimates:
##        cor 
## -0.6966497

A Pearson correlation was conducted to test the relationship between a person’s sleep in hours (M = 7.56, SD = 1.21) and a person’s phone use in hours (M = 3.80, SD = 2.66). There was a statistically significant relationship between the two variables, r(148) = -.70, p > .05. The relationship was negative and strong. As sleep increased, phone use decreased.