In order to be more competitive in the market, a technology store wants to start selling their laptops and anti-virus software as a bundle to small businesses. A bundle is when two products are sold together at a lower price than if they were purchased separately. Before offering the bundle, the store wants to make sure the two products are commonly purchased together. The store has data from the past year showing how many laptops and how many anti-virus software licenses each small business bought from them. Analyze the data to determine if there is a positive correlation between the number of laptops purchased and the number of anti-virus licenses purchased.
There is no significant relationship between the number of laptops purchased and the number of anti-virus licenses purchased by small businesses.
There is a significant positive relationship between the number of laptops purchased and the number of anti-virus licenses purchased by small businesses.
A Pearson correlation was used because both variables were normally distributed, as indicated by the Shapiro–Wilk normality tests.
A Pearson correlation was conducted to examine the relationship between no. 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 no. of laptops purchased (M = 40.02, SD = 12.30). The correlation was positive and strong, r = 0.91, p < .05.As the number of laptop purchases increases, no. of antivirus licence purchases increases.
# ============================================================
# IMPORT DATASET
# ============================================================
# Load the readxl package to import Excel files
library(readxl)
# Import your dataset
dataset <- read_excel("C:/Users/Nithin Kumar Adki/Downloads/A5RQ2.xlsx")
# ============================================================
# DESCRIPTIVE STATISTICS
# ============================================================
# Install the psych package
# install.packages("psych")
# Load the psych package to compute descriptive statistics
library(psych)
# Calculate descriptive statistics for both variables
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
# ============================================================
# HISTOGRAMS TO CHECK NORMALITY VISUALLY
# ============================================================
# Create histogram for Antivirus (Variable 1)
hist(dataset$Antivirus,
main = "Histogram of V1",
xlab = "Value",
ylab = "Frequency",
col = "lightblue",
border = "black",
breaks = 20)
# Create histogram for Laptop (Variable 2)
hist(dataset$Laptop,
main = "Histogram of V2",
xlab = "Value",
ylab = "Frequency",
col = "lightgreen",
border = "black",
breaks = 20)
# ============================================================
# SHAPIRO-WILK NORMALITY TESTS
# ============================================================
# Test normality for Antivirus variable
shapiro.test(dataset$Antivirus)
##
## Shapiro-Wilk normality test
##
## data: dataset$Antivirus
## W = 0.99419, p-value = 0.8981
# Test normality for Laptop variable
shapiro.test(dataset$Laptop)
##
## Shapiro-Wilk normality test
##
## data: dataset$Laptop
## W = 0.99362, p-value = 0.8559
# ============================================================
# SCATTERPLOT
# ============================================================
# Install required packages for scatterplot
# install.packages("ggplot2")
# install.packages("ggpubr")
# Load the plotting packages
library(ggplot2)
##
## Attaching package: 'ggplot2'
## The following objects are masked from 'package:psych':
##
## %+%, alpha
library(ggpubr)
# Create a scatterplot with a regression line
ggscatter(dataset, x = "Antivirus", y = "Laptop",
add = "reg.line",
conf.int = TRUE,
cor.coef = TRUE,
cor.method = "pearson",
xlab = "Variable V1", ylab = "Variable V2")
# ============================================================
# CORRELATION TEST (Pearson)
# ============================================================
# Since Shapiro-Wilk showed NORMAL results, we use Pearson
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