Tag Archives: Association Rules

Market Basket Analysis in R

Introduction

Hundreds and thousands of transactions occur every day in a supermarket, while a customer would buy multiple products in each transaction. For example, it may look like this in the database: {Transaction1: Product1, Product3, Product4, Product8, Product9}. In a larget data set of transactions, purchase patterns, i.e. some products are always bought together, can be examined based on product association analysis, also called Market Basket Analysis.

Key Concepts of Market Basket Analysis

The basics of market basket analysis
The basics of market basket analysis, source: UofT

Basically, there are four key concepts of Market Basket Analysis:

  • Rule: a rule expresses the incidence across transactions of one set of items as a condition of another set of items, i.e. X => Y;
  • Support: the support for a set of items is the proportion of all transactions that contain the set;
  • Confidence: the support for the co-occurrence of all items in a rule, conditional on the support for the left-hand set alone;
  • Lift: the support of a set conditional on the joint support of each element;
Continue reading