Mean Plot
NIST/SEMATECH Section 1.3.3.20 Mean Plot
What It Is
A mean plot displays the group means versus group identifier, with a horizontal reference line drawn at the overall mean of all observations. The grouping is determined by the analyst: groups may be levels of a factor variable, time periods such as months, or arbitrary equal-sized segments of a data series.
The horizontal axis shows group identifiers (categorical labels such as factor levels, months, or sequential group numbers). The vertical axis shows the group mean for each group. A horizontal reference line at the overall mean of all observations provides a baseline for comparison. The deviation of each group mean from the overall mean line indicates where and by how much the location shifts.
Questions This Plot Answers
- Are there any shifts in location?
- What is the magnitude of the shifts in location?
- Is there a distinct pattern in the shifts in location?
Why It Matters
A common assumption in one-factor analyses is that of constant location across different levels of the factor variable. The mean plot provides a graphical check for that assumption. For univariate data, grouping the data into equal-sized intervals and plotting the group means provides a graphical test of whether the location is constant over time.
When to Use a Mean Plot
Use a mean plot to see if the mean varies between different groups of the data. Mean plots can detect shifts in location across factor levels, time periods, or any analyst-defined grouping. For ungrouped data, the series can be split into an arbitrary number of equal-sized groups to check whether the mean is changing over time. The mean plot is typically used in conjunction with the standard deviation plot: the mean plot checks for shifts in location while the standard deviation plot checks for shifts in scale.
How to Interpret a Mean Plot
The horizontal axis shows the group identifier and the vertical axis shows the corresponding group mean. A horizontal reference line at the overall mean provides a baseline for comparison. Groups whose means depart noticeably from the overall mean line indicate shifts in location. The magnitude of the departure indicates the size of the shift, and systematic patterns (e.g., an upward trend or a step change) reveal whether location is drifting or changing abruptly. Although the mean is the most common measure of location, the same concept applies to the median or trimmed mean when significant outliers are present.
Assumptions and Limitations
The mean plot assumes that the sample means are reasonable estimators of the population means, which requires that within-group sample sizes are not too small. It does not account for variability within each group, so it should be interpreted in conjunction with the standard deviation plot or box plots. Equal sample sizes across groups are not required but simplify interpretation.
Reference: NIST/SEMATECH e-Handbook of Statistical Methods, Section 1.3.3.20
Formulas
Group Mean
The mean of all observations within the j-th group, where n_j is the number of observations in that group.
Overall Mean
The mean of all N observations pooled across all groups, serving as the horizontal reference line on the mean plot.
Python Example
import numpy as npimport matplotlib.pyplot as plt
# Monthly data — location shifts after month 6 (NIST 1.3.3.20 style)rng = np.random.default_rng(42)months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']# First 6 months: mean ~20; last 6 months: mean ~25true_means = [20, 21, 19, 20, 22, 20, 25, 26, 24, 25, 27, 25]n_per_group = 20groups = [rng.normal(mu, 3, n_per_group) for mu in true_means]
# Compute group means and overall mean (mean of all observations)means = [g.mean() for g in groups]all_data = np.concatenate(groups)overall_mean = all_data.mean()
fig, ax = plt.subplots(figsize=(10, 5))ax.plot(range(len(months)), means, 'o-', color='steelblue', markersize=8, linewidth=2, label='Group Mean')ax.axhline(overall_mean, color='red', linestyle='--', linewidth=1.5, label=f'Overall Mean = {overall_mean:.1f}')ax.set_xticks(range(len(months)))ax.set_xticklabels(months)ax.set_xlabel("Month")ax.set_ylabel("Mean Response")ax.set_title("Mean Plot — Shift in Location After Month 6")ax.legend()ax.grid(True, alpha=0.3)plt.tight_layout()plt.show()