What is Basket Analysis?

Basket analysis, also known as market basket analysis or association analysis, is a data mining and analytical technique used in retail and e-commerce to uncover patterns of co-occurrence among items frequently purchased together. The primary objective is to identify relationships between products or items that customers tend to buy in conjunction with each other. This analysis is valuable for retailers seeking insights into customer behavior, optimizing product placement, and developing targeted marketing strategies.

Key Concepts in Basket Analysis

Basket Analysis

Association Rules

Basket analysis relies on the identification of association rules, which are statements that describe the likelihood of one item being purchased when another item is already in the basket. These rules are expressed in the form of “If X, then Y,” indicating the relationships between different products.

Support, Confidence, and Lift

The key metrics in basket analysis—support, confidence, and lift—are calculated using specific formulas. These formulas help quantify the strength and significance of associations between items in a basket analysis. Analysts and data scientists use these metrics to identify meaningful patterns and relationships in transaction data, leading to actionable insights for business strategies.

Here’s how each of these metrics is calculated:


Support is the proportion of transactions that contain both items X and Y. The formula for support is:

Support (X and Y) = Number of Transactions Containing X & Y / Total Number of Transactions

This formula calculates the percentage of transactions where both items X and Y are present.


Confidence is the probability that a transaction containing item X will also contain item Y. The formula for confidence is:

Confidence (X⇒Y) = Support (X and Y) / Support (X)

This formula measures the conditional probability of buying item Y given that item X is already in the basket.


Lift is the ratio of the observed support to the expected support if items X and Y were independent. The formula for lift is:

Lift (X⇒Y) = Support (X and Y) / Support (X) × Support (Y)

Lift greater than 1 indicates a positive association, suggesting that items X and Y are more likely to be bought together than if they were independent.

Frequent Itemsets

Frequent itemsets are combinations of items that occur together with a frequency above a specified threshold. These itemsets serve as the basis for generating association rules.

Example of Basket Analysis

Consider a supermarket transaction database with purchase records. A basket analysis might reveal the following association rule:

  • Out of 1000 customers, 100 bought blue pens (Y), 80 bought black pens (X) and 60 bought both of them.
  • Support (X) = Number of Transactions Containing X / Total Number of Transactions = 80/1000 = 0.08
  • Support (Y) = Number of Transactions Containing Y / Total Number of Transactions = 100/1000 = 0.1
  • Support (X & Y) = Number of Transactions Containing X & Y / Total Number of Transactions = 60/1000 = 0.06
  • Confidence = Support (X and Y) / Support (X) = 0.06/0.08 = 0.75
  • Lift =  Support (X and Y) / Support (X) × Support (Y) = 0.06 / 0.1 * 0.08 = 7.5

Applications of Basket Analysis

Product Recommendations

E-commerce platforms use basket analysis to recommend related or complementary products based on what other customers have purchased together.

Merchandising and Product Placement

Retailers optimize product placement on shelves by placing complementary items near each other, encouraging customers to purchase them together.

Cross-Selling Strategies

Businesses identify opportunities for cross-selling by understanding which products are frequently bought together, enabling targeted marketing and promotional campaigns.

Inventory Management

Basket analysis helps retailers manage inventory more efficiently by ensuring that frequently co-purchased items are adequately stocked together.

Customer Segmentation

Understanding the patterns of co-purchased items contributes to effective customer segmentation, allowing businesses to tailor marketing strategies for different customer groups.

Promotion Planning

Retailers can plan promotions and discounts more strategically by identifying items that tend to be purchased together.

Stay Updated