# Market Basket Analysis [Association Analysis]

Market basket analysis (also called association analysis) is one of the most important methods used to uncover relationships between items. It looks for combinations of items that frequently occur together in transactions. In other words, it enables retailers to identify relationships between the items that customers buy.

## What does association analysis do?

Let's say you have set up your own online clothing store. Your goal now is to achieve the highest possible turnover with this store.

In order to achieve the highest possible sales, you naturally want every customer to buy as much as possible. One way to motivate the customer to buy more products is to suggest more products. The big question now is: Which product do I best suggest to the customer? This is where market basket analysis or association analysis comes into play.

The market basket analysis gives an answer to the question: How likely is it that a customer buys product A if he already has product B in his market basket.

The market basket analysis tells you which products or goods are often bought together. So if a customer already has a pair of pants and shoes in the shopping cart, how likely is it that this customer will also buy a shirt, socks or a t-shirt.

## Market Basket Analysis Example

To calculate a shopping cart analysis, you need a list of past purchases, where you can see which products were bought together in one purchase.

So you have the respective products listed and each row is a transaction. Let's say that is your example data, you have the products jeans, shirt, jacket and shoes.

Each row is a transaction or a purchase. 1 means bought, 0 means not bought. So the first person bought jeans, shirt and shoes.

Now, so that we have results that we can interpret, let's first calculate a market basket analysis using DATAtab for this data. To do this, go to the market basket analysis calculator on DATAtab and copy your data into the table.

Now we can specify a minimum support and a minimum confidence. For this data DATAtab issued us these association rules:

The association rules are in the form: If the products under Lhs (Left hand side) are present in a transaction, then the products under Rhs (Right hand side) are also present with some probability.

## Market basket analysis Interpret results

We look at the results of the basket analysis using the first set of association rules.

### Frequency

The frequency in the results table tells us how often the products under Lhs and Rhs occur in a transaction, so in our case, how often does shirt and shoes occur in a transaction.

So let's just count through how many transactions both occur in, which is 8 transactions.

### Support

Support tells us what percentage of all transactions that is, or in other words, how likely it is that shirt and shoes will occur in a transaction. So we just divide the frequency by the number of all transactions.

19 transactions we have in total, so we get 8/19, which is equal to 0.42. So the probability of shirt and shoes occurring in a transaction is 42 percent.

### Confidence

Confidence now tells us, if the products under Lhs are in an order, how likely it is that the products under Rhs are then also in the shopping cart.

In our example this means: How likely is it that if shirt occurs in the cart, then shoes are also in the cart. We can calculate this by dividing the frequency of shirt and shoes by the frequency of shirt.

### Lift

And finally, the lift. The lift indicates the factor by which the probability of buying the products under Rhs increases if the products under Lhs have already been bought. So in our example. If the product Shirt is in the shopping cart, it is 1.27 times more likely that Shoes will be purchased than if the product Shirt is not in the shopping cart.

## Market basket analysis and data mining

Shopping cart analysis is a method from the field of data mining. Depending on how much data is available, the analysis can be very computationally intensive.

However, with The Apriori Algorithm, there are very effective methods to efficiently determine the association rules.

## Critical note on the market basket analysis

Let's say your market basket analysis shows that if a person buys a pair of pants and shoes, there is a high probability that they will also buy a shirt. Now you suggest a shirt to all customers who buy pants and shoes. This increases the probability that a shirt will be bought under this condition and another market basket analysis will be falsified.

### Statistics made easy

- Many illustrative examples
- Ideal for exams and theses
- Statistics made easy on 251 pages
**Only 6.99 €**

*"Super simple written"*

*"It could not be simpler"*

*"So many helpful examples"*