Hypothesis

Null hypotheses :- There is no difference in sales (USD) before and after the marketing campaign.

Alternate Hypotheses :- There is a difference in sales (USD) before and after the marketing campaign.

Result:

A Wilcoxon Signed-Rank Test was conducted to compare sales (USD) before and after the marketing campaign among (n = 60) stores. Median sales were significantly higher after the campaign (M = 26873.45 ,Md = 25,086 ,Sd = 14434.37) than before the campaign (M = 25154.53, Md = 24,624, Sd = 12184.4), V = 640, p = 0.043. The effect size was r = 0.261, indicating a moderate effect. Thus alternate hypotheses is supported, that there is a difference in sales (USD) before and after the marketing campaign.

# install.packages("readxl")
library(readxl)
dataset <- read_excel("~/Downloads/A6R4.xlsx")
Before <- dataset$PreCampaignSales
After <- dataset$PostCampaignSales

Differences <- After - Before
hist(Differences,
     main = "Histogram of Difference Scores",
     xlab = "Value",
     ylab = "Frequency",
     col = "blue",
     border = "black",
     breaks = 20)

QUESTION 1: Is the histograms symmetrical, positively skewed, or negatively skewed?

The histogram is symmetrical

QUESTION 2: Did the histogram look too flat, too tall, or did it have a proper bell curve?

The histogram look too tall

shapiro.test(Differences)
## 
##  Shapiro-Wilk normality test
## 
## data:  Differences
## W = 0.94747, p-value = 0.01186

QUESTION 1: Was the data normally distributed or abnormally distributed?

The data is abnormally distributed

boxplot(Differences,
        main = "Distribution of Score Differences (After - Before)",
        ylab = "Difference in Scores",
        col = "blue",
        border = "darkblue")

QUESTION 1: How many dots are in your boxplot?

One or two dots.

QUESTION 2: Where are the dots in your boxplot?

Far from the whiskers (lines of the boxplot).

QUESTION 3: Based on the dots and there location, is the data normal?

If there are many dots (more than one or two) and they are FAR AWAY from the whiskers, this means data is NOT normal. Switch to a Wilcoxon Sign Rank.

mean(Before, na.rm = TRUE)
## [1] 25154.53
median(Before, na.rm = TRUE)
## [1] 24624
sd(Before, na.rm = TRUE)
## [1] 12184.4
length(Before)
## [1] 60
mean(After, na.rm = TRUE)
## [1] 26873.45
median(After, na.rm = TRUE)
## [1] 25086
sd(After, na.rm = TRUE)
## [1] 14434.37
length(After)
## [1] 60
wilcox.test(Before, After, paired = TRUE)
## 
##  Wilcoxon signed rank test with continuity correction
## 
## data:  Before and After
## V = 640, p-value = 0.0433
## alternative hypothesis: true location shift is not equal to 0
#install.packages("rstatix")
#install.packages("coin")
library(coin)
## Loading required package: survival
library(rstatix)
## 
## Attaching package: 'rstatix'
## The following objects are masked from 'package:coin':
## 
##     chisq_test, friedman_test, kruskal_test, sign_test, wilcox_test
## The following object is masked from 'package:stats':
## 
##     filter
df_long <- data.frame(
id = rep(1:length(Before), 2),
time = rep(c("Before", "After"), each = length(Before)),
score = c(Before, After) )

wilcox_effsize(df_long, score ~ time, paired = TRUE)
## # A tibble: 1 × 7
##   .y.   group1 group2 effsize    n1    n2 magnitude
## * <chr> <chr>  <chr>    <dbl> <int> <int> <ord>    
## 1 score After  Before   0.261    60    60 small

Q1) What is the size of the effect?

A Cohen’s D of 0.26 indicates the difference between the group averages was moderate.

Q2) Which group had the higher average score?

The After scores were higher than the before scores.