Market basket analysis made simple
Find what customers buy together: reading support, confidence and lift, and how to report the rules.
The receipts keep piling up, but have you ever wondered what you could actually learn from them?
"What do our customers buy together?"
The method that answers this is market basket analysis, formally association rule mining. Here we explain support, confidence and lift in plain words, then how to read and report the rules.
What association rules are
Association rule mining finds items that often appear together in transaction records and writes them as rules of the form "customers who buy A also buy B". The left side of the arrow (A) is the antecedent and the right side (B) the consequent.
Apriori is the classic algorithm for finding these rules. It first drops item combinations that rarely occur, then looks for rules among what is left, so it stays fast even with many items.
Today's example
- Data — 2,000 receipts from a neighbourhood bakery
- Items — 12 in all, including milk bread, strawberry jam, milk, croissants, americano, salt bread, baguettes and cream cheese
Lay the data out with one receipt per row and one column per item, writing 1 if the item is on the receipt and 0 if not.
Just three numbers
Take the rule "strawberry jam → milk bread". Milk bread appears on 500 receipts, jam on 160, and both on 110.
① Support — how common is it? The share of receipts that contain both.
- 110 ÷ 2,000 = 5.5%
② Confidence — how reliable is it? Of the receipts with jam, the share that also have milk bread.
- 110 ÷ 160 = 68.8%
③ Lift — how much more often than chance are they bought together? Confidence divided by milk bread's base rate (25%).
- 68.8% ÷ 25% = 2.75
| Lift | Meaning |
|---|---|
| Lift > 1 | Tend to be bought together |
| Lift ≈ 1 | Unrelated |
| Lift < 1 | Tend to be bought separately |
So customers who buy jam buy milk bread 2.75 times as often as usual.
Confidence alone can fool you
"Salt bread → americano" has a confidence of 42%. Sounds high, right? But americano is on 40% of all receipts anyway. Its lift is 42% ÷ 40% = 1.05 — it has almost nothing to do with salt bread.
When a popular item everyone buys sits on the consequent side, confidence rises on its own. So always read rules together with lift.
Direction matters too. "Milk bread → strawberry jam" has a confidence of just 110 ÷ 500 = 22%. The lift is the same 2.75, but confidence changes with the side you start from.
Setting the minimum support
Minimum support decides which combinations are frequent enough to look at.
- Too high → you miss rare but valuable combinations
- Too low → a flood of rules that overlapped by chance a few times
In the example, "cream cheese → baguette" has a support of 4.6% (92 receipts), so with a 5% minimum it never shows up.
A common start is somewhere between 0.01 and 0.1, adjusted by watching the number of rules. A minimum confidence (e.g. 0.4) then filters out weak rules once more.
Reading the rules
- First lift, to see whether the association is real
- Then confidence, to see how reliable it is
- Then support, to see whether it is common enough to move sales
Drop the redundant rules already covered by a more general rule, and only the genuinely useful ones remain.
Putting them to use
- Shelving — strawberry jam next to milk bread
- Bundle discounts — a cream cheese + baguette set
- Recommendations — suggest a baguette when cream cheese goes in the basket
But a rule means "bought together", not "bought B because of A". A promotion or the season may have lifted both. So before changing anything, check again on receipts from another period and, if you can, measure the effect with a small experiment.
How to write it up
Applying the Apriori algorithm (minimum support .03, minimum confidence .40) to 2,000 receipts from a neighbourhood bakery yielded 14 association rules (11 non-redundant). The rule with the highest lift was cream cheese → baguette (support = .046, confidence = .708, lift = 6.43), and strawberry jam → milk bread also showed a strong association (confidence = .688, lift = 2.75).
Example sentence · the numbers are made up
In Skari
In Skari, start the same analysis from Statistics under Relationship › Association Analysis › Association Rule Mining (Apriori), or from marketing analytics under Market Basket Analysis (Apriori). On the first screen you can load an example dataset of 9,835 real grocery-store baskets and practise right away.
The analysis runs in the order Variables → Settings → Validation → Result. In the variables step, columns with only two values such as 0/1 are picked as item columns automatically, and you can switch them on or off.
In the settings step you set the minimum support, the metric used to filter rules (confidence · lift · support · leverage · conviction) and the minimum threshold.

Run a basket analysis on your receipts
Opens Statistics at Relationship › Association Analysis › Apriori
Run it and the results come together as a report. The number of transactions, number of rules and the best lift sit at the top.

The strongest rule by lift, confidence and support appears in a single table.

Each rule gets a lift grade such as strong, moderate or essentially independent, and the non-redundant rules are listed separately.

Ideas for cross-selling, bundling, store layout and targeted promotions are drawn from the highest-lift rules.

You can also see the rules drawn as a network.

Download all the rules as Excel and the report as Word.
Wrapping up
The heart of market basket analysis is looking at lift before confidence. Set a minimum support that suits your data and separate real associations by lift, and rules you can use for shelving or bundle deals start to appear.
Want the theory behind it?The Academy's association rules page covers support, confidence, lift and the Apriori algorithm in depth →