Statistics How To

Market Basket Analysis: Definition, Examples

Statistics Definitions > Market Basket Analysis

What is Market Basket Analysis?

In market basket analysis (also called association analysis or frequent itemset mining), you analyze purchases that commonly happen together. For example, people who buy bread and peanut butter also buy jelly. Or people who buy shampoo might also buy conditioner. What relationships there are between items is the target of the analysis. Knowing what your customers tend to buy together can help with marketing efforts and store/website layout.

Market basket analysis isn’t limited to shopping carts. Other areas where the technique is used include analysis of fraudulent insurance claims or credit card purchases.

market basket analysisMarket basket analysis can also be used to cross-sell products. Amazon famously uses an algorithm to suggest items that you might be interested in, based on your browsing history or what other people have purchased.

A popular urban legend is that a grocery store, after running market basket analysis, found that men were likely to buy beer and diapers together. Sales increased sales by placing beer next to the diapers.

It sounds simple (and in many cases, it is). However, pitfalls to be aware of:

  • For large inventories (i.e. over 10,000), the combination of items may explode into the billions, making the math almost impossible.
  • Data is often mined from large transaction histories. A large amount of data is usually handled by specialized statistical software (see below).

Basic Terminology

An itemset is the set of items a customer buys at the same time. It’s typically stated as a logic rule like IF {bread, peanut butter} THEN {jelly}. An itemset can consist of no items (a null amount though, is usually ignored) to all items in the data set.

The support count is a count of how often the itemset appears in the transaction database. The support is how often the item appears, stated as a probability. For example, if the support count is 21 out of a possible 1,000 transactions, then the probability is 21/1,000 or 0.021.

The confidence is the conditional probability that the items will be purchased together.


Calculations are rarely performed by hand, due to large number of combinations possible from even relatively small datasets. Software that can perform market basket analysis include:

If you prefer an online interactive environment to learn R and statistics, this free R Tutorial by Datacamp is a great way to get started. If you're are somewhat comfortable with R and are interested in going deeper into Statistics, try this Statistics with R track.

Comments are now closed for this post. Need help or want to post a correction? Please post a comment on our Facebook page and I'll do my best to help!
Market Basket Analysis: Definition, Examples was last modified: October 12th, 2017 by Andale