By using simple affinity analytics, you can help shoppers decide which items go well with the merchandise already in their carts, which can lead to increased sales and stronger customer relationships.
Customers leave behind a wealth of hidden information in their shopping carts and transactions. Interpreted properly, you can use this data to recommend items that would go well with future customers’ intended purchases. In the retail community, we call this affinity.
This isn’t just guesswork. Underneath this affinity analysis is a quirk in statistics called a Bayesian Inference, or Bayes’s Rule, that allows you to use pairs of historical data to infer the likelihood of future events. I won’t go into the mechanics of this formula here, but for those who want to dig into the hard math, I recommend this easy to understand video “”The Bayesian Trap” by Veritasium. I also owe a big thank you to Scott Bollinger, one of the finest big data engineers I’ve had the pleasure to work with, and the expert who introduced me to this process.
In this article, you will learn how to adapt this analytic to a real retail business opportunity. Specifically, I will show you how a 3% change in affinity sales can lead to a 30% increase in gross margin. Let’s get started.
How does affinity work for retail? The affinity analysis uses very simple statistics that relate pairs of data, like a belt and a pair of pants. To create this paired relationship, this technique makes use of four calculations, all of them very easy to calculate: Counts, Support, Confidence, and Lift. Each provides insight into our customer’s preferences and how we might utilize this information to improve their shopping experience.
Counts refer to how many times an item shows up in a transaction or shopping cart.
Count A = Number of times A shows up in all the transactions
Count B = Number of times B shows up in all the transactions
Support is a fancy name for percentage and is nothing more than the count divided by the total number of transactions. Support is used to give us an idea of the probability we might find one of the items.
Support A = Count A / Total Transactions
Support B = Count B / Total Transactions
Support A and B = Count A and B / Total Transactions
Confidence refers to the percentage of times pairs show up together given that one of the items is chosen. Another more business friendly way to say this: How confident are we that we will see “B” in the shopping cart given that the customer has already put “A” in their shopping cart?
Confidence A = Support for A and B / Support B
Confidence B = Support for A and B / Support A
You can rephrase the calculation this way if you prefer to use the Bayesian inference formula:
Confidence A = (Confidence B * Support A) / Support B
Confidence B = (Confidence A * Support B) / Support A
Lift refers to the likelihood that a pair of items would sell together versus random purchases of either item. Another way to express this is the expected support divided by the actual support. A ratio less than 1 would suggest there is a very weak affinity. A ratio greater than 1 suggests a stronger affinity.
Expected Support = Support A * Support B
Actual Support = Support for A and B
Lift = Support for A and B / (Support A * Support B) = Expected Support / Actual Support
Okay, let’s put this all together with some fictional, but realistic, numbers.
Let’s say we have transactions for a store (or e-commerce site) that sells three categories: Belts, Pants, and Shirts. Because we want to use this affinity logic to help us out for next month’s sales, we take the sales from last year for the same month. This is the data we gather:
Transactions with Belts = 1,000
Transactions with Pants = 5,000
Transactions with Shirts = 7,000
Transactions that had Belts and Pants = 700
Transactions that had Belts and Shirts = 100
Transactions that had Pants and Shirts = 1,500
Total transactions = 10,000
From this data and from the calculations above we can create this grid:
Let’s go through our calculations and see how they fit into the affinity analysis:
Support gives us the actual results. For example: 7% of our transactions had a belt and a pair of pants.
Confidence gives us the actual results of finding the second item when the first item has been purchased. For example: the probability of finding PANTS in the transaction when we know BELTS are in the transaction, or P(PANTS | BELTS), is 70%.
Lift measures how well actual results compared to expected results. For example, BELTS and PANTS performed 1.40x better than if BELTS and PANTS were purchased randomly.
What can we infer about the transactions coming up next month?
Let’s take a look at PANTS and BELTS since that pair has the highest lift.
Support: We should expect that 7% of our transactions will have both of these items.
Confidence: There is a 14.0% chance that the customer will purchase a belt if they buy a pair of pants. But look at the reverse: there is a 70% chance of selling a pair of pants if a belt is purchased. Wow!
Lift: If 70% wasn’t impressive enough, we also have a 1.40x lift on this pair. That means that compared to selling a belt and pair of pants randomly together, we have a 1.40x better chance of actually selling them together. The affinity between these two is very high and, on the average, most customers would be open to this combination.
For combinations where the lift is low, the reverse is true too. A very low lift suggests we have a better chance of randomly selling this pair together, like shirts and belts. We would find it difficult to convince a customer to consider adding these two together.
The next step is to try to understand why when we sell a belt we have a very good chance of selling a pair of pants. Once you understand your customer’s preference you can alter your promotional or merchandising strategy to encourage the customer to purchase a pair of PANTS when they are committed to purchasing a BELT.
Using our example, let’s look what happens if we improve the support for BELTS and PANTS to 10% instead of 7%. Let’s assume our retail price of belts is $40 and our cost is $10. How much margin did we generate?
So, by increasing our transactions with this pair by 3% (from 7% to 10%) we increased our gross margin value by 30% (from 30,000 to 39,000). Your customer is happier and you’re happier. A win-win!
As you can see, the affinity analysis is pretty straightforward and easy to calculate. But, like any good retail analyst, you should consider cleansing your data first. There is something to be said for the 80/20 rule because you could spend the rest of your life working this all out. I’ll share a little secret from my experience working with this analytic: as long as the assortments are fairly stable, these paired statistics will be as well. This means that the statistics won’t change much if you use the same merchandising or promotional strategy from year to year. Work with the merchants to understand what strategies were used.
Please note that in this example, I used an easy product aggregation for demonstration purposes. You can take this analysis to a much lower level down to style, style-color, or even down to SKU. You will be amazed by which pairs have high lifts. I will warn you, though: the lower you go, the more processing power you will need. A simple macro in Excel will handle the high product aggregations, but it will perform slowly when you go to lower aggregations (like SKU).
Here are things to consider when cleansing your data:
- Returns: customer returns typically show up as negative numbers. Is a return a valid transaction? How do you want to handle the original transaction?
- Multiple Units: using our example above: how do you want to treat the statistics if, say, two pair of pants are purchased on the same transaction? If you are analyzing things at a style level, how will you treat a transaction if a customer purchases the same style but one of the units is blue and the other is light blue?
- Multiple transactions per customer: sometimes corporate will set a limit as to how many units of the same SKU can be purchased on one transaction, sometimes referred to as a bulk sale. If you have the customer ID, or a tokenized customer ID, you can use that to consolidate their transactions.
- Promotions that have built in associations: Promotions that target a product pair, like buy 2 belts get a pair of pants 50% off will bias your data.
- Merchandising: were the belts and pants merchandised together last year but not the year before? Will belts and pants be merchandised together again this year?
- Changes in assortments: Answering this is one of the hardest to do because it gets into substitution sales which is difficult to assess. But one thing you can do is look for significant changes. For example, we reduced our color count for this style from 18 to 6.
- Changes in pricing: A SKU’s elasticity to price changes will have a significant impact on the affinity calculations.
- Markdown product: How much markdown product is in the store? Were you overstocked in Pants last year but not this year? The The lifts you calculate for each pair may have been influenced by the percentage of markdown product of one of the items in your pair.
- Floorset changes: When did the floorset take place, or when did the planogram change? Timing can have an impact on which items are sold together.
- Retail calendar: If you use monthly data, watch out for the 53rd week or months that may need shifting due to holidays like Easter.
For help on how to adapt this affinity analytic to your company’s needs, contact Retailitix for more information.