MASTER PROJECT
DATA ACQUISTION
For this project, I needed a dataset that could help analyse customer shopping behaviour and
provide useful business insights. The goal was to understand how people shop, what
influences their purchases, and how businesses can use this data to improve sales and
marketing strategies.
I explored different sources like the UCI Machine Learning Repository and Kaggle, which
are well-known platforms for high-quality datasets. After careful consideration, I chose a
dataset from Kaggle because it had detailed information on customer purchases, preferences,
and spending patterns, making it ideal for Business Analytics.
Dataset details
Name - Shopping Behaviour Trends Dataset
Source – Kaggle. Since Kaggle is a trusted source for data science and analytics, I felt
confident using this dataset for my project.
Link –
Dataset format – csv format, includes thousands of records with 18+ columns.
This dataset is useful for businesses looking to understand customer behaviour and
shopping trends. It can help answer important business questions like:
i. Who are the most frequent shoppers?
ii. Do discounts really increase sales?
iii. Which products are most popular in different seasons?
iv. What payment methods do customers prefer?
By analysing this data, businesses can improve their marketing strategies, adjust pricing, and
predict future shopping trends, making it highly relevant for this project.
DATA PREPARATION & EXPLORATION
I have imported the dataset firstly in R programme software for preliminary work. Here is the
list of instances done by me in the R studio –
A. I have to load excel file in R studio. For this, I have installed the package ‘readxl’. To
activate the package and guide to the location of my excel dataset, I have typed the
code below.
B. After successfully loading the dataset, there had to be data cleaning done.
a) Firstly, I checked the structure of my data. This was to see the data type of each
column. It is useful during the time of plotting visualisations.
b) Next, I converted categorical variables to factors. Converting categorical variables
to factors in R ensures they are correctly treated as distinct categories in analysis,
visualization, and modeling.
c) The next important step involved doing the data cleaning to omit missing values
or null cells. I tried to replace the null cells with mean.
d) Outliers can distort our analysis and is not feasible in predictive models. It is
important to identify and address outliers. I have used boxplot to detect my
outliers. A boxplot is a powerful visualization to identify outliers easily,
understand the spread and central tendency of a numeric variable and compare
distribution symmetry.
I plotted the Purchase Amount (USD), and it indicates the following –
Median - The black line inside the blue box is the median (50th percentile)
of purchase amounts. It looks to be around 60 USD.
Interquartile Range (IQR) - The box spans from Q1 to Q3 (25th to 75th
percentile). This shows the middle 50% of purchase values to be
approximately around 40 to 80 USD.
Whiskers (dashed lines) - The whiskers extend to the minimum and
maximum values within 1.5 × IQR.
There are no Outliers. This is proved by the very fact that, there are no dots or
stars outside the whiskers. That means that there are no extreme values or outliers
were detected by the IQR rule.
e) Next, I converted categorical variables to factors. Converting categorical variables
to factors in R ensures they are correctly treated as distinct categories in analysis,
visualization, and modeling.
f) The last part of data cleaning included adding or creating new features and
variables. I computed average purchase amount and age groups.
C. EXPLORATORY DATA ANALYSIS USING R –
a) Calculation of summary statistics including mean, median, mode, standard
deviation. Apart from the entire data, I also wanted to study the purchase amount
category.
b) Understanding data distribution and relationships –
Histogram – Done to understand how the purchase amount has been distributed.
The histogram helps to interpret that the distribution of purchase amounts is
relatively uniform, indicating that customers are spread fairly evenly across
spending levels. Most customers spend moderate amounts, with fewer making
very low or very high purchases.
Scatter plot – To see if there is relationship between the age and the amount spent
by people on the purchase of items from retail stores.
Interpretation and Findings from the scatter plot are told below –
i) Flat Trend Line - The horizontal line shows that age has little to no
influence on purchase amount. This means purchase behaviour is
consistent across all age groups.
ii) No Clear Pattern - There’s no upward or downward trend—no strong
correlation between age and spending. All age groups, from young adults
to older adults, have similar purchase behaviour.
iii) Gender-wise Distribution - Both males and females are fairly evenly
spread across purchase amounts and age groups. There's no significant
gender difference in spending patterns based on this chart.
iv) Dense Cloud - The plot is very dense and uniform, suggesting a large
dataset. No strong clustering (e.g., not many younger people spending high
amounts or older people spending low amounts in a consistent way).
Finally, it can be interpreted that there is no significant relationship between
customer age and purchase amount, as indicated by the flat trend line. Purchase
behaviour remains relatively stable across all age groups. Additionally, both
genders show a similar distribution of purchase amounts, with no evident
disparity.
Correlation matrix – to identify significant patterns. A correlation matrix helps us
understand how variables relate to each other - specifically, whether changes in
one variable are associated with changes in another.
Interpretation -
This is a correlation heatmap for the variables of - Customer ID, Age, Purchase
Amount, Review Rating and Previous Purchases. The numbers inside the squares
are correlation coefficients, ranging from -1 to 1. The colour code of the
correlation heatmap is as follows - Dark blue = strong positive, Red or dark red =
strong negative and White = no or weak correlation.
Variables Correlation Findings
Age vs Purchase Amount -0.01 Very weak negative correlation -
essentially no relationship
Review Rating vs 0.03 Very weak positive - higher ratings
Purchase Amount slightly relate to higher purchases,
but the relationship is almost
negligible
Previous Purchases vs 0.01 Again, no significant correlation -
Purchase Amount past purchases don’t predict current
spend
Customer ID vs Anything 0 Expected - Customer ID is just an
identifier, not a useful feature for
analysis
Age vs Review Rating -0.02 Tiny negative relationship -
basically no pattern between age and
reviews
Previous Purchases vs 0.04 Slight trend - older customers may
Age have purchased slightly more
before, but again, very weak
The correlation matrix reveals very weak relationships between Purchase Amount
and variables like Age, Review Rating, and Previous Purchases. This suggests that
none of these variables are strong predictors of purchasing behavior in a linear
context. Notably, Customer ID shows no correlation and should be excluded from
any modeling or analysis.
D. VISUALISATIONS –
1. Boxplot of Purchase Amount by Gender - To explore how spending behaviour varies
by gender. We can see who is spending more and the variability that happens based on
gender.
Interpretation – There is comparison of how much males and females spend on
average. The box represents the interquartile range (IQR) — the middle 50% of the
data. The bold line in the center of the box is the median purchase amount. The
whiskers (lines extending from the box) show the spread of the data.
Median purchase amount is almost equal as per the [Link] implies no
significant gender difference in central tendency of spending.
The IQR for females appears slightly tighter than males, suggesting less
variation in purchase behavior among females.
Both genders show a similar spread in terms of minimum and maximum
purchase amounts.
2. Bar Chart of Product Categories Purchased – I want to identify which product
category is most popular and where is all the demand concentrated.
Interpretation – It is so clearly evident that people mostly visit the store to buy
clothing category than any other category of products.
3. Heatmap of Average Purchase Amount by Location and Category – This is just to see
the regional demand for products and their categories.
4. Violin Plot of Review Rating by Category – This was done to understand customer
satisfaction across product categories.
Interpretation – Footwear has the highest rating and is a high performer. Outerwear
ratings are more spread out. Outerwear shows a broader density, with many ratings
ranging from 2.5 to 5 suggesting inconsistency in quality or satisfaction. Clothing and
accessories are consistent showing a balanced and consistent performance.
Accessories have slightly lower ratings indicating customer dissatisfaction.
5. Stacked Bar of Payment Method by Gender - To analyse gender preferences in
payment methods.
Interpretation - Both men and women prefer to use similar payment methods when
shopping. PayPal, debit cards, and credit cards are popular for everyone, while cash
and bank transfers are used a bit less.
6. Donut Chart of Subscription Status - To show the proportion of subscribed vs
unsubscribed users.
Interpretation – Most of the customers have not subscribed to the online portal of the
retail stores. There is a serious need for the stores to optimise the online website and
attract more traffic.
7. Customer Segmentation by Gender & Age Group - This is done in marketing &
customer analytics to understand customer preferences.
8. Line Chart of Average Purchase by Age Group - To detect spending trends across age.
Interpretation – Customers aged 20–30 have the highest average spending, while
those aged 40–50 spend the least. Overall, spending varies slightly across age groups,
but remains relatively consistent.
9. Bar Chart of Discount Use by Category - To analyze how often discounts are used per
product category. Which product lines are more discount sensitive.
Interpretation – It is evident that the company offers most of the discount offers
mostly in the category of clothing and accessories.
10. Frequency of Purchases by Payment Method - To understand how frequently
customers purchase depending on payment method.
Interpretation - Purchase frequency is fairly consistent across all payment methods,
with weekly and monthly purchases being the most common.
Cash and Credit Card users show slightly higher usage across frequencies.
Venmo and Debit Card users appear less frequent in weekly purchases compared to
others.
DATA MODELLING & PREDICTIVE ANALYTICS
1. Regression – I wanted to find out if a person’s age, gender, or how many times
they’ve shopped before help predict how much they’ll spend. I did a simple linear
regression.
Interpretation - Age has almost no effect on spending. Males spend about 73 cents less
than females, but this is not a strong difference. People who shopped more before
spend slightly more, but again, it's too small to matter. The p-values (those numbers
like 0.503, 0.371, etc.) are all greater than 0.05. That means that none of the variables
tested are statistically useful for predicting spending. The R-squared value is 0.00038-
that’s really low. It means that model explains less than 1% of the differences in what
people spend. I realised these variables are solely not enough to predict spending,
there is need to evaluate more variables.
2.