Calculating the Frequencies for a Histogram It is easy to understand how you would build a frequency histogram for variables that have category values, such as the colour of an object or discreet values such as 1,2,3 and 4. In such cases, each bar in a histogram would represent a single value and the height of the bar would reflect the frequency with which that value appears in the data.
The procedure is even easier if you have sorted your data into order first, as this puts all the equal values next to each other.
Simply work through the data counting how many times each value occurs.
Plot these numbers in a bar chart, labelling the y axis as 'Frequency' and the x axis with your variable's name. Each bar should be labelled with the name of the value it represents.
For numeric variables, there can be a few complications:
If your data contains whole discrete numbers, it might not contain every number in the range. For example, you might survey families and find people have 0,1,2,3,4 or 6 children (none with 5 children, note). Would you have a space for 5 with no bar in it? It would make the missing value more obvious, which is good, but in some cases this might lead to a very sparse graph, for example if data contained only values of 1, 10, 100 and 1000, you wouldn't want to use 1000 bars, all but 4 of which were empty. You need to think about the missing values and decide for yourself whether to include an empty bar for them.
For continuous values, you may find that no single value is repeated twice (for example, 1.1, 1.2, 1.5, 2.1, 2,2 .. etc.) In such cases, you must group values together into 'bins'. In our example above, we might choose bins covering 1 to 2, 2.1 - 3, etc. There is a help topic below that explains how to calculate the bin ranges for continuous numbers.
Exploration
In this section, you must think about how you would plot different data sets on a histogram. In each question, you will be shown a small set of data and asked to decide how it should be treated to produce the right kind of histogram. Note that the numbers show the raw data, not the frequency counts.
Data
What would you plot?
1,1,2,2,3,3,3,5
1,1,70,150,150,350
1.54, 1.61, 1.7, 4.53, 4.62, 7.84, 8.14
Application
Counting the Frequencies for Your Data Below on the left are the values of cost. You are going to count the number of occurances of each value in the data. This task is much easier if you sort the data first, which we have done for you. Your data has 15 different values, so there are 15 boxes to enter the counts into. Count the frequency of each different value and enter it into each box.
Cost
71
71
138
138
145
145
251
251
251
381
435
435
435
493
493
493
548
548
548
663
663
663
772
772
861
861
980
988
1009
1024
When you have filled in all the frequencies correctly, click 'Plot' to see the histogram plotted.
Now we can do the same for no. apps, which has 15 different values. Count the frequency of each different value and enter it into each box.
No. Apps
5
10
12
15
23
23
27
41
41
41
46
46
46
56
56
59
59
59
62
62
72
75
75
78
83
100
100
110
110
110
When you have filled in all the frequencies correctly, click 'Plot' to see the histogram plotted.