Statistics Challenge for Data Scientists
Today, we’ll understand two very practical ideas:
- A/B Testing – how to compare two options and choose the better one using data.
- Market Basket Analysis – how to find which items are often bought together.
A simple concept, but still useful for data scientist.
1. What is A/B Testing?
A/B testing is like a fair competition between two versions of something to see which one works better.
You create:
- Version A
- Version B
Then you show A to some people, B to some other people, and compare results.
We do this to answer questions like:
- Which button gets more clicks?
- Which headline makes more people sign up?
- Which page keeps users longer?
Simple example
Imagine you have a website with a “Sign Up” button.
You are not sure which button color works better:
- Version A: Red button
- Version B: Green button
You do not just guess. You:
- Show the red button to 50% of visitors (Group A).
- Show the green button to the other 50% (Group B).
- Count how many people clicked Sign Up in each group.
Example numbers:
| Version | Visitors | Sign Ups | Conversion Rate |
|---|---|---|---|
| Red | 1,000 | 80 | 8% |
| Green | 1,000 | 120 | 12% |
Here, Version B (green) seems better because 12% > 8%.
Then you use a statistical test (like a t-test or z-test) to check:
“Is this difference real, or could it be just random?”
If the result is statistically significant (p < 0.05), you choose the better version with confidence.
Key ideas in A/B testing (in simple words)
| Term | Simple meaning |
|---|---|
| Conversion | The action we care about (click, signup, buy) |
| Conversion rate | Conversions ÷ total visitors |
| Significance | The result is unlikely to be just random |
2. What is Market Basket Analysis?
Market Basket Analysis (MBA) is used to find which items are often bought together.
It answers questions like:
- “If a customer buys X, what else are they likely to buy?”
- “Which items should we place together in the store?”
- “Which product combos should we recommend online?”
This is heavily used in retail and e-commerce.
Simple example
Imagine a small grocery shop.
You collect data from different bills (transactions).
Example transaction data:
| Bill No. | Items Bought |
|---|---|
| 1 | Bread, Butter, Milk |
| 2 | Bread, Eggs |
| 3 | Milk, Bread |
| 4 | Bread, Butter |
| 5 | Milk, Eggs |
| 6 | Bread, Milk, Butter |
From this, you might notice:
- Bread appears in many bills.
- Bread and Butter appear together often.
- Bread and Milk also appear together.
So the shop learns:
“If someone buys Bread, there is a good chance they will also buy Butter.”
This is exactly what Market Basket Analysis is about.
Important terms in Market Basket Analysis
Let’s say we are interested in the rule:
“If a customer buys Bread, then they also buy Butter.”
We write this as:
Bread → Butter
1. Support
- How often do Bread and Butter appear together in all bills?
-
Example:
- Total bills = 6
- Bills with Bread and Butter together: 3 (Bills 1, 4, 6)
- Support = 3/6 = 0.5 (50%)
2. Confidence
- When Bread is bought, how often is Butter also bought?
- Bills with Bread: Bills 1, 2, 3, 4, 6 → 5 bills
- Bills with Bread and Butter: 3
- Confidence = 3/5 = 0.6 (60%)
- Interpretation: If someone buys Bread, there is a 60% chance they also buy Butter.
3. Lift
- How much more likely is Butter bought when Bread is bought, compared to buying Butter normally?
- If Lift > 1: Bread and Butter are positively associated (good combo).
- If Lift = 1: No special relationship.
- If Lift < 1: They appear together less than expected.
You do not need to go deep into the formula right away.
At beginner level, just remember:
- Support: How often together?
- Confidence: If A, how likely B?
- Lift: How strong is the relationship?
Where is Market Basket Analysis used?
-
Online stores:
- “Customers who bought this also bought…”
-
Supermarkets:
- Placing chips near soft drinks
- Placing bread near butter and jam
-
Food delivery apps:
- Suggesting sides with a main dish (fries with burger, dessert with pizza)
Quick Comparison
| Concept | Question it answers | Data type mainly used |
|---|---|---|
| A/B Testing | Which version works better? | Conversions, click rates etc. |
| Market Basket Analysis | Which items are often bought together? | Transactions (lists of items) |
I love breaking down complex topics into simple, easy-to-understand explanations so everyone can follow along. If you're into learning AI in a beginner-friendly way, make sure to follow for more!
Connect on Linkedin: https://www.linkedin.com/in/chanchalsingh22/
Connect on YouTube: https://www.youtube.com/@Brains_Behind_Bots


Top comments (0)