Skip to content
Marketing Measurement Science

Market Basket Analysis

Measure how often products appear together in a basket or in later purchases by the same customers.

Four simple ratios

These four ratios use baskets as the unit of analysis. Count each product at most once per basket.

Support

Support = (Baskets containing X & Y) ÷ (Total baskets)

Support tells you how common the pair is. A high-support pair shows up in many transactions. But support alone can be misleading—two popular items will naturally co-occur often, even with no real affinity.

Support Support(X → Y) = P(X ∩ Y) = count(X and Y) / count(all baskets)

Attached rate (confidence)

Attached Rate = (Baskets containing X & Y) ÷ (Baskets containing X)

Given someone bought X, what fraction also bought Y? This is the conditional probability P(Y|X). A 40% attached rate means Y also appears in four of every ten baskets containing X.

Attached rate (confidence) Confidence(X → Y) = P(Y | X) = count(X and Y) / count(X)

Affinity (lift)

Affinity = Attached Rate ÷ P(Y)

Affinity divides the observed attached rate by the overall rate for Y. Values above or below 1 indicate more or less co-occurrence than expected if the items were independent.

Affinity (lift) Lift(X → Y) = P(Y | X) / P(Y) = Support(X,Y) / [P(X) × P(Y)]

Cherry pick rate

Cherry pick rate = (Baskets containing Y but not X) ÷ (Baskets containing Y)

This is the share of baskets with Y that omit X. Even one purchase of Y without X gives a 100% rate if that is the only purchase of Y. Read it alongside the purchase count.

Cherry pick rate Cherry Pick(Y given X) = count(Y without X) / count(Y) = 1 − P(X | Y)

Worked example

Imagine 100 baskets. Product X appears in 40 baskets. Product Y appears in 30 baskets. Both X and Y appear together in 20 baskets.

MetricCalculationResult
Support20 / 1000.20 (20%)
Attached Rate20 / 400.50 (50%)
P(Y)30 / 1000.30 (30%)
Affinity (lift)0.50 / 0.301.67×
Cherry Pick(30 − 20) / 300.33 (33%)
Interpretation
An affinity of 1.67 means baskets containing X are 67% more likely to contain Y than baskets overall. The attached rate of 50% means half of the baskets containing X also contain Y. The cherry pick rate of 33% means a third of the baskets containing Y exclude X.

1 Upload transaction data

Upload a CSV with at least these columns: Transaction ID, Product, and optionally Date and Customer ID. Each row is one product in one transaction. The tool auto-detects column names. Use YYYY-MM-DD for purchase dates. For a timestamp, the date printed in the record determines its window.

The demo loads six months of synthetic retail transactions (coffee, photography, and stationery baskets with built-in associations) and pre-fills the settings. Click Run Analysis to see the results.

Expected Format
Minimum columns: one for the transaction/basket ID and one for the product name. Column names are flexible—the tool looks for keywords like “transaction”, “order”, “basket”, “product”, “item”, “sku”. If columns can’t be detected, you’ll see a warning.

2 Configure analysis

Same-customer later purchases

The main tool looks at co-occurrence within the same basket. But sometimes you want a different question: among customers who bought X in one time period, what did they buy in a different time period?

This is useful for sequential cross-sell: if someone buys a camera in January, do they come back for a lens in February? For this analysis your CSV needs a Customer ID column and a Date column.

The demo data includes camera buyers who return for lenses and tripods a few months later — it pre-fills the anchor and follow-up periods below and runs the analysis for you.

1 Define the anchor period

Pick the time window where customers bought the anchor product (X). Only customers with X in this window are included.

2 Define the follow-up period

What did those same customers buy during this second window?

How to read the results

The results table gives you four numbers for every product Y paired with your anchor X. Here is what each one means and how to act on it.

Affinity (lift)

> 1.0
Y appears more often in baskets with X than it does overall.
= 1.0
Observed co-occurrence matches the independence benchmark.
< 1.0
Y appears less often in baskets with X than it does overall.

Attached rate (confidence)

Compare lift with attached rate and pair count. A large ratio can come from a rare product or a handful of purchases. A placement or bundle test can estimate whether an intervention changes sales.

Support

The share of all baskets containing both X and Y. Support acts as a frequency filter. Very low-support pairs (e.g. 0.1%) may have extreme affinity scores simply because they appeared together by accident in a tiny number of baskets. Set a minimum support threshold (we default to 1%) to filter out noise.

Cherry pick rate

Use the share of Y baskets without X to describe how often the products were purchased separately. Read it with the total number of Y baskets.

The bubble chart

When available, the bubble chart plots each product Y on two axes:

X-axis: Attached Rate (how often Y appears alongside X).
Y-axis: Affinity (Lift) — how much more than chance.
Bubble size: Support (how frequent the pair is overall).

Large bubbles in the top right indicate frequent pairs with high attached rates and high lift.

Caveats
Co-occurrence does not establish causation. Market basket analysis measures how often products appear together. Seasonal demand, promotions, or store layout can explain why two products co-occur. Before changing placement or bundles, test whether the change affects sales.

Simpson’s Paradox. Aggregate patterns can reverse when you segment by store, region, or customer type. If results seem surprising, drill down.