DEPENDENT T-TEST & WILCOXON SIGN RANK
Used to test if there is a difference between Before scores and
After scores (comparing the means).
NULL HYPOTHESIS (H0)
The null hypothesis is ALWAYS used.
There is no difference in sales after the Campaign.
ALTERNATE HYPOTHESIS (H1)
Choose ONE of the three options below (based on your research
scenario):
2) DIRECTIONAL ALTERNATE HYPOTHESES: There is a difference in sales
after the campaign
IMPORT EXCEL FILE
Purpose: Import your Excel dataset into R to conduct analyses.
install.packages(“readxl”)
library(readxl)
dataset <- read_excel("/Users/mac/Downloads/A6R4.xlsx")
CALCULATE THE DIFFERENCE SCORES
Calculate the difference between the Before scores versus the after
scores.
Before <- dataset$PreCampaignSales
After <- dataset$PostCampaignSales
Differences <- After - Before
HISTOGRAM
Create a histogram for difference scores to visually check skewness
and kurtosis.
hist(Differences,
main = "Histogram of Difference Scores",
xlab = "Value",
ylab = "Frequency",
col = "blue",
border = "black",
breaks = 20)

WRITE THE REPORT
Q1) Is the histograms symmetrical, positively skewed, or negatively
skewed?
#It is positively skewed # Q2) Did the histogram look too flat, too
tall, or did it have a proper bell curve? # It is too flat
SHAPIRO-WILK TEST
Check the normality for the difference between the groups.
CONDUCT SHAPIRO-WILK TEST
shapiro.test(Differences)
##
## Shapiro-Wilk normality test
##
## data: Differences
## W = 0.94747, p-value = 0.01186
QUESTIONS
Q1)Was the data normally distributed or abnormally distributed?
It was abnormally distributed
If p > 0.05 (P-value is GREATER than .05) this means the data is
NORMAL (continue with Dependent t-test).
If p < 0.05 (P-value is LESS than .05) this means the data is NOT
normal (switch to Wilcoxon Sign Rank).
BOXPLOT
Check for any outliers impacting the mean.
CREATE THE BOXPLOT
Boxplot of Difference Scores
boxplot(Before, After,
names = c("Before", "After"),
main = "Boxplot of Before and After Scores",
col = c("lightblue", "lightgreen"))

QUESTIONS
Q1) Were there any dots outside of the boxplot? Are these dots close
to the whiskers of the boxplot or are they very far away?yes
If there are no dots, continue with Dependent t-test
If there are a few dots (two or less), and they are close to the
whiskers, continue with Dependent t-test.
If there are a few dots (two or less), and they are far away from
the whiskers, consider switching to Wilcoxon Sign Rank.
If there are many dots (more than one or two) and they are very far
away from the whiskers, you should switch to a Wilcoxon Sign Rank.
.
DESCRIPTIVE STATISTICS
Calculate the mean, median, SD, and sample size for each group.
DESCRIPTIVES FOR BEFORE SCORES
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
Summary Paragraph:
The Wilcoxon Signed-Rank Test was used to compare the sales during
the campaign with those after the campaign to compare the sales of 60
individuals. The findings indicated that the sales were positively
significantly higher during the post-campaign period (Median = 25,086)
as compared to pre-campaign period (Median = 24,624) V = 640, p =.043.
The effect size = 0.26 which is moderate. According to these findings,
the campaign had statistically significant impact on increase in
sales.