{"course":{"slug":"maths-you-need","title":"The Maths You Actually Need","url":"https://addaly.com/learn/maths-you-need","level":"intermediate","track":"deep"},"lesson":{"slug":"heavy-tails-and-why-averages-lie","title":"Heavy tails, and the average that describes nobody","url":"https://addaly.com/learn/maths-you-need/heavy-tails-and-why-averages-lie","position":38,"of":76,"minutes":9,"answer":"When a distribution has a heavy tail the mean is dragged by rare extremes and describes almost no one, so percentiles rather than averages are what you report and act on.","keyIdea":"When a distribution has a heavy tail the mean is dragged by rare extremes and describes almost no one, so percentiles rather than averages are what you report and act on."},"body":{"format":"markdown","text":"## The average user does not exist\n\nTake a hundred users of a service. Ninety-five make 2 requests a day. Five make 400.\n\n```\nmean = (95 * 2 + 5 * 400) / 100 = (190 + 2000)/100 = 21.9\nmedian = 2\n```\n\nThe average user makes 21.9 requests a day. No user makes 21.9 requests a day. Ninety-five per cent make 2 and five per cent make 400, and the mean sits in an empty region between them, describing nobody.\n\n> Figure: A hundred users of one service. Bars (requests a day): What 95 users in 100 do 2; The average user 21.9; What the other 5 do 400. The mean sits in an empty region between the two groups and describes nobody at all. The median is 2. Compare the two before quoting either: a mean more than about one and a half times the median means a few extreme values are carrying the number.\n\nThis is not a contrived example. It is the ordinary shape of usage data, spend per customer, file sizes, session lengths, tokens per request and requests per API key. When somebody says \"average users do X\", the first question is whether the distribution has a tail, because if it does, the sentence is about a fiction.\n\n## What a heavy tail means\n\nA distribution has a heavy tail when extreme values are far more likely than a normal distribution would allow. Under a normal, a value five standard deviations out happens roughly once in 3.5 million. Under a heavy-tailed distribution, it happens often enough to matter every week.\n\nThe sharpest version is the power law, where the probability of a value above `x` falls as `x^(−α)`. City sizes, word frequencies, file sizes, wealth and network degrees all approximately follow one. When `α ≤ 2` the variance is infinite, not large, infinite, and when `α ≤ 1` the mean is infinite too. Computing a sample mean from such data gives you a number, and that number does not converge as you collect more data. It keeps drifting upward as bigger examples arrive.\n\nThat is worth sitting with. Some quantities have no meaningful average, and the sample average of them is not an estimate of anything.\n\n## The latency case, which you will meet\n\nResponse times are always right-skewed. A service with a 40 ms mean routinely has a 400 ms 99th percentile, because a small fraction of requests hit a cold cache, a garbage collection pause, or a slow dependency.\n\nThe consequence people miss: **a page that makes 20 backend calls will show its user the slowest of the 20.** If each call independently exceeds 400 ms one per cent of the time,\n\n```\nP(all 20 fast) = 0.99^20 = 0.818\nP(at least one slow) = 18.2%\n```\n\nSo a \"1 per cent tail\" at the service level is an 18 per cent tail at the page level. This is why serious latency work targets the 99th and 99.9th percentiles rather than the mean, and why an average latency in a dashboard is close to useless as a user-experience measure.\n\n## Cost, where the same arithmetic bites\n\nToken usage per request is heavy-tailed. Most requests are short; a few paste in an entire document. Budgeting on the mean request size understates cost, because the mean is itself unstable: one very large request moves it, and next month's mean will differ.\n\nThe defensible approach is to budget from percentiles and from the total, not from the average: measure total tokens per day directly, and separately cap the per-request maximum. A hard input cap converts an unbounded tail into a bounded one, which is the only thing that makes the cost predictable at all.\n\n## How to tell if you have one\n\nThree checks, all cheap:\n\n1. **Compare mean and median.** If the mean is far above the median, the tail is on the right. A ratio above about 1.5 is worth investigating.\n2. **Plot the histogram of the logs.** If the log-histogram looks roughly symmetric, you have something log-normal-ish and should work in log space.\n3. **Plot the survival function on log-log axes.** Plot the fraction of values above `x` against `x`, both on log scales. A power law appears as a straight line. This is the standard diagnostic, and it takes four lines.\n\n```python\nimport numpy as np\nx = np.sort(data)[::-1]\nfrac = np.arange(1, len(x)+1) / len(x)\n# plot log(x) against log(frac); a straight line indicates a power law\n```\n\nBe careful with the third: many distributions look straight-ish over one or two decades, and claims of power laws in the literature have a long history of being overturned by more careful fitting. Report it as \"consistent with\" rather than \"is\".\n\n## What to do instead of the mean\n\n- **Report percentiles.** Median, 90th, 99th. Three numbers describe a skewed distribution far better than a mean and a standard deviation, which describe it wrongly.\n- **Work in log space.** For log-normal-ish quantities, take logs, do the arithmetic, and transform back. The geometric mean is often the right central summary.\n- **Trim or winsorise, and say so.** Dropping the top 1 per cent stabilises an estimate at the cost of ignoring exactly the cases that may matter most. It is a legitimate choice that must be disclosed, because the trimmed mean of a heavy-tailed quantity is a different quantity.\n- **Separate the populations.** Sometimes the tail is not a tail but a second group: bots, batch jobs, one enterprise customer. Splitting them gives two distributions that each behave, and is more informative than any robust statistic applied to the mixture.\n\n## The rule to keep\n\nBefore quoting a mean, compare it with the median. If they differ substantially, the mean is being carried by a few extreme values and every plan built on it (capacity, cost, expected quality) is built on a number that describes none of your cases."},"check":{"question":"A dashboard shows mean API latency of 45 ms and the team considers performance fine. Users report the product feels slow. Which explanation follows most directly from the distribution's shape?","options":[{"text":"The mean is computed over the wrong time window, and a shorter window would reveal the problem.","correct":false,"tempting":"A window change can help, but averaging within any window still hides the tail that users experience."},{"text":"The latency distribution is right-skewed, so a small fraction of very slow requests barely moves the mean while being exactly what users notice, especially when one page makes many calls.","correct":true},{"text":"The mean excludes failed requests, so the real average is higher.","correct":false,"tempting":"Plausible as a measurement gap, but it does not explain why a correct average would still misrepresent the experience."},{"text":"Users are comparing against competitors rather than an absolute standard, so the measurement is fine.","correct":false,"tempting":"Dismisses the report rather than examining the statistic, and the tail explanation accounts for the complaint directly."}]},"prev":{"slug":"covariance-and-the-shape-of-a-cloud","title":"Covariance, and the shape of a cloud of points","url":"https://addaly.com/learn/maths-you-need/covariance-and-the-shape-of-a-cloud"},"next":{"slug":"logarithms-from-scratch","title":"What a log is, and why the axis got logged","url":"https://addaly.com/learn/maths-you-need/logarithms-from-scratch"},"authorship":"Founder and series editor: Dr Mustafa Mun. Written by AI models to a written standard. Source and assessment review continues. Academic review invited.","review":{"status":"Draft, open for academic review"},"cite":"Addaly (2026) 'Heavy tails, and the average that describes nobody', in The Maths You Actually Need. Edited by M. Mun. Addaly. Available at: https://addaly.com/learn/maths-you-need/heavy-tails-and-why-averages-lie (Accessed: 29 November 2026).","licence":{"name":"CC BY-NC-SA 4.0","url":"https://creativecommons.org/licenses/by-nc-sa/4.0/"},"reader":{"schema":1,"title":"Heavy tails, and the average that describes nobody","courseTitle":"The Maths You Actually Need","module":{"index":4,"slug":"probability-you-can-rely-on","title":"Probability you can rely on"},"answer":null,"keyIdea":"When a distribution has a heavy tail the mean is dragged by rare extremes and describes almost no one, so percentiles rather than averages are what you report and act on.","hero":{"kind":"figure","figure":{"t":"figure","label":"Figure","figure":{"caption":"The mean sits in an empty region between the two groups and describes nobody at all. The median is 2. Compare the two before quoting either: a mean more than about one and a half times the median means a few extreme values are carrying the number.","series":[{"label":"What 95 users in 100 do","value":2},{"highlight":true,"label":"The average user","value":21.9},{"label":"What the other 5 do","value":400}],"title":"A hundred users of one service","type":"bars","unit":"requests a day"},"alt":"Figure: A hundred users of one service. Bars (requests a day): What 95 users in 100 do 2; The average user 21.9; What the other 5 do 400. The mean sits in an empty region between the two groups and describes nobody at all. The median is 2. Compare the two before quoting either: a mean more than about one and a half times the median means a few extreme values are carrying the number."}},"blocks":[{"t":"h2","id":"the-average-user-does-not-exist","runs":[{"text":"The average user does not exist"}]},{"t":"p","runs":[{"text":"Take a hundred users of a service. Ninety-five make 2 requests a day. Five make 400."}]},{"t":"code","lang":"","label":"Text","text":"mean = (95 * 2 + 5 * 400) / 100 = (190 + 2000)/100 = 21.9\nmedian = 2"},{"t":"p","runs":[{"text":"The average user makes 21.9 requests a day. No user makes 21.9 requests a day. Ninety-five per cent make 2 and five per cent make 400, and the mean sits in an empty region between them, describing nobody."}]},{"t":"p","runs":[{"text":"This is not a contrived example. It is the ordinary shape of usage data, spend per customer, file sizes, session lengths, tokens per request and requests per API key. When somebody says “average users do X”, the first question is whether the distribution has a tail, because if it does, the sentence is about a fiction."}]},{"t":"h2","id":"what-a-heavy-tail-means","runs":[{"text":"What a heavy tail means"}]},{"t":"p","runs":[{"text":"A distribution has a heavy tail when extreme values are far more likely than a normal distribution would allow. Under a normal, a value five standard deviations out happens roughly once in 3.5 million. Under a heavy-tailed distribution, it happens often enough to matter every week."}]},{"t":"p","runs":[{"text":"The sharpest version is the power law, where the probability of a value above "},{"text":"x","code":true},{"text":" falls as "},{"text":"x^(−α)","code":true},{"text":". City sizes, word frequencies, file sizes, wealth and network degrees all approximately follow one. When "},{"text":"α ≤ 2","code":true},{"text":" the variance is infinite, not large, infinite, and when "},{"text":"α ≤ 1","code":true},{"text":" the mean is infinite too. Computing a sample mean from such data gives you a number, and that number does not converge as you collect more data. It keeps drifting upward as bigger examples arrive."}]},{"t":"p","runs":[{"text":"That is worth sitting with. Some quantities have no meaningful average, and the sample average of them is not an estimate of anything."}]},{"t":"h2","id":"the-latency-case-which-you-will-meet","runs":[{"text":"The latency case, which you will meet"}]},{"t":"p","runs":[{"text":"Response times are always right-skewed. A service with a 40 ms mean routinely has a 400 ms 99th percentile, because a small fraction of requests hit a cold cache, a garbage collection pause, or a slow dependency."}]},{"t":"p","runs":[{"text":"The consequence people miss: "},{"text":"a page that makes 20 backend calls will show its user the slowest of the 20.","b":true},{"text":" If each call independently exceeds 400 ms one per cent of the time,"}]},{"t":"code","lang":"","label":"Text","text":"P(all 20 fast) = 0.99^20 = 0.818\nP(at least one slow) = 18.2%"},{"t":"p","runs":[{"text":"So a “1 per cent tail” at the service level is an 18 per cent tail at the page level. This is why serious latency work targets the 99th and 99.9th percentiles rather than the mean, and why an average latency in a dashboard is close to useless as a user-experience measure."}]},{"t":"h2","id":"cost-where-the-same-arithmetic-bites","runs":[{"text":"Cost, where the same arithmetic bites"}]},{"t":"p","runs":[{"text":"Token usage per request is heavy-tailed. Most requests are short; a few paste in an entire document. Budgeting on the mean request size understates cost, because the mean is itself unstable: one very large request moves it, and next month’s mean will differ."}]},{"t":"p","runs":[{"text":"The defensible approach is to budget from percentiles and from the total, not from the average: measure total tokens per day directly, and separately cap the per-request maximum. A hard input cap converts an unbounded tail into a bounded one, which is the only thing that makes the cost predictable at all."}]},{"t":"h2","id":"how-to-tell-if-you-have-one","runs":[{"text":"How to tell if you have one"}]},{"t":"p","runs":[{"text":"Three checks, all cheap:"}]},{"t":"ol","start":1,"items":[[{"text":"Compare mean and median.","b":true},{"text":" If the mean is far above the median, the tail is on the right. A ratio above about 1.5 is worth investigating."}],[{"text":"Plot the histogram of the logs.","b":true},{"text":" If the log-histogram looks roughly symmetric, you have something log-normal-ish and should work in log space."}],[{"text":"Plot the survival function on log-log axes.","b":true},{"text":" Plot the fraction of values above "},{"text":"x","code":true},{"text":" against "},{"text":"x","code":true},{"text":", both on log scales. A power law appears as a straight line. This is the standard diagnostic, and it takes four lines."}]]},{"t":"code","lang":"python","label":"Python","text":"import numpy as np\nx = np.sort(data)[::-1]\nfrac = np.arange(1, len(x)+1) / len(x)\n# plot log(x) against log(frac); a straight line indicates a power law"},{"t":"p","runs":[{"text":"Be careful with the third: many distributions look straight-ish over one or two decades, and claims of power laws in the literature have a long history of being overturned by more careful fitting. Report it as “consistent with” rather than “is”."}]},{"t":"h2","id":"what-to-do-instead-of-the-mean","runs":[{"text":"What to do instead of the mean"}]},{"t":"ul","items":[[{"text":"Report percentiles.","b":true},{"text":" Median, 90th, 99th. Three numbers describe a skewed distribution far better than a mean and a standard deviation, which describe it wrongly."}],[{"text":"Work in log space.","b":true},{"text":" For log-normal-ish quantities, take logs, do the arithmetic, and transform back. The geometric mean is often the right central summary."}],[{"text":"Trim or winsorise, and say so.","b":true},{"text":" Dropping the top 1 per cent stabilises an estimate at the cost of ignoring exactly the cases that may matter most. It is a legitimate choice that must be disclosed, because the trimmed mean of a heavy-tailed quantity is a different quantity."}],[{"text":"Separate the populations.","b":true},{"text":" Sometimes the tail is not a tail but a second group: bots, batch jobs, one enterprise customer. Splitting them gives two distributions that each behave, and is more informative than any robust statistic applied to the mixture."}]]},{"t":"h2","id":"the-rule-to-keep","runs":[{"text":"The rule to keep"}]},{"t":"p","runs":[{"text":"Before quoting a mean, compare it with the median. If they differ substantially, the mean is being carried by a few extreme values and every plan built on it (capacity, cost, expected quality) is built on a number that describes none of your cases."}]}],"check":{"question":[{"text":"A dashboard shows mean API latency of 45 ms and the team considers performance fine. Users report the product feels slow. Which explanation follows most directly from the distribution’s shape?"}],"options":[{"text":[{"text":"The mean is computed over the wrong time window, and a shorter window would reveal the problem."}],"correct":false,"tempting":[{"text":"A window change can help, but averaging within any window still hides the tail that users experience."}]},{"text":[{"text":"The latency distribution is right-skewed, so a small fraction of very slow requests barely moves the mean while being exactly what users notice, especially when one page makes many calls."}],"correct":true,"tempting":null},{"text":[{"text":"The mean excludes failed requests, so the real average is higher."}],"correct":false,"tempting":[{"text":"Plausible as a measurement gap, but it does not explain why a correct average would still misrepresent the experience."}]},{"text":[{"text":"Users are comparing against competitors rather than an absolute standard, so the measurement is fine."}],"correct":false,"tempting":[{"text":"Dismisses the report rather than examining the statistic, and the tail explanation accounts for the complaint directly."}]}],"order":[3,1,0,2],"why":null},"prev":{"slug":"covariance-and-the-shape-of-a-cloud","title":"Covariance, and the shape of a cloud of points","minutes":9},"next":{"slug":"logarithms-from-scratch","title":"What a log is, and why the axis got logged","minutes":8}}}