Data Analysis Best Practices

Chapter 1 · Practice 2 of 4

Define every ratio with an explicit numerator and denominator

From Frame the question first

Why it matters

"Orders per user" sounds clear until you ask which users. All registered users? Users active this month? Users who placed at least one order? Google's guide lists this as its own rule: ratios should have clear numerators and denominators.

Write the definition in words and in code:

sql
-- Conversion: sign-ups in September who ordered within 7 days
--   numerator:   sign-ups with an order where ordered_at < signed_up_at + 7 days
--   denominator: all sign-ups in September, including those with no order

Watch for metrics computed on a subset, such as "time to first click" given that a click happened. Changes in who gets into that subset can move the metric even when nothing about the behaviour changed.

Resources for this chapter

Go deeper