Live data from Hacker News

Why you should be wary of relying on a single histogram of a data set

stats.stackexchange.com

1–10 of 21 posts

Re: Why you should be wary of relying on a single histogram of a data set

#3
As mentioned, one should really be using a kernel density plot instead of a histogram, except when there are already classes in the data.

In R, one can simply do:

  library("ggplot2")
  library("datasets")
  ggplot(faithful, aes(x=eruptions)) + geom_density() + geom_rug()
which gives a chart like this (http://jean-francois.im/temp/eruptions-kde.png). Contrast with:

  ggplot(faithful, aes(x=eruptions)) + geom_histogram(binwidth=1)
which gives a chart like this (http://jean-francois.im/temp/eruptions-histogram.png).

Edit: Other plots mentioned in this discussion:

  ggplot(faithful, aes(x = eruptions)) + stat_ecdf(geom = "step")
Cumulative distribution, as suggested by leot (http://jean-francois.im/temp/eruptions-ecdf.png)

  qqnorm (faithful$eruptions)
Q-Q plot, as suggested by christopheraden (http://jean-francois.im/temp/eruptions-qq.png)

Re: Why you should be wary of relying on a single histogram of a data set

#4
Interesting paradox. I haven't seen that many statisticians using just a histogram when determining whether a certain distribution fits data reasonably. Kernel Density Estimators are a much better choice (for continuous data, like the data in the post), but they are also affected by your choice of bandwidth. When it comes down to it, like going to the doctor, sometimes the best choice is to get a second (or third!) opinion. For what it's worth, drawing a QQ Plot (something I've seen in every statistical consultation I've ever done) reveals the dependent structure of the data immediately and obviously in the form of a perfect linear relationship between any two variables.

Re: Why you should be wary of relying on a single histogram of a data set

#6

Interesting paradox. I haven't seen that many statisticians using just a histogram when determining whether a certain distribution fits data reasonably. Kernel Density Estimators are a much better choice (for continuous data, like the data in the post), but they are also affected by your choice of bandwidth. When it comes down to it, like going to the doctor, sometimes the best choice is to get a second (or third!) o…

Indeed, although Q-Q plots are very unlikely to be understood by people who don't have a good grasp of statistics, whereas a misleading histogram will be (and probably without knowledge of the caveats behind histograms).

Re: Why you should be wary of relying on a single histogram of a data set

#7
post #3

As mentioned, one should really be using a kernel density plot instead of a histogram, except when there are already classes in the data. In R, one can simply do: library("ggplot2") library("datasets") ggplot(faithful, aes(x=eruptions)) + geom_density() + geom_rug() which gives a chart like this ( http://jean-francois.im/temp/eruptions-kde.png ). Contrast with: ggplot(faithful, aes(x=eruptions)) + geom_histogram(binw…

But then you would have to choose a certain kernel and assume the data conforms to that distribution which isn't always true.

Re: Why you should be wary of relying on a single histogram of a data set

#8
post #7
post #3

As mentioned, one should really be using a kernel density plot instead of a histogram, except when there are already classes in the data. In R, one can simply do: library("ggplot2") library("datasets") ggplot(faithful, aes(x=eruptions)) + geom_density() + geom_rug() which gives a chart like this ( http://jean-francois.im/temp/eruptions-kde.png ). Contrast with: ggplot(faithful, aes(x=eruptions)) + geom_histogram(binw…

But then you would have to choose a certain kernel and assume the data conforms to that distribution which isn't always true.

Indeed, but that estimate is likely to be less misleading in most cases than a histogram(which is just a uniform kernel that is always aligned with bin boundaries).
Post reply on HN