Skip to main content

Bihistogram

NIST/SEMATECH Section 1.3.3.2 Bihistogram

27 53 80 106 27 53 80 106 Group A (Normal) Group B (Uniform) -2 -1 0 1 2 3 Value Frequency Bihistogram
A bihistogram is a graphical comparison tool that displays the frequency distributions of two datasets on a common horizontal axis, with one histogram plotted upward and the other plotted downward in mirror fashion. This back-to-back arrangement makes it straightforward to compare the shapes, centers, and spreads of two groups simultaneously.

What It Is

A bihistogram is a graphical comparison tool that displays the frequency distributions of two datasets on a common horizontal axis, with one histogram plotted upward and the other plotted downward in mirror fashion. This back-to-back arrangement makes it straightforward to compare the shapes, centers, and spreads of two groups simultaneously.

The upper histogram displays the frequency distribution of one group (e.g., before treatment) and the lower histogram displays the other group (e.g., after treatment) reflected downward on a shared horizontal axis. Both histograms use identical bin widths and bin boundaries so that visual comparison is valid. The back-to-back layout eliminates the alignment ambiguity of overlaid histograms.

Questions This Plot Answers

  • Is a (2-level) factor significant?
  • Does a (2-level) factor have an effect?
  • Does the location change between the 2 subgroups?
  • Does the variation change between the 2 subgroups?
  • Does the distributional shape change between subgroups?
  • Are there any outliers?

Why It Matters

The bihistogram reveals the full distributional impact of a two-level factor, not just a shift in means. It detects changes in location, spread, and shape simultaneously, catching effects that a simple t-test would miss. This comprehensive comparison is critical in manufacturing process changes where a shift in variability matters as much as a shift in average.

When to Use a Bihistogram

Use a bihistogram when comparing the distributional characteristics of two groups, such as a before-and-after treatment comparison, two competing manufacturing processes, or two measurement instruments. It is especially useful in quality engineering for assessing whether a process change shifted the location, altered the spread, or changed the shape of the distribution. The bihistogram provides a richer comparison than a simple comparison of summary statistics because it reveals the full distributional context.

How to Interpret a Bihistogram

The shared horizontal axis represents the measurement scale, while the upper histogram shows the frequency counts for one group and the lower histogram shows the counts for the other group reflected downward. A shift in the center of one histogram relative to the other indicates a difference in location between the two groups. A difference in the width of the two histograms suggests a difference in variability. Differences in shape, such as one distribution being symmetric while the other is skewed, are also readily apparent. When both histograms are roughly aligned and share a similar shape, the two groups are likely drawn from the same population.

Assumptions and Limitations

The bihistogram requires that both datasets share a common measurement scale and that the bin widths are identical for both groups. Results can be sensitive to the choice of bin width, so it is advisable to experiment with different numbers of bins. The technique does not provide a formal statistical test and should be complemented with quantitative two-sample tests when a decision threshold is needed. The bihistogram is restricted to factors with exactly two levels due to its back-to-back layout.

See It In Action

This technique is demonstrated in the following case studies:

Reference: NIST/SEMATECH e-Handbook of Statistical Methods, Section 1.3.3.2

Python Example

import numpy as np
import matplotlib.pyplot as plt
# Generate two groups of data (before/after treatment)
rng = np.random.default_rng(42)
before = rng.normal(loc=50, scale=8, size=200)
after = rng.normal(loc=55, scale=6, size=200)
# Create bihistogram with shared x-axis
bins = np.linspace(25, 80, 35)
fig, (ax1, ax2) = plt.subplots(2, 1, sharex=True,
figsize=(10, 6))
ax1.hist(before, bins=bins, density=True, alpha=0.7,
color='steelblue', edgecolor='white')
ax1.set_ylabel("Density")
ax1.set_title("Before Treatment")
ax2.hist(after, bins=bins, density=True, alpha=0.7,
color='coral', edgecolor='white')
ax2.invert_yaxis()
ax2.set_ylabel("Density")
ax2.set_xlabel("Measurement Value")
ax2.set_title("After Treatment")
fig.suptitle("Bihistogram: Before vs After", y=1.02)
plt.tight_layout()
plt.show()