Why Histograms Are Useful
A histogram gives a compact view of how the values of a numeric variable are distributed. For an actuarial analyst, a histogram of hypothetical claim amounts, processing times, or policy durations can reveal where observations concentrate and whether the data include gaps or unusually separated values. These patterns help guide exploration, but a histogram alone does not explain why they occur or establish that an unusual observation is an error.
A histogram divides a numeric scale into intervals, called bins, and represents the observations in each interval with an adjacent bar. The horizontal axis shows the variable and its units; the vertical axis shows either bin counts or density. The intervals are ordered numeric ranges, not named categories, which is why the bars ordinarily touch.
A histogram is descriptive: it organizes observed values and does not require a particular probability distribution, such as a normal distribution. Its usefulness depends on the values being measured on a meaningful numeric scale and the axes and intervals being read correctly. When describing a sample as evidence about a broader population, the sample’s representativeness also matters.
Building a Histogram in Base R
The base R function hist() constructs a histogram for a numeric vector. For a clear count histogram, specify the breaks, label the axes in context, and set freq=TRUE. For example, a vector named duration might be plotted with hist(duration, breaks=c(0, 10, 20, 30, 40), right=TRUE, include.lowest=TRUE, freq=TRUE, main="Processing duration", xlab="Minutes", ylab="Number of records").
The breaks argument supplies the bin boundaries. With right=TRUE, the intervals are right-closed: the interval from 0 to 10 contains values greater than 0 and up to and including 10. With include.lowest=TRUE, the lowest boundary is included in the first interval. Thus, if breaks are 0, 10, and 20, the bins are [0, 10] and (10, 20]. A value exactly equal to 10 goes in the first bin, not the second.
If breaks are not supplied, R chooses them automatically. That can be useful for an initial exploration, but the resulting boundaries may not be the intervals needed for a particular interpretation. In a count histogram with equally wide bins, bar heights are counts. R’s default vertical scale can depend on whether the breaks are equally spaced, so specifying freq=TRUE avoids confusion when counts are intended. For unequal-width bins, a density scale is often more appropriate for comparing the distribution across intervals.
Worked Example: Counting Processing Times
A hypothetical operations team records the following processing times, in minutes, for 12 requests: 4, 7, 9, 12, 14, 16, 18, 21, 22, 27, 33, and 36. Construct a count histogram using bins from 0 to 10, 10 to 20, 20 to 30, and 30 to 40 minutes. State what its axes and bar heights mean.
Method. Set the breaks to 0, 10, 20, 30, and 40, use right-closed bins, and request frequencies. The corresponding R call is hist(duration, breaks=c(0, 10, 20, 30, 40), right=TRUE, include.lowest=TRUE, freq=TRUE, main="Request processing times", xlab="Minutes", ylab="Number of requests"), where duration contains the 12 values.
Count the first bin. The interval [0, 10] contains 4, 7, and 9, so its count is 3.
Count the second bin. The interval (10, 20] contains 12, 14, 16, and 18, so its count is 4.
Count the third bin. The interval (20, 30] contains 21, 22, and 27, so its count is 3.
Count the fourth bin. The interval (30, 40] contains 33 and 36, so its count is 2. The checks are \(3+4+3+2=12\), matching the 12 recorded times.
The horizontal axis is processing time in minutes, and the vertical axis is the number of requests. The tallest bar is for (10, 20], with four requests. A common mistake is to put a value of 20 in the third bin because it lies at the bin’s boundary. Under R’s right-closed convention, 20 belongs to the second bin, (10, 20].
Reading Shape, Gaps, and Isolated Bars
After checking the axes, describe the overall pattern rather than treating each bar as a separate conclusion. Useful descriptive features include where observations are concentrated, how the distribution extends across the scale, whether one side has a longer tail, and whether there are empty or sparsely populated intervals. A gap is a range of values with no observations in the displayed data. An isolated bar is separated from the main concentration by one or more empty bins.
These features are clues for further investigation, not diagnoses. An isolated bar might reflect a genuine but uncommon value, a different subgroup, a unit or recording issue, or a feature of the sample. The plot does not tell you which explanation is correct. Describe what is visible, then check the source records and context before making a data-quality decision.
Worked Example: Describing a Gap and an Isolated Bar
A hypothetical insurer reviews 21 claim-processing times, in minutes: 12, 18, 21, 25, 27, 29, 31, 32, 34, 36, 38, 41, 43, 45, 47, 49, 51, 53, 55, 57, and 118. Use bins with boundaries 0, 20, 40, 60, 80, 100, and 120. Describe the plotted pattern and state what should be checked before treating the largest time as an error.
Method. Use hist(time, breaks=c(0, 20, 40, 60, 80, 100, 120), right=TRUE, include.lowest=TRUE, freq=TRUE, main="Claim-processing times", xlab="Minutes", ylab="Number of claims"), with the listed observations stored in time.
Count the bins. The interval [0, 20] contains 12 and 18, giving 2. The interval (20, 40] contains 21, 25, 27, 29, 31, 32, 34, 36, and 38, giving 9. The interval (40, 60] contains 41, 43, 45, 47, 49, 51, 53, 55, and 57, also giving 9. The intervals (60, 80] and (80, 100] are empty, and (100, 120] contains 118, giving 1. The counts sum to \(2+9+9+0+0+1=21\).
Interpret the shape. The observations are concentrated between 20 and 60 minutes. There is a gap from above 60 through 100 minutes, followed by an isolated bar containing one observation between 100 and 120 minutes. The plot shows that 118 is separated from the main group; it does not show whether the time was recorded incorrectly. Check the underlying claim record, units, and processing history before deciding whether the value is plausible.
A common mistake is to call the 118-minute observation an error based on the plot alone. The correction is to state the visible separation and treat it as a reason to investigate, not as proof that the observation should be removed.
Count and Density Scales
The vertical axis needs particular care. In a count histogram, a bar’s height is the number of observations in its bin. In a density histogram, a bar’s height is not a count or a probability by itself. Its area represents the fraction of observations in the bin. If the bins have different widths, comparing bar heights as though they were counts can be misleading.
In base R, freq=FALSE requests a density scale; probability=TRUE is an equivalent option. The vertical units are the reciprocal of the horizontal units. For example, if the horizontal axis is measured in minutes, density is measured per minute. When using this scale, read bar area rather than height as the proportion of observations in a bin.
Worked Example: Interpreting a Density Histogram
Ten hypothetical service times, in minutes, are 1, 4, 6, 8, 10, 12, 14, 18, 22, and 29. Use bins [0, 5], (5, 15], and (15, 30] and make a density histogram. Find each bin’s count and density height, then interpret the middle bar.
Method. Use hist(service, breaks=c(0, 5, 15, 30), right=TRUE, include.lowest=TRUE, freq=FALSE, main="Service times", xlab="Minutes", ylab="Density per minute"), with the ten times stored in service.
Count the bins. The first bin contains 1 and 4, so \(c_1=2\) and its width is 5 minutes. The second contains 6, 8, 10, 12, and 14, so \(c_2=5\) and its width is 10 minutes. The third contains 18, 22, and 29, so \(c_3=3\) and its width is 15 minutes. The counts sum to \(2+5+3=10\).
Calculate the density heights. The first height is \(2/(10\cdot5)=0.04\) per minute. The second is \(5/(10\cdot10)=0.05\) per minute. The third is \(3/(10\cdot15)=0.02\) per minute. The bar areas are \(0.04\cdot5=0.20\), \(0.05\cdot10=0.50\), and \(0.02\cdot15=0.30\), which sum to 1.
The middle bar has density height 0.05 per minute, and its area, 0.50, shows that half the observations fall in that bin. A common mistake is to read the height 0.05 as five observations. It is not a count: multiplying the height by the bin width gives the fraction, \(0.05\cdot10=0.50\), and multiplying that fraction by \(n=10\) gives the count of 5.
A Reliable Reading Process
A short, consistent check prevents many interpretation errors. First confirm the variable and units on the horizontal axis. Next identify the bin boundaries and which observations are included at the edges. Then determine whether the vertical axis is showing counts or density. Only after those checks should you describe the distribution’s concentration, spread, gaps, or isolated bars.
Confirm that the plotted variable is numeric and that the horizontal-axis label gives its units.
Identify the breaks and boundary convention. For R’s default right-closed bins, a shared boundary value goes in the bin ending at that value.
Read bar heights as counts only on a count scale. On a density scale, use bar areas to represent fractions.
Report the visible concentration, shape, gaps, or isolated bars. Treat unusual features as prompts to check context and source data, not as conclusions about cause or error.
A histogram is most informative when its axes are explicit and its bars are interpreted on the scale actually displayed. The same discipline—identify what each axis measures, check the grouping rule, and distinguish observation from explanation—also helps when reviewing exploratory plots in an actuarial analysis. This approach is aligned with the SOA Exam PA (Predictive Analytics) syllabus.
Check Your Understanding
For each problem, identify the relevant bin rule or axis interpretation before checking the final answer.
- A count histogram uses breaks 0, 10, 20, and 30 with R’s right-closed convention. The observations are 6, 10, 11, 18, 20, and 21. What are the counts in the three bins? (Answer: 2, 3, and 1.)
- A histogram has bin counts 5, 8, 0, and 1 for successive intervals (0, 10], (10, 20], (20, 30], and (30, 40]. Describe the visible gap and the position of the isolated bar. (Answer: The (20, 30] interval is empty, and the single observation in (30, 40] is separated from the preceding occupied bins by that gap.)
- A density histogram has 20 observations in total. A bin has width 10 and contains 6 observations. What is its density height, and what fraction of the observations does its area represent? (Answer: The height is 0.03 per unit, and the area is 0.30, or 30%.)
- With breaks 0, 5, 10, and 15, R uses right-closed bins and includes the lowest boundary. The observations are 0, 5, 10, and 15. What are the three counts? (Answer: 2, 1, and 1; the value 0 is included in the first bin, and each shared boundary value of 5 or 10 goes in the bin ending at that value.)
- A density histogram has 12 observations and breaks 0, 5, 15, and 30. The respective bin counts are 3, 6, and 3. What are the three density heights? (Answer: 0.05, 0.05, and 0.0167 per unit, to four decimal places for the last height.)