Why Plotting Choices Matter
A distribution plot is a diagnostic, but it is also a set of choices. Bin width determines which values are grouped together; the vertical scale determines what bar heights mean; and axis limits determine which parts of the data are visible. A plot can therefore make observed and imputed values look similar even when their distributions differ, or make them look different simply because the plotting scales are inconsistent.
This tutorial focuses on these choices for a continuous variable. Let \(n_O\) be the number of observed values and \(n_M\) the number of values imputed for its missing cases in one completed data set. These groups need not have the same size. Nor should we assume their marginal distributions must match: the observed cases and the cases with missing values may differ. A plot is a diagnostic for features worth examining, not a test that the two distributions must be identical.
For a fair visual comparison, use the same bin edges and the same axis limits for observed and imputed values. If group sizes differ, compare relative frequencies or density heights, not raw counts. The variable must have the same definition and units in both groups, and any transformation must be applied identically. These conditions make the plots comparable; they do not make the groups interchangeable or remove differences due to missingness.
What the Histogram Scale Means
With equal-width bins, a relative-frequency histogram shows the proportion of each group in each bin. A density histogram rescales those proportions by bin width. The reason for that rescaling is that a density histogram is designed so the area of each bar equals the corresponding proportion.
Summing the bar areas over all bins gives \(\sum_j c_{gj}/n_g=1\), provided the bins cover all the group’s values. This is why raw counts are not a suitable height scale for comparing groups of different sizes: a larger group can have taller bars even when the proportions in every bin are exactly the same. With unequal-width bins, density heights are especially important. Plotting bin proportions as heights in that case makes the wider bars appear to represent more data simply because they cover more horizontal distance.
Worked Example: Normalizing for Different Group Sizes
Suppose a hypothetical comparison has 40 observed values and 60 imputed values. Use the shared bins 0–10, 10–20, and 20–30. The observed bin counts are 8, 20, and 12; the imputed bin counts are 12, 30, and 18. Each bin has width 10 units.
The raw counts are larger for the imputed group. For example, its middle-bin count is 30 compared with 20 observed values. But the middle-bin proportions are \(20/40=0.500\) for observed values and \(30/60=0.500\) for imputed values. The same calculation gives observed proportions \(0.200, 0.500, 0.300\), and imputed proportions \(0.200, 0.500, 0.300\).
The density heights in the middle bin are \(20/(40\times10)=0.0500\) per unit and \(30/(60\times10)=0.0500\) per unit. The first-bin heights are both \(0.0200\) per unit, and the last-bin heights are both \(0.0300\) per unit. The raw counts alone would misleadingly suggest more imputed values in every bin. Here, after normalization, the histograms coincide exactly.
The calculation assumes that both groups use the stated shared bins and that all values fall within the plotted range. It establishes only that the bin proportions match for this example; it does not establish that the underlying distributions match in every detail.
Selecting Bin Widths and Edges
A useful starting point is to choose a candidate width from the pooled observed and imputed values, then use the resulting edges for both groups. The Freedman–Diaconis rule is a common robust starting point:
where \(\mathrm{IQR}\) is the interquartile range and \(N=n_O+n_M\) for the pooled values used to choose the grid. Scott’s rule, \(h_{\mathrm{Scott}}=3.5sN^{-1/3}\), is another common starting point; it is more sensitive to extreme values because it uses the standard deviation \(s\). These are heuristics for displaying data, not rules that guarantee a correct or optimal picture. The choice of \(N\), and hence the suggested width, is affected by how many values are observed and imputed.
After choosing a candidate width, set shared edges that cover the values in both groups. Check the result at somewhat narrower and wider widths as well. Edges should not be chosen separately for each group: different edges can put the same measurement values in different bins, making bar heights incomparable. A common origin for the edges matters too. Shifting the grid while keeping the width fixed can change which values fall together.
Worked Example: When Wide Bins Conceal a Difference
Consider these hypothetical values in common measurement units. The eight observed values are 0.5, 1.5, 2.5, 3.5, 10.5, 11.5, 12.5, and 13.5. The eight imputed values are 4.5, 5.5, 6.5, 7.5, 8.5, 9.5, 10.5, and 11.5.
With shared edges at 0, 5, 10, and 15, the observed counts are 4, 0, and 4, while the imputed counts are 1, 5, and 2. Because both groups have eight values and each bin has width 5, the corresponding density heights are observed \(4/(8\times5)=0.100\), \(0\), and \(0.100\); imputed \(1/(8\times5)=0.0250\), \(5/(8\times5)=0.125\), and \(2/(8\times5)=0.0500\). This grid shows that the groups allocate their values differently across the range.
Now use a single shared bin from 0 to 15. Each group has count 8, proportion \(8/8=1\), and density height \(8/(8\times15)=0.0667\) per unit. The one-bin plot makes the groups look identical, even though their values occupy the range differently. The calculation demonstrates how an overly wide bin can hide a discrepancy; it does not identify which group is more appropriate for any particular imputation model.
The remedy is not to select a width solely because it makes a difference appear. Use a defensible initial grid and inspect nearby widths with the same edges for both groups. If the visual conclusion changes sharply under small, reasonable changes, report that sensitivity rather than treating one plot as decisive.
Axis Limits and Transformations
Use the same horizontal and vertical axis limits for both groups. A horizontal range that omits an extreme value can hide a tail discrepancy; a range expanded to include an extreme value can compress the central data until its differences are hard to see. When necessary, show both a full-range view and a clearly labelled zoom of the central range. The zoom supplements the full view; it should not silently replace it.
The vertical axis also needs attention. A truncated vertical axis can exaggerate small differences in bar height, while a range far larger than the observed heights can make real differences difficult to see. Density axes should have the same units and limits in the two panels. If the groups are shown in separate panels, matching axis limits is essential: independently scaled panels may look alike while representing very different heights, or unlike while representing similar heights.
A transformation can make a broad range easier to inspect. For positive, strongly right-skewed measurements, a logarithm can spread out smaller values and compress large ones. The same transformation must be applied to both observed and imputed values. A log-scale histogram has a different interpretation from one on the original scale: equal distances represent equal multiplicative changes, not equal additive changes in the measurement.
Worked Example: Reading a Log-Scale Histogram
Suppose hypothetical positive values are grouped into the common intervals 1–10, 10–100, and 100–1000 measurement units. There are 6 of 10 observed values in the first interval, 3 in the second, and 1 in the third. Of 10 imputed values, 3 fall in the first, 5 in the second, and 2 in the third.
On a base-10 log scale, those intervals become 0–1, 1–2, and 2–3, each of width 1. The observed relative-frequency heights are \(6/10=0.600\), \(3/10=0.300\), and \(1/10=0.100\); the imputed heights are \(3/10=0.300\), \(5/10=0.500\), and \(2/10=0.200\). On this transformed scale, the plots show a smaller imputed proportion in the lowest multiplicative range and larger proportions in the other two ranges.
This comparison uses identical log intervals and equal group sizes. It describes proportions per interval on the log scale, not density per original measurement unit. For a continuous variable \(X>0\), if \(Z=\log_{10}(X)\), the density on the original scale is \(f_X(x)=f_Z(\log_{10}x)/(x\ln 10)\). Thus, a density height on the log scale must not be described as a density per unit of \(X\). Check the transformed plot alongside the original-scale plot when the original units are substantively important.
Diagnostics, Alternatives, and Limits
A reliable visual check considers whether the apparent comparison survives reasonable plotting choices. Compare the full-range plot with any labelled zoom, and examine whether modest changes in bin width or edge origin substantially change the pattern. Check for values outside the displayed range, unequal group sizes plotted as counts, different axis limits, and transformations applied to only one group. A pile-up of values at particular numbers may also interact with the bin grid; an apparent bar pattern can partly reflect where the edges fall relative to rounded or heaped values.
Histograms are useful for local shape and mass in ranges, but their appearance depends on binning. Density plots avoid explicit bins but still rely on a smoothing bandwidth. Empirical CDFs compare cumulative proportions without a bin grid, while quantile plots focus on corresponding quantiles. These alternatives can help determine whether a visual impression is specific to one display, but each emphasizes different distribution features. None of these plots alone establishes that an imputation model is correct.
A transformation can reveal features obscured by skew, but it changes the scale of interpretation and can compress meaningful differences on the original scale. Likewise, a carefully chosen binning scheme cannot correct selection differences between observed cases and cases with missing values. The plots are descriptive diagnostics: a discrepancy calls for contextual investigation, not an automatic conclusion that imputation failed. A close marginal match is also not proof of adequate conditional or joint behavior.
Confirm that observed and imputed values represent the same variable and units, and state which imputed values are plotted.
Use a candidate bin width as a starting point, then use the same bin edges for both groups and check nearby reasonable choices.
Use proportions or density rather than raw counts when group sizes differ; match axis limits and show omitted tails clearly.
Compare a transformed view if useful, retain an original-scale view when units matter, and describe the plot as diagnostic rather than conclusive.
Common Mistakes
- Comparing raw counts from unequal groups. Taller bars may reflect more values rather than a larger proportion. Normalize by group size, and by bin width for density heights.
- Giving each group its own bins or axis limits. The bars then represent different intervals or scales. Use shared edges and limits for the comparison.
- Using one coarse binning and concluding the distributions match. Broad bins can merge distinct regions. Inspect reasonable alternatives and describe sensitivity.
- Interpreting a log-scale height in original units. The transformed plot describes intervals in log values; original-scale density requires the change-of-variables adjustment.
- Treating a visual discrepancy as proof of model failure. Observed and missing cases may differ. Investigate the context and other diagnostics rather than assuming their marginal distributions must coincide.
Check Your Understanding
Answer each question, then compare your reasoning with the solutions.
- Two groups have 25 and 50 values. Their counts in one shared bin are 5 and 10. Are their bin proportions different?
- For a bin of width 4, 12 of 60 values fall in the bin. Calculate its relative-frequency height and density height.
- Why can a single bin spanning the entire range fail to be useful for comparing two distributions?
- What does a histogram with equal-width bins on the \(\log_{10}\) scale treat as equal horizontal intervals?
Solutions. 1. No. The proportions are \(5/25=0.200\) and \(10/50=0.200\), so the bin contains the same fraction in each group. 2. The relative-frequency height is \(12/60=0.200\); the density height is \(12/(60\times4)=0.0500\) per measurement unit. Its area is \(0.0500\times4=0.200\). 3. It assigns every value in each group to the same bin, so both histograms have proportion 1 there regardless of how values are distributed within the range. 4. Equal multiplicative changes: for example, 1–10 and 10–100 each span one unit on the base-10 log scale, although their widths differ on the original scale.