What are the null and alternate hypotheses for your research?
H0:There is no relationship between number of laptop purchased and anti
virus licenses purchased.
H1:There is relationship between number of
laptop purchased and anti virus licenses purchased.
INSTALL REQUIRED PACKAGE
library(readxl)
IMPORT THE EXCEL FILE INTO R STUDIO
dataset <- read_excel("C:/Users/burug/Downloads/A5RQ2.xlsx")
library(psych)
CALCULATE THE DESCRIPTIVE DATA
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
CREATE A HISTOGRAM FOR EACH CONTINUOUS VARIABLE
hist(dataset$Antivirus,
main = "Histogram of V1",
xlab = "Value",
ylab = "Frequency",
col = "lightblue",
border = "black",
breaks = 20)
hist(dataset$Laptop,
main = "Histogram of V2",
xlab = "Value",
ylab = "Frequency",
col = "lightgreen",
border = "black",
breaks = 20)
Answer the questions below as comments within the R script:
Q1)
Check the SKEWNESS of the VARIABLE 1 histogram. In your opinion, does
the histogram look symmetrical, positively skewed, or negatively
skewed?
The Skewness of the variable 1 histogram is positively
skewed
Q2) Check the KURTOSIS of the VARIABLE 1 histogram. In your
opinion, does the histogram look too flat, too tall, or does it have a
proper bell curve?
The Antivirus histogram looks slightly flat but
close to a normal bell curve.
Q3) Check the SKEWNESS of the VARIABLE
2 histogram. In your opinion, does the histogram look symmetrical,
positively skewed, or negatively skewed?
The Skewness of the
variable 2 histogram is positively skewed.
Q4) Check the KUROTSIS of
the VARIABLE 2 histogram. In your opinion, does the histogram look too
flat, too tall, or does it have a proper bell curve?
The Antivirus
histogram looks slightly flat but close to a normal bell curve
CONDUCT THE SHAPIRO-WILK TEST
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
Answer the questions below as a comment within the R script:
Q:Was the data normally distributed for Variable 1?
A:Yes, the data
for Antivirus is normally distributed
Q:Was the data normally
distributed for Variable 2?
A:Yes, the data for Laptop is normally
distributed
LOAD THE PACKAGE
library(ggplot2)
##
## Attaching package: 'ggplot2'
## The following objects are masked from 'package:psych':
##
## %+%, alpha
library(ggpubr)
CREATE THE SCATTERPLOT
ggscatter(dataset, x = "Antivirus", y = "Laptop",
add = "reg.line",
conf.int = TRUE,
cor.coef = TRUE,
cor.method = "pearson",
xlab = "Antivirus", ylab = "Laptop")
Q:Is the relationship positive (line pointing up), negative (line
pointing down), or is there no relationship (line is flat)?
A:The
relationship between Antivirus and Laptop is positive, indicating that
as the number of Antivirus licenses purchased increases, the number of
Laptops purchased also tends to increase.
CONDUCT THE PEARSON CORRELATION
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
Q1) What is the direction of the effect?
A1 : The direction of
the effect is positive. As the number of Antivirus licenses purchased
increases, the number of Laptops purchased also increases.
Q2) What
is the size of the effect?
A2 : The size of the effect is strong.
The correlation coefficient is r = 0.917, which is close to 1.00 and
indicates a strong relationship.
REPORT
A Pearson correlation was conducted to examine the
relationship between the number of Antivirus licenses purchased and the
number of Laptops purchased (n = 122). There was a statistically
significant correlation between Antivirus licenses (M = 50.18, SD =
13.36) and Laptops purchased (M = 40.02, SD = 12.30), r(120) = 0.917, p
< .001. The correlation was positive and strong.As the number of
Antivirus licenses purchased increases, the number of Laptops purchased
also increases.