# Load required packages
library(readxl)
library(psych)
library(ggplot2)
##
## Attaching package: 'ggplot2'
## The following objects are masked from 'package:psych':
##
## %+%, alpha
library(ggpubr)
H0:There is no relationship between Antivirus and Laptop.
H1:There is a relationship between Antivirus and Laptop.
Directional: As Antivirus increase, Laptop increase Or decrease
dataset <- read_excel("C:/Users/konifade/Downloads/A5RQ2.xlsx")
head(dataset)
## # A tibble: 6 × 3
## Business Antivirus Laptop
## <dbl> <dbl> <dbl>
## 1 1 42 31
## 2 2 47 36
## 3 3 73 68
## 4 4 51 38
## 5 5 52 43
## 6 6 76 61
describe(dataset[, c("Antivirus", "Laptop")])
## vars n mean sd median trimmed mad min max range skew
## Antivirus 1 122 50.18 13.36 49 49.92 12.60 15 83 68 0.15
## Laptop 2 122 40.02 12.30 39 39.93 11.86 8 68 60 -0.01
## kurtosis se
## Antivirus -0.14 1.21
## Laptop -0.32 1.11
Comment: Antivirus: M = 50.18, SD = 13.36, skew = 0.15, kurtosis = –0.14. Laptop: M = 40.02, SD = 12.30, skew = –0.01, kurtosis = –0.32. Both variables are approximately symmetric.
hist(dataset$Antivirus,
main = "Histogram of Antivirus",
xlab = "Value",
ylab = "Frequency",
col = "lightblue",
border = "black",
breaks = 20)
hist(dataset$Laptop,
main = "Histogram of Laptop",
xlab = "Value",
ylab = "Frequency",
col = "lightgreen",
border = "black",
breaks = 20)
shapiro.test(dataset$Antivirus)
##
## Shapiro-Wilk normality test
##
## data: dataset$Antivirus
## W = 0.99419, p-value = 0.8981
shapiro.test(dataset$Laptop)
##
## Shapiro-Wilk normality test
##
## data: dataset$Laptop
## W = 0.99362, p-value = 0.8559
ggscatter(dataset, x = "Antivirus", y = "Laptop",
add = "reg.line",
conf.int = TRUE,
cor.coef = TRUE,
cor.method = "pearson",
xlab = "Variable Antivirus", ylab = "Variable Laptop")
The scatterplot shows a strong positive linear relationship between Antivirus and Laptop. The relationship is positive-Line pointing up (As Antivirus increases, Laptop also increases. The line slopes upward from left to right.)
cor.test(dataset$Antivirus, dataset$Laptop, method = "pearson")
##
## Pearson's product-moment correlation
##
## data: dataset$Antivirus and dataset$Laptop
## t = 25.16, df = 120, p-value < 2.2e-16
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
## 0.8830253 0.9412249
## sample estimates:
## cor
## 0.9168679
r(120) = 0.92, p < .001
95% CI [0.88, 0.94] This indicates a very strong, statistically significant positive correlation.
A Pearson correlation was conducted to examine the relationship between Antivirus and Laptop (n = 122). There was a statistically significant correlation between Antivirus (M = 50.18, SD = 13.36) and Laptop (M = 40.02, SD = 12.30). The correlation was positive and very strong, r(120) = 0.92, p < .001, 95% CI [0.88, 0.94]. As Antivirus scores increase, Laptop scores also increase.
Comment
Both variables have p-values > 0.05, indicating they are normally distributed.
Antivirus: W = 0.99419, p-value = 0.8981
Laptop: W = 0.99362, p-value = 0.8559