# Traffic stats use median and not mean?

According to the All Sites page, traffic is reported as the median of visits, per day, over the last two weeks. :

(Click for larger image)

And [Kyle Cronin ♦ states that the median is used][4], so this isn't just a typo.

Median is not a very useful number, for traffic, and it can't be extrapolated to give accurate monthly or yearly rates. For example, suppose a site had daily traffic of:

``````9, 9, 9, 9, 9, 2, 2, 9, 9, 9, 9, 9, 2, 2
``````

over a two-week period (M-S + M-S). This shows a typical decline in weekend traffic.

The average (mean) of these numbers is 7 visits/day. And this average can be extrapolated to give roughly 213 visits/month or 2557 visits/year -- figures that are reasonably accurate for planning and comparison purposes.

But the median of those same numbers is 9 visits/day! Trying to extrapolate this would give 274 visits/month or 3287 visits/year -- figures that don't reflect reality and are not useful.

This has already been noticed as a problem. See "How can we have a 31-day old site with >14k views, but only 138 visits/day?", for example.

Using median here is also inconsistent. The "questions/day" figure uses average, like one would expect.

So, is there a good reason to report median numbers (other than making traffic look a lot bigger than it is)?

• In the question you linked to, they mention the reason is to reduce the impact of sudden spikes due to Hacker News traffic. Does make sense when you think about it initially, but maybe some better "smoothing" could be applied here. – slhck May 14 '13 at 4:54
• Thanks, @slhck. I halfway wondered what "HN" was and I didn't realize that he was saying that was why median was used. That would be a spurious reason to use the wrong stat. If HN traffic is just a spike, it won't throw off the average. If HN traffic is not "real", then filter or adjust for it. Using the median to mask it, just turns one problem into two. – Awesome Poodles May 14 '13 at 5:16
• Note that a spike (a statistical outlier) will throw off the average quite drastically. In your example, the average would be 7.5, but if, say at one day, 180 views happened instead of 9, then your average would be 19 already. – slhck May 14 '13 at 5:22
• @slhck, Does SO really get spikes of "unreal" traffic at 2000% of its overwise max? Seems pretty hypothetical for such a large site. Even if it does, the correct approach is to filter any "bogus" traffic. By using average and no filter, you risk a chance of being wrong once in a blue moon. By using median, you have the certainty of being wrong, always. – Awesome Poodles May 14 '13 at 6:10
• The median's use in statistics is being automatically outlier-proof. It's better than the mean than you think. – Patashu May 14 '13 at 7:04
• @Patashu, Yes, the median is outlier-resistent. That is why you use it to help check if a set is skewed. Beyond that, it has little use, and it certainly doesn't replace the mean. You also cannot extrapolate from the median with any confidence or accuracy. – Awesome Poodles May 14 '13 at 8:45

TLDR: in this context, the median is more useful than the mean.

If you want means, or total visits per month, I recommend using something like the quantcast site. For example, here's the Quantcast figures for the Sustainability Stack Exchange. Click through the image to see much more detailed visitor stats, and for similar stats on other Stack Exchange sites.

That figure of monthly people visiting does not have spikes filtered out. And the sparkline below it, identifies the biggest spike in the last three months.

That was my question you linked to, about average daily traffic on a 31-day old site. But my question does not identify the use of the mean as a problem. The only problem there was a gap in my understanding of what the figure meant.

You didn't make the same mistake I did: you looked at the documentation, and found it was a median, not a mean, and credit to you for that.

Median is a much more useful average than mean in this case, because it does filter out short spikes in traffic caused by particular questions or answers being advertised on high-traffic sites elsewhere.

Indeed, the very meta question of mine you've highlighted, identifies just why the median is better: according to the mean number of visitors, Economics at that time was doing very well. According to the median, it was not. The site was closed some time later, due to lack of traffic. So the median gave more reliable evidence about the health of the site than the mean did. If spikes such as that do eventually lead to a healthier site, then that will show up in the median anyway. And that's why, in this context, the median is more useful than the mean.

• You didn't compare the mean to the median -- or show that it does any better job of filtering out false traffic (it doesn't). With one big spike in 3 months, and assuming that isn't legit traffic (no evidence that it is NOT legit). Then mean is misleading for at most 2 weeks (SO's stats span), and maybe not even that. While median has been wrong for the whole three months! – Awesome Poodles May 14 '13 at 8:38

When considering traffic in terms of 'How many people are interested in this site consistently?' then median is a superior measurement because it automatically filters out spikes in traffic - 'viral hits' if you prefer.

The thing about spikes in traffic is, the fact that all those people visited, even if it's hundreds of times the normal visiting rate, is NOT going to increase the steady interest in the site that much. Most people come for whatever is viral on the site (one question), read it, then leave. For example, PSY's Gangnam Style has hundreds of millions of views on youtube - but almost no English-speaking fans of the song will know about any of his other tracks. Think about when a webpage or youtube video becomes viral on Reddit - but that popularity lasts only a few days, and everyone who visits it through Reddit will look at only that, then go on with their Reddit browsing patterns (with the exception of, say, 1% - whatever % it is, we care about THAT more anyway, and the median will pick it up!)

Spikes are also rare, inconsistent, unpredictable events - Let's say we have two roughly equally popular sites with roughly equal spike frequency. Let's say we look at viewer mean for both sites in the past week - one site has had a spike in the past week, the other has not. The mean will be hugely inflated, the median is not. Is it meaningful that, because the mean is higher, that that site is more popular? No - it's just a coincidence, a stroke of luck based on when we looked.

Spikes in traffic are not a good predictor of future viewership which is why we prefer the median to the mean.

• This is all conjecture. Where's the data? Also, the analysis is flawed. When I saw the Gangnam Style video, the NEXT thing I did was search around for more stuff by him (plus get distracted by viewing other YouTube videos). Stack exchange is similar, the more good content, the more spikes will drive repeat traffic. Reddit is not a content site, it is social blather -- a completely different fish. BTW, averages resist spikes too. And for websites, you need to track and plan for spikes!. – Awesome Poodles May 14 '13 at 9:43