The amount of protein (in grams) for a selection of fast-food sandwiches is given below.
23, 30, 20, 27, 44, 26, 35, 20, 29, 29, 25, 15, 18, 27, 19, 22, 12, 26, 34, 15, 27, 35, 26, 43, 35, 14, 24, 12, 23, 31, 40, 35, 38, 57, 22, 42, 24, 21, 27, 33
Suppose we wish to construct a frequency histogram for this data (using a TI-83+ calculator).
First, we go through many of the same steps as those used for constructing a frequency distribution. (Think about it: a histogram is just a graphical representation of the distribution, so it should make sense that we need to start things in a similar way!).
We need to get the values into our calculator, if they aren't already there...
We need to know our maximum and minimum data values, so...
For the data above, we have a minimum of 12 and a maximum of 57.
We can use these as our minimum and maximum class limits, but round numbers are nice and pretty looking, so you may want to consider lowering your minimum class limit (Just don't stray too far away from the actual minimum!)
In our case, 12 is fairly close to a nice round 10, so let's make that our minimum class limit.
No data values should fall on the borders of our classes. An easy way to stop that from happening is to take your minimum class limit and subtract either .5, .05, .005, or something similar -- so that the number of decimal places of your answer is one greater than the number of decimal places your most precise data has.
For this example, that would make the lowest class boundary 9.5.
There is a slight difference between a "class limit" and a "class boundary".
Decide how many classes you want, if this is not already known. You will probably need between 5 and 20 classes, with more classes being more appropriate for larger data sets.
Suppose, for this example, that we want 10 classes.
Now, we need to find out how wide to make each class.
For our example, this calculation yields: (57-10)/10 = 4.7
Now, round this up to the next value with the same precision as your data.
In our example, this would mean rounding 4.7 up to the next integer, which is 5. This is our class width.
We can now start describing our classes.
Our class boundaries start at 9.5 and have width 5, so we have the following classes:
9.5 - 14.5 14.5 - 19.5 19.5 - 24.5 24.5 - 29.5 29.5 - 34.5 34.5 - 39.5 39.5 - 44.5 44.5 - 49.5 49.5 - 54.5 54.5 - 59.5
To get the calculator to draw the histogram for us:
Now, if you need to draw this histogram somewhere (like on a test or quiz), it would be useful to have some labels on things.
First, label your class boundaries using the list above as a guide.
Now, label the class mark for each class. The class mark is the center value in each class, and can be quickly found by averaging the upper and lower class boundaries for the class in question.
For example, our first class mark is equal to (9.5+14.5)/2 = 12
Finding and labeling these values for each class, we now have
Lastly, label the y-axis appropriately (Remember, we set Yscl equal to 2 earlier, so each tick mark on the y-axis goes up 2 units.)
And we are done!