Market Basket Analysis – A Complete Overview (2021)


As digital marketing and analytics continue to thrive symbiotically, cross-selling and upselling have become the mantra of the decade. A key component of deriving consumer insights is market basket analysis or MBA. In this article, we give you the upshot of market basket analysis and how it can be utilized to understand the customers better. We also take a look at some real-world Market Basket Analysis examples and how they have impacted a variety of sectors.

  1. What is market basket analysis?
  2. Types of Market Basket Analysis
  3. Algorithms associated with Market Basket Analysis
  4. Benefits of Market Basket Analysis

1) What is market basket analysis?

The most accurate Market Analysis definition is – a data mining technique that is used to uncover purchase patterns in any retail setting. The goal of Market Basket Analysis is to understand consumer behavior by identifying relationships between the items that people buy. For example, people who buy green tea are also likely to buy honey. So Market Basket Analysis would quantitatively establish that there is a relationship between Green Tea and Honey. The same goes for bread, butter, and jam. 

How does market basket analysis work?

Market Basket Analysis is modeled on Association rule mining, i.e., the IF {}, THEN {} construct. For example, IF a customer buys bread, THEN he is likely to buy butter as well. 

Association rules are usually represented as: {Bread} -> {Butter}

Some terminologies to familiarise yourself with Market Basket Analysis are:

  • Antecedent: Items or ‘itemsets’ found within the data are antecedents. In simpler words, it’s the IF component, written on the left-hand side. In the above example, bread is the antecedent.
  • Consequent: A consequent is an item or set of items found in combination with the antecedent. It’s the THEN component, written on the right-hand side. In the above example, butter is the consequent.

2) Types of Market Basket Analysis

Now that we have a fair idea of what is Market Basket Analysis and some of the key terms associated with an MBA, let us dig deeper. Market Basket Analysis techniques can be categorized based on how the available data is utilized:

  1. Descriptive market basket analysis: This type only derives insights on past data and is the most frequently used approach. The analysis here does not make any predictions but simply rates the association between products using statistical techniques. For those familiar with the basics of Data Analysis, this type of modeling is known as unsupervised learning. Check Jigsaw Academy’s Data Science Bootcamp for more information.
  2. Predictive market basket analysis: This type uses supervised learning models like classification and regression. It essentially aims to mimic the market to analyze what causes what to happen. For example, buying an extended warranty is more likely to follow the purchase of an iPhone. Essentially, it considers items purchased in a sequence to determine cross-selling. While it isn’t as widely used as a descriptive MBA, it is still a very valuable tool for marketers.
  3. Differential market basket analysis: This type of analysis is a beneficial tool for competitor analysis. It compares purchase history between stores, between seasons, between two time periods, between different days of the week, etc., to find interesting patterns in consumer behavior. For example, it can help determine why some users prefer to purchase the same product with the same price on Amazon vs. Flipkart – the answer can simply be that the Amazon reseller has more warehouses and can deliver faster, or maybe something more profound like user experience.

3) Algorithms associated with Market Basket Analysis

As mentioned before, the market analysis definition is modeled on Association Mining rules. Algorithms that use association mining include AIS, SETM, and Apriori. Among these, the most commonly used algorithm for MBA is the Apriori Algorithm. 

The following section explores the Apriori algorithm in detail:

Apriori algorithm works with the assumption that any subset of a frequent itemset must be frequent.

Consider the below dataset:

Transaction ID


Peanut Butter






















Every transaction is a combination of 0s and 1s. 0s represent the absence of an item, and 1s represent its presence. Let us calculate the key metrics using the above data points.

  1. Support of X: Ratio of transactions involving X to the total number of transactions.

Support of bread = freq{bread}/N

= 3/5 = 0.6

Support indicates the relative frequency with which the rule occurs. High support indicated a strong correlation between two items or itemsets. Note that there may be meaning in mining low support as well, in case you’re looking for “hidden” relationships.

2. Confidence of Y: Given two items, X and Y, confidence measures the percentage of times that item Y is purchased, given that item X was purchased.

Confidence {bread -> peanut butter} = Freq(bread, peanut butter)/Freq(bread)

= (2/6) / (3/6) = 0.667

Confidence values always range from 0 to 1. Confidence is a measure of the reliability of the rule. Confidence of .667 in the above example means that in 66.7% of the cases where bread was purchased, the purchase also included peanut butter.

3. Lift: Increase in the sale of X when you sell Y.

Lift{Bread, peanut butter} = Confidence(bread, peanut butter) / Support(peanut butter)

= 0.667 / (3/6) = 1.334

Lift is the ratio of the observed support to that expected support if the two rules were independent. Lift gives powerful insights into Market Basket Analysis and can help you determine how accurate your predictions are.

Here is what the lift-value indicates:

  • Lift (X -> Y) = 1 : No correlation within the itemset.
  • Lift (X -> Y) > 1: Positive correlation within the itemset, i.e., X and Y, are likely to be bought together.
  • Lift (X -> Y) < 1: Negative correlation within the itemset, i.e., X and Y, are unlikely to be bought together.

Performing Market Basket Analysis in R

The arules package is an open-source toolkit for association mining using the R programming language. 

Here’s an example code for running the Apriori algorithm in R:

# Load the libraries




# Load the data set

tr <- read.transactions(‘market_basket.csv’, format = ‘basket’, sep=’,’)


# Create an item frequency plot for the top 20 items


# Get the rules

rules <- apriori(tr, parameter = list(supp=0.001, conf=0.8))

rules <- sort(rules, by=’confidence’, decreasing = TRUE)


#Inspect top 10


# Plot the top 10 rules

topRules <- rules[1:10]


plot(topRules, method=”graph”)

plot(topRules, method = “grouped”)

Market Basket Analysis examples

This section explores Market Basket Analysis examples by market segment:

  1. Retail:

Perhaps the most well-known MBA case-study is Any time you view a product on Amazon, the product page automatically recommends, “Items bought together frequently.” It is perhaps the simplest and most clean example of cross-selling techniques using MBA. 

Apart from e-commerce formats, BA is also widely applicable to the in-store retail segment. Grocery stores pay meticulous attention to product placement based and shelving optimization. For example, you are almost always likely to find shampoo and conditioner placed very close to each other at the grocery store.

Walmart’s infamous beer and diapers association anecdote is also an example of Market Basket Analysis.

2. Telecom: With the ever-increasing competition in the telecom sector, companies are paying close attention to the services that customers are frequently using. For example, Telecom has now started to bundle TV and Internet packages apart from other discounted online services to reduce churn.

Here’s a study by McKinsey on how the telecom industry can restructure plans efficiently using MBA:

3. IBFS: Tracing credit card history is a hugely advantageous MBA opportunity for IBFS organizations. For example, Citibank frequently employs sales personnel at large malls to lure potential customers with attractive discounts on the go. They also associate with apps like Swiggy and Zomato to show customers a multitude of offers they can avail via purchasing through credit cards.

IBFS organizations also use basket analysis to determine fraudulent claims.

This research paper by Marzieh Vahidi Roodpishi and Reza Aghajan Nashtaei, published in the Management Science letters journal, determines how MBA can be used to better group customers.

4. Medicine: In the medical field, basket analysis is used to determine comorbid conditions and symptom analysis. It can also help identify which genes or traits are hereditary and which are associated with local environmental effects.

DRDO has run a detailed study that associated clinical parameters with the diagnosis of brain tumors. 

4) Benefits of Market Basket Analysis

Despite being a three-decade-old technique, market analysis definition remains a valuable solution for insights in both the brick-and-mortar and eCommerce sectors. 

  1. Increasing market share: Once a company hits peak growth, it becomes challenging to determine new ways of increasing market share. Market Basket Analysis can be used to put together demographic and gentrification data to determine the location of new stores or geo-targeted ads. For example, if you’ve ever wondered how there’s a Mcdonald’s everywhere you go, the answer can likely come from MBA.
  2. Behavior analysis: Understanding customer behavior patterns is a primal stone in the foundations of marketing. MBA can be used anywhere from a simple catalog design to UI/UX.
  3. Optimization of in-store operations: MBA is not only helpful in determining what goes on the shelves but also behind the store. Geographical patterns play a key role in determining the popularity or strength of certain products, and therefore, MBA has been increasingly used to optimize inventory for each store or warehouse.
  4. Campaigns and promotions: Not only is MBA used to determine which products go together but also about which products form keystones in their product line. For example, companies may notice that frequently restocking gourmet bread increases the purchase of other related gourmet jams and jellies.
  5. Recommendations: OTT platforms like Netflix and Amazon Prime benefit from MBA by understanding what kind of movies people tend to watch frequently. For example, a person who rated Money Heist highly could also be interested in other high-crime series.


Despite being a relatively simple algorithm, Market Basket Analysis is a quick and easy first step towards uncovering hidden patterns from your customers. However, there are many more such interesting methods to delve into the world of analysis and data mining. Jigsaw Academy’s 10-month online Integrated Program in Business Analytics (IPBA), in partnership with the Indian Institute of Management, Indore, is a great headstart to business analytics. If you find people analytics and consumer behavior more interesting, the People Analytics & Digital HR course may be the right choice for you. From full-fledged PG programs to crunch-based bootcamps, Jigsaw Academy covers everything there is in the analytics world. Click here to explore what’s right for you.


Related Articles

Please wait while your application is being created.
Request Callback