library(ggplot2)
library(dplyr)
# Loading the dataset
data <- [Link]("/Users/prem/Downloads/marketing_campaign.csv", sep = ",")
# [Link] Non-Graphical - Categorical (Marital_Status)
marital_status_counts <- table(data$Marital_Status)
print(marital_status_counts)
##Absurd Alone Divorced Married Single Together Widow YOLO
## 2 3 232 857 471 573 76 2
##Finding: The most frequent marital status in the dataset is "Married," followed by
"Together" (in a relationship). Single, divorced, and widow customers form a smaller
portion of the customer base, indicating that most customers are in long-term
relationships.
##2.
recency_summary <- summary(data$Recency)
print(recency_summary)
##Min. 1st Qu. Median Mean 3rd Qu. Max.
##0.00 24.00 49.00 49.01 74.00 99.00
##Finding: The average recency is around 49 days, with some customers having made
purchases very recently (within a few days), while others have not made a purchase in
several months. This indicates a mix of highly engaged and less engaged customers.
#3 Multivariate Non-Graphical - Categorical (Marital Status vs Response)
marital_response_crosstab <- table(data$Marital_Status, data$Response)
print(marital_response_crosstab)
## 0 1
## Absurd 1 1
##Alone 2 1
## Divorced 184 48
## Married 759 98
##Single 365 106
##Together 513 60
## Widow 58 18
##YOLO 1 1
##Finding: Married customers are more likely to respond positively to campaigns
compared to single or divorced customers. This suggests that marital status may influence
how customers react to promotions.
#4. Multivariate Non-Graphical - Correlation between MntFishProducts and
MntSweetProducts
fish_sweet_correlation <- cor(data$MntFishProducts, data$MntSweetProducts, use =
"[Link]")
print(fish_sweet_correlation)
##0.583867
##Finding: The correlation between spending on fish and sweet products is weak,
indicating that these are independent purchases. Customers who spend heavily on one
product category do not necessarily spend much on the other.
##[Link] Graphical - Bar Plot of Response
ggplot(data, aes(x = factor(Response))) +
geom_bar(fill = "lightblue") +
labs(title = "Response to Last Campaign", x = "Response", y = "Count")
##Finding: A large proportion of customers did not respond positively to the campaign, with
fewer than 20% accepting the offer. This suggests that the campaign could be further
optimized to increase engagements.
##6. Univariate Graphical - Histogram of Recency
ggplot(data, aes(x = Recency)) +
geom_histogram(binwidth = 10, fill = "lightgreen", color = "black") +
labs(title = "Recency of Last Purchase", x = "Days Since Last Purchase", y = "Frequency")
##Finding: The histogram shows a right-skewed distribution, with a significant number of
customers making purchases within the last 30 days. However, a substantial portion of
customers have not made purchases in over 50 days, indicating varying engagement levels.
##7. Multivariate Graphical - Stacked Bar Plot of AcceptedCmp3 by Education
ggplot(data, aes(x = Education, fill = factor(AcceptedCmp3))) +
geom_bar(position = "fill") +
labs(title = "Acceptance of Campaign 3 by Education", x = "Education", y = "Proportion", fill
= "Accepted Campaign 3")
##Finding: Customers with higher education (PhD, Master's, or Graduation) are more likely
to accept the third campaign compared to those with lower education levels. This suggests
that education level may influence campaign success.
##8. Multivariate Graphical - Scatter Plot of MntGoldProds and Income
ggplot(data, aes(x = Income, y = MntGoldProds)) +
geom_point(color = "blue") +
labs(title = "Income vs Gold Product Spending", x = "Income", y = "Amount Spent on Gold
Products")
##Finding: There is a positive relationship between income and spending on gold products.
Customers with higher incomes tend to spend more on luxury items like gold products,
while those with lower incomes tend to spend less.