Title: Continuous variable: The histogram
Course: UGQuants (SSPS) > Section: Data Visualisation

continuous variable

A histogram represents the distribution of an interval level variable using a series of bars (or bins).  The x-axis of the graph shows the range of values the variable can take, while the y-axis shows the frequency of these different values (either in absolute numbers or in terms of a proportion).  A basic histogram is shown below (left), it is worth noting that in contrast to a bar graph (used for categorical variables ) the bars of a histogram generally touch each other to indicate the continuous nature of the underlying variable.  Histograms can also take the form of a line connecting the different categories of the x-axis rather than using bars, such graphs are known as Frequency Polygons (centre) or Density Plots (right).

Considering the histogram (and related graphs) above, we get a good impression of the overall shape of the level of CO2 emissions across different countries. Generally speaking, many countries have a relatively low level of CO2 emissions with a smaller number of countries having particularly high levels of emissions.   However, the grouped nature of data in a histogram mean it is not possible to precisely identify the median value of the distribution, while the range can be estimated reasonably well from the density plot (which has actual values of its x-axis), but only hinted at from the histogram/frequency polygon which are based on grouped data.

Overall then, histograms (and related plots) are probably best suited to considering the overall shape of a variable, with variables typically described as following one of three shapes.

The image at the top left of the figure above shows an example of a right- or positively skewed distribution. Large numbers of cases tend to take values towards the lower end of the range ofvalues, with increasing smaller numbers of cases taking higher values. The longer ‘tail’ of the data is towards the right, towards the higher values. In positively skewed data the mode will be lower than the median which will in turn be lower than the mean. Income is a good real life example of data that is often positively skewed, because typically we find large numbers of people on low incomes and a small group on very high incomes. This is because there is an obvious limit or ‘floor’ below which income cannot fall (i.e. 0 income) but no upper limit to how much individuals can earn.

The image at the top right of the figure above shows an example of a left- or negatively skewed distribution. Large numbers of cases tend to take values towards the upper end of the range ofvalues, with increasing smaller numbers of cases taking lower values. The longer ‘tail’ of the data is towards the left, towards the lower values. The mode is therefore higher than the median, which is in turn higher than the mean. Age at retirement would be an example of this kind of skew, because most people now retire in their mid-60s but smaller numbers of people retire earlier and even smaller numbers retire when they are comparatively young.

The image at the bottom of the figure above (labelled ‘No Skew’) is in fact the most important of all. This is an example of a perfectly normal distribution represented by a perfectly symmetrical bell-shaped curve where the mode, median and mean coincide and there are increasingly fewer numbers of cases the further we move along the two ‘tails’ towards the extreme data points.

This is important partly because certain types of analysis assume that data for a variable are normally (or at least near normally) distributed. We encounter these in other parts of the course.