HYOPOTHESIS

Null Hypothesis:

There is no difference in median sales before and after the marketing campaign.

Alternative Hypothesis:

There is a difference in median sales before and after the marketing campaign.

Load the package

library(readxl)

Import the Excel File

A6R4 <- read_excel("C:\\Users\\Abhigna Thirakanam\\Downloads\\A6R4.xlsx") 

RENAME THE VARIABLES

Before <- A6R4$PreCampaignSales
After <- A6R4$PostCampaignSales

Differences <- After - Before

Histogram

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?

ANSWER: Positively skewed

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

ANSWER:The histogran does not have a proper bell curve shape

SHAPIRO-WILK TEST

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?

ANSWER:data is NOT normal

BOXPLOT

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?

ANSWER: One or two dots.

QUESTION 2: Where are the dots in your boxplot?

ANSWER: Far from the whiskers (lines of the boxplot).

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

ANSWER: The data is not normal.

DESCRIPTIVE STATISTICS

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

DESCRIPTIVES FOR AFTER SCORES

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

WILCOXON SIGN RANK TEST

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

LOAD THE PACKAGE

 library(rstatix)
## 
## Attaching package: 'rstatix'
## The following object is masked from 'package:stats':
## 
##     filter

CALCULATE RANK BISERIAL CORRELATION (EFFECT SIZE)

 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?

ANSWER: A Rank Biserial Correlation of 0.261 indicates the difference between the group averages was moderate.

Q2) Which group had the higher average score?

Answer: The After Campaign scores were higher than the Before Campaign scores.

Research report on results: A Wilcoxon Signed-Rank Test was conducted to compare Pre-Campaign Sales and Post-Campaign Sales across 60 clothing stores. Median sales before the campaign were 24,624, and median sales after the campaign were 25,086. The test revealed a statistically significant increase in sales, V = 640, p = 0.043. These results indicate that the marketing campaign led to a significant increase in store sales.The effect size was r = 0.261, indicating a moderate effect. Overall, the campaign appeared to have a measurable and meaningful positive impact on sales.