This report analyzes whether two different in-store advertisement types affect grape juice sales. Advertisement type 0 represents the natural-production advertisement, while advertisement type 1 represents the family-health advertisement. A Welch independent-samples t-test will be used to compare the average sales between the two groups.
Null hypothesis (H₀): There is no difference in average grape juice sales between the natural-production advertisement and the family-health advertisement.
Alternative hypothesis (H₁): There is a difference in average grape juice sales between the two advertisement types.
data <- read.csv("grapeJuice.csv")
head(data)
## X Sales price ad_type price_apple price_cookies
## 1 1 222 9.83 0 7.36 8.80
## 2 2 201 9.72 1 7.43 9.62
## 3 3 247 10.15 1 7.66 8.90
## 4 4 169 10.04 0 7.57 10.26
## 5 5 317 8.38 1 7.33 9.54
## 6 6 227 9.74 0 7.51 9.49
summary(data)
## X Sales price ad_type price_apple
## Min. : 1.00 Min. :131.0 Min. : 8.200 Min. :0.0 Min. :7.300
## 1st Qu.: 8.25 1st Qu.:182.5 1st Qu.: 9.585 1st Qu.:0.0 1st Qu.:7.438
## Median :15.50 Median :204.5 Median : 9.855 Median :0.5 Median :7.580
## Mean :15.50 Mean :216.7 Mean : 9.738 Mean :0.5 Mean :7.659
## 3rd Qu.:22.75 3rd Qu.:244.2 3rd Qu.:10.268 3rd Qu.:1.0 3rd Qu.:7.805
## Max. :30.00 Max. :335.0 Max. :10.490 Max. :1.0 Max. :8.290
## price_cookies
## Min. : 8.790
## 1st Qu.: 9.190
## Median : 9.515
## Mean : 9.622
## 3rd Qu.:10.140
## Max. :10.580
hist(data$Sales,
main = "Histogram Plot for Sales Data",
xlab = "Sales_Grape",
prob = TRUE)
lines(density(data$Sales),
lty = "dashed",
lwd = 2.5,
col = "blue")
The histogram shows that most grape juice sales are concentrated between approximately 150 and 250 units. The dashed blue density line shows the overall shape of the sales distribution.
sales_ad_nature <- subset(data, ad_type == 0)
sales_ad_family <- subset(data, ad_type == 1)
mean(sales_ad_nature$Sales)
## [1] 186.6667
mean(sales_ad_family$Sales)
## [1] 246.6667
The average sales for the natural-production advertisement were 186.6667 units. The average sales for the family-health advertisement were 246.6667 units. Therefore, the family-health advertisement had the higher average sales.
shapiro.test(sales_ad_nature$Sales)
##
## Shapiro-Wilk normality test
##
## data: sales_ad_nature$Sales
## W = 0.94255, p-value = 0.4155
shapiro.test(sales_ad_family$Sales)
##
## Shapiro-Wilk normality test
##
## data: sales_ad_family$Sales
## W = 0.89743, p-value = 0.08695
The Shapiro-Wilk test produced a p-value of 0.4155 for the natural-production advertisement and 0.08695 for the family-health advertisement. Both p-values are greater than 0.05, so the data do not show a significant violation of the normality assumption.
t.test(Sales ~ ad_type, data = data)
##
## Welch Two Sample t-test
##
## data: Sales by ad_type
## t = -3.7515, df = 25.257, p-value = 0.0009233
## alternative hypothesis: true difference in means between group 0 and group 1 is not equal to 0
## 95 percent confidence interval:
## -92.92234 -27.07766
## sample estimates:
## mean in group 0 mean in group 1
## 186.6667 246.6667
The Welch independent-samples t-test produced a t-value of -3.7515, with 25.257 degrees of freedom and a p-value of 0.0009233. Because the p-value is less than 0.05, I reject the null hypothesis. There is a statistically significant difference in average grape juice sales between the two advertisement types.
The family-health advertisement had higher average sales at 246.6667 units compared with 186.6667 units for the natural-production advertisement. Based on these results, the family-health advertisement appears to be more effective.
R programming could add value to my career for several reasons. First, R can analyze large datasets more efficiently than manually completing calculations in Excel. Second, R makes analysis reproducible because the same script can be saved, checked, and reused when new data are added. Third, R provides powerful statistical tests and professional-quality graphs that can help businesses understand patterns and make better decisions. Learning R would improve my technical skills and make me more competitive for careers involving marketing analytics, business intelligence, research, or data analysis.