{"id":38,"date":"2006-10-17T19:59:45","date_gmt":"2006-10-17T17:59:45","guid":{"rendered":"http:\/\/www.theusrus.de\/blog\/?p=38"},"modified":"2012-09-09T21:24:42","modified_gmt":"2012-09-09T19:24:42","slug":"statistical-graphics-101-histograms","status":"publish","type":"post","link":"https:\/\/www.theusrus.de\/blog\/statistical-graphics-101-histograms\/","title":{"rendered":"statistical graphics 101: Histograms"},"content":{"rendered":"<p>It&#8217;s been too long since the last posting (on <a href=\"http:\/\/www.theusrus.de\/blog\/statistical-graphics-101-barcharts\/\">barcharts<\/a>) in the teaching corner. This one will be on histograms.<\/p>\n<p>\nHistograms are often mistaken with barcharts. The fundamental distinction between the two is\n<\/p>\n<ul>\n<li> Barcharts show counts (or weights) for the discrete axis of a <strong>categorical<\/strong> variable\n<\/li>\n<li> Histograms show an approximation of the density function (if scaled accordingly) of a <strong>countinuous<\/strong> variable.\n<\/li>\n<\/ul>\n<p>As a consequence, the only thing that can be quantified in a barchart is the bar <strong>height<\/strong> (better length, which makes it independent from their orientation). On the other hand, in a histogram, the <strong>area<\/strong> of the boxes is proportional to the density approximation. If all bars have the same width in a barcharts, or gaps are drawn in a histogram (which is complete nonsense), the two plots can get mixed up.<\/p>\n<p><center><br \/>\n<img decoding=\"async\"  src=\"http:\/\/www.theusRus.de\/Blog-files\/histo.png\"><br \/>\n(% votes for Kerry in the 2004 presidential election)<br \/>\n<\/center><\/p>\n<p>\nMuch has been written about optimal bin width for histograms &#8211; almost nothing about the choice of the anchor point. Changing the latter often changes the shape of the histogram more dramatic than choosing between 8, 9 or 10 bins.<br \/>\nSetting the anchor point from 0 to -2.4 yields:\n<\/p>\n<\/p>\n<p><center><br \/>\n<img decoding=\"async\"  src=\"http:\/\/www.theusRus.de\/Blog-files\/anchor.png\"><br \/>\n(changing the anchor point to -2.4)<br \/>\n<\/center><\/p>\n<p>\nIn most applications, there are <strong>sensible<\/strong> breaks which can be chosen. Since we look at 3,111 voting districts, we can use far more bins and start at 0 with bin width of 5.\n<\/p>\n<\/p>\n<p><center><br \/>\n<img decoding=\"async\"  src=\"http:\/\/www.theusRus.de\/Blog-files\/density.png\"><br \/>\n(using meaningful parameters (0, 5) &#8211; density estimate added)<br \/>\n<\/center><\/p>\n<p>\nIf we link a second attribute into the histogram, the whole thing gets more exiting!\n<\/p>\n<\/p>\n<p><center><br \/>\n<img decoding=\"async\"  src=\"http:\/\/www.theusRus.de\/Blog-files\/hilite.png\"><br \/>\n(all districts where more than 15% have a college degree selected)<br \/>\n<\/center><\/p>\n<p>\nWe don&#8217;t really can see what is going on here (although we might guess, that there is a slightly higher proportion of highlighting towards the higher votes for Kerry).<\/p>\n<p>\nWhen we use the same normalization trick as for Spineplots (see <a href=\"http:\/\/statgraphics.blog.com\/178439\/\">previous post<\/a>), we get the clearer picture of the <strong>Spinogram<\/strong>:\n<\/p>\n<\/p>\n<p><center><br \/>\n<img decoding=\"async\"  src=\"http:\/\/www.theusRus.de\/Blog-files\/spinogram.png\"><br \/>\n(highlighting in a Spinogram)<br \/>\n<\/center><\/p>\n<p>\nWell, that&#8217;s what we would have expected, probably except for the increase at the left end of the scale.\n<\/p>\n<\/p>\n<p>\nThe problem with the histograms used so far is that we looked at voting districts, and not at voters! This will distort the impression if the districts are not of equal size. Weighting above histogram will move the mode further to the right.\n<\/p>\n<\/p>\n<p><center><br \/>\n<img decoding=\"async\"  src=\"http:\/\/www.theusRus.de\/Blog-files\/weighted.png\"><br \/>\n(the weighted histogram represents voters not districts)<br \/>\n<\/center><\/p>\n<p>\nFinally we get the weighted spinogram, which probably supports more the hypothesis &#8230; of the selected group.\n<\/p>\n<\/p>\n<p><center><br \/>\n<img decoding=\"async\"  src=\"http:\/\/www.theusRus.de\/Blog-files\/spinoweight.png\"><br \/>\n(the weighted spinogram)<br \/>\n<\/center><\/p>\n<p>\n(Sorry for the lengthy post &#8230; but concepts get a bit more complex)    <\/p>\n","protected":false},"excerpt":{"rendered":"<p>It&#8217;s been too long since the last posting (on barcharts) in the teaching corner. This one will be on histograms. Histograms are often mistaken with barcharts. The fundamental distinction between the two is Barcharts show counts (or weights) for the discrete axis of a categorical variable Histograms show an approximation of the density function (if [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[],"class_list":["post-38","post","type-post","status-publish","format-standard","hentry","category-stat-graphics-101"],"_links":{"self":[{"href":"https:\/\/www.theusrus.de\/blog\/wp-json\/wp\/v2\/posts\/38","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.theusrus.de\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.theusrus.de\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.theusrus.de\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.theusrus.de\/blog\/wp-json\/wp\/v2\/comments?post=38"}],"version-history":[{"count":14,"href":"https:\/\/www.theusrus.de\/blog\/wp-json\/wp\/v2\/posts\/38\/revisions"}],"predecessor-version":[{"id":1519,"href":"https:\/\/www.theusrus.de\/blog\/wp-json\/wp\/v2\/posts\/38\/revisions\/1519"}],"wp:attachment":[{"href":"https:\/\/www.theusrus.de\/blog\/wp-json\/wp\/v2\/media?parent=38"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.theusrus.de\/blog\/wp-json\/wp\/v2\/categories?post=38"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.theusrus.de\/blog\/wp-json\/wp\/v2\/tags?post=38"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}