AI Hints
Home›Data Science Tutorial›Products and Prices
Data Science · Lesson 38 of 101

Pricing and Discounts

Does a sale really pay?.

⏱ 2 min read▶ Video at 1:05:56🎓 Free
Watch this lesson in the Data Science courseWatch on YouTube ↗Full Data Science course

The marketing team proudly reports that the twenty percent off sale doubled the number of orders. Everyone cheers. Then the finance team asks about profit, and the room goes quiet. Discounts are one of the most common ways for a business to feel busy, while it's losing money.

Pricing and Discounts
From the video: Pricing and Discounts
  • The sale lifted orders
  • Everyone cheers
  • Then finance asks about profit

Price elasticity

Elasticity measures how sensitive customers are to price. If it's minus one point four, a one percent price cut raises sales by about one point four percent. We simulate two years of days, with occasional discounts, and we fit a line on the logs of price and units. Run it. It recovers the true value. Now look at what that means for a latte which costs one dollar thirty to make. Twenty percent off sells more units, and revenue rises by about ten percent. But profit falls. Sales go up, revenue goes up, and the business makes less money. That's why you should always measure profit.

elasticity.pypython
import numpy as np

rng = np.random.default_rng(0)
days = 700
discount = rng.choice([0, 0.1, 0.2], days, p=[.7, .2, .1])
price = 4.0 * (1 - discount)
units = np.exp(6.5 - 1.4 * np.log(price) + rng.normal(0, .12, days))

slope = np.polyfit(np.log(price), np.log(units), 1)[0]
print(f"Elasticity: {slope:.2f}")

for d in [0, .1, .2]:
    p = 4.0 * (1 - d)
    u = np.exp(6.5 - 1.4 * np.log(p))
    print(f"{d:.0%} off: {u:,.0f} units, revenue {u * p:,.0f}, profit {u * (p - 1.3):,.0f}")
Output
Elasticity: -1.40
0% off: 96 units, revenue 382, profit 258
10% off: 111 units, revenue 398, profit 255
20% off: 131 units, revenue 418, profit 248

Pricing with care

A real analysis needs more care than this. Discounts are often run in busy periods, so a simple comparison flatters them, and proper experiments are better. Sales now may simply steal from sales next week, as people stock up. New customers from a sale may never come back. And regular discounts teach your customers to wait. So measure the whole period, not just the sale itself.

Timing biassales run in busy periods
Pull-forwardstealing from next week
Bargain huntersmay never return
Measure profitover the whole period

Summary

Measure elasticity, calculate profit, and look past the sale. Now we're going to return to experiments, with a more natural way of reading them.

Key takeaways
  • Elasticity measures sensitivity
  • Revenue can rise as profit falls
  • Measure the whole period
Next up: Bayesian A/B Testing — the answer you really wanted