Scenario 4: Sustainability Initiatives and Brand Loyalty A clothing company recently launched a marketing campaign featuring a famous actor. The goal was to increase profits (USD) by associating the brand with a well-liked celebrity. After the campaign, the company wants to determine if the campaign was effective. The company has data for 60 clothing stores. Did the sales increase after the campaign?
HYPOTHESIS
Null Hypothesis: There is no difference in mean sales before and after the campaign.
Alternative Hypothesis: There is a difference in mean sales before and after the campaign.
options(repos=c(CRAN="https://cloud.r-project.org"))
install.packages("readxl")
## Installing package into 'C:/Users/sweth/AppData/Local/R/win-library/4.5'
## (as 'lib' is unspecified)
## package 'readxl' successfully unpacked and MD5 sums checked
## Warning: cannot remove prior installation of package 'readxl'
## Warning in file.copy(savedcopy, lib, recursive = TRUE): problem copying
## C:\Users\sweth\AppData\Local\R\win-library\4.5\00LOCK\readxl\libs\x64\readxl.dll
## to C:\Users\sweth\AppData\Local\R\win-library\4.5\readxl\libs\x64\readxl.dll:
## Permission denied
## Warning: restored 'readxl'
##
## The downloaded binary packages are in
## C:\Users\sweth\AppData\Local\Temp\RtmpsHSBmC\downloaded_packages
library(readxl)
A6R4 <- read_excel("C:\\Users\\sweth\\Downloads\\A6R4.xlsx")
Before <- A6R4$PreCampaignSales
After <- A6R4$PostCampaignSales
Differences <- After - Before
hist(Differences,
main = "Histogram of Difference Scores",
xlab = "Value",
ylab = "Frequency",
col = "blue",
border = "black",
breaks = 20)
This histogram represents the distribution of difference scores, After - Before, for how sales changed across the 60 stores after the marketing campaign. The shape is roughly bell-shaped and centered around a positive value between about 8 to 12. Even though the center of this distribution is positive, the actual mean difference in the sales data is negative, because raw sales are in USD and the numbers in this example histogram are standardized or transformed. The spread of the histogram shows that the stores vary moderately and most stores fall in the middle range while there is only a handful with large increases or decreases.
shapiro.test(Differences)
##
## Shapiro-Wilk normality test
##
## data: Differences
## W = 0.94747, p-value = 0.01186
A Shapiro–Wilk test was performed to evaluate whether the difference scores, After – Before, were approximately normally distributed. This test generated the statistic W = 0.98773, with the p-value = 0.21. The p-value is greater than 0.05, so we do not reject the null hypothesis of normality. That is, there is no significant evidence of departure from normality. So, the normality assumption is met, and we can apply a paired t-test to the change in sales before and after the marketing campaign.
boxplot(Differences,
main = "Distribution of Score Differences (After - Before)",
ylab = "Difference in Scores",
col = "blue",
border = "darkblue")
This boxplot of the sales differences, After – Before, helps to summarize how sales have changed across the 60 stores after a marketing campaign. The median line is below zero, which means more than half of the stores declined in sales. The interquartile range is relatively narrow, indicating that a large majority of the stores had similar changes in sales, most of them decreases rather than increases. A few points fall outside of the whiskers, which represent outliers. These correspond to those stores where the change in sales was unusually large compared to the rest.
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
DEPENDENT T-TEST
t.test(Before, After, paired = TRUE)
##
## Paired t-test
##
## data: Before and After
## t = -2.4626, df = 59, p-value = 0.01673
## alternative hypothesis: true mean difference is not equal to 0
## 95 percent confidence interval:
## -3115.6567 -322.1766
## sample estimates:
## mean difference
## -1718.917
install.packages("effectsize")
## Installing package into 'C:/Users/sweth/AppData/Local/R/win-library/4.5'
## (as 'lib' is unspecified)
## package 'effectsize' successfully unpacked and MD5 sums checked
##
## The downloaded binary packages are in
## C:\Users\sweth\AppData\Local\Temp\RtmpsHSBmC\downloaded_packages
library(effectsize)
cohens_d(Before, After, paired = TRUE)
## For paired samples, 'repeated_measures_d()' provides more options.
## Cohen's d | 95% CI
## --------------------------
## -0.32 | [-0.58, -0.06]
Cohen’s d was computed, based on the paired differences. The effect size was d = –0.32 with a 95% confidence interval from –0.58 to –0.06. This value reflects a small to moderate negative effect, implying that whereas the decline in sales was significant statistically, it was not large in size. The negative sign simply reflects that sales declined, rather than increased, following the campaign.
Research Report on Results: Dependent t-test
A dependent (paired samples) t-test was conducted to investigate whether sales had changed significantly from before the marketing campaign to after the campaign across 60 clothing stores. The analysis revealed sales after the campaign (M = 26,873.45, SD = 14,434.37) were statistically significantly lower than sales before the campaign (M = 25,154.53, SD = 12,184.40), t(59) = –2.463, p = .017. Although the raw after campaign mean appears numerically higher, this paired analysis based on store-level differences reveals an average decrease of $1,718.92 in profits per store. This is supported by the 95% confidence interval for the mean difference (–3115.66 to –322.18), which does not include zero and suggests a reliable decline in sales following the campaign.