hypotheses
Null hypotheses: There is no relationship between number of laptops purchased and the number of anti-virus licenses purchased.
Alternate hypotheses: There is a relationship between number of laptops purchased and the number of anti-virus licenses purchased.
Result
A pearson correlation was conducted to assess the relationship between number of laptops purchased and the number of anti-virus licenses purchased (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 strong cor=0.92, p < .001.As number of laptops purchased increases, number of anti-virus licenses purchased increases.Thus the alternate hypotheses is supported and there is strong relationship between number of laptops purchased and the number of anti-virus licenses purchased.
#install.packages("readxl")
library(readxl)
dataset <- read_excel("~/Downloads/A5RQ2.xlsx")
#install.packages("psych")
library(psych)
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
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
#install.packages("ggplot2")
#install.packages("ggpubr")
library(ggplot2)
##
## Attaching package: 'ggplot2'
## The following objects are masked from 'package:psych':
##
## %+%, alpha
library(ggpubr)
ggscatter(dataset, x = "Antivirus", y = "Laptop",
add = "reg.line",
conf.int = TRUE,
cor.coef = TRUE,
cor.method = "pearson",
xlab = "Variable Antivirus", ylab = "Variable Laptop")
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