Why Compare Trends Within Groups?
A scatterplot with points colored by category can show whether groups occupy different parts of the graph. But when the question is how the response changes with a quantitative predictor within each group, the points may be difficult to summarize by eye. Group-specific smoothers make those patterns easier to compare: each curve summarizes the observed response pattern for one category across the predictor values represented in that category.
The comparison is visual and descriptive. A smoother can help reveal whether groups have similar directions, different curvature, or different response levels at comparable predictor values. It does not by itself test whether the patterns differ, establish a causal effect, or make reliable predictions where a group has little data. Those limits matter especially when the groups cover different ranges of the predictor.
Overlay or Facet?
An overlay places the groups’ points and smoothers in one set of axes. It makes direct comparison convenient when the number of groups is small and the curves can be distinguished by color or line type. Use the same axis scales and, for a direct comparison, the same smoothing method and span for each group. Otherwise, apparent differences may partly reflect different visual scales or different smoothing choices.
A faceted display gives each group its own panel. Facets reduce overlap when many points or curves would obscure one another. Keeping the same horizontal and vertical scales across panels makes the shapes and levels comparable. If panels use different scales, each group may be easier to inspect on its own, but visual comparisons of slope, spread, or vertical position become less direct.
Neither display is always best. An overlay can become cluttered, while facets can make it harder to compare groups at a glance. Start by asking how many groups there are, how much their data overlap, and whether the comparison requires shared scales. State clearly which curve belongs to which group.
Worked Example: Reading an Overlay at Comparable Predictor Values
Suppose a hypothetical plot compares hourly energy use \(Y\), in kilowatt-hours, with outdoor temperature \(x\), in degrees Celsius, for homes in two categories: older homes and newer homes. An overlay uses the same LOESS method and span for both groups. The displayed curves can be read approximately as follows:
| Temperature (°C) | Older homes (kWh) | Newer homes (kWh) |
|---|---|---|
| 10 | 24 | 19 |
| 15 | 20 | 17 |
| 20 | 18 | 16 |
At \(10^\circ\)C, the estimated vertical gap is \(24-19=5\) kWh; at \(20^\circ\)C, it is \(18-16=2\) kWh. Thus, in this hypothetical display, the older-homes curve is above the newer-homes curve at both of these temperatures, but the gap is smaller at the warmer temperature. Both curves decline over the listed range, and the decline appears steeper for older homes over that range.
These are approximate readings from the displayed smoothers, not exact group averages or model coefficients. The pattern supports a descriptive comparison over the temperatures represented in both groups. It does not show that home age causes the difference in energy use; other characteristics of the homes may also differ.
Make Comparisons Where Both Groups Have Data
A curve can be drawn at predictor values where its group has few observations, but the line there may be unstable or strongly influenced by nearby points. More importantly, comparing one group’s well-supported curve with another group’s curve in a sparsely observed region can give a misleading impression of how their patterns differ. The relevant question is not merely whether both curves appear on the graph, but whether both groups have enough observations near the \(x\)-values being compared.
A useful first check is each group’s observed predictor range. The intersection of these ranges identifies where both groups have at least some observations, although range overlap alone does not guarantee dense coverage. A rug plot, point display, or other indication of predictor density helps reveal gaps within the overlap. The earlier material on mapping predictor density with rugs and sparse regions is useful here.
As a short justification, suppose group A has observations only for \(x\) from 0 to 10, while group B has observations from 6 to 16. Their ranges overlap from 6 to 10. A comparison at \(x=8\) is within both observed ranges; a comparison at \(x=13\) is not, because group A has no observations there. A drawn group A curve at \(x=13\) would extend beyond its observed range, so it cannot support a direct comparison at that value. Even at \(x=8\), inspect the actual point density: a handful of scattered observations is weaker support than a dense cluster.
Worked Example: Restricting the Comparison to Shared Coverage
A hypothetical plot compares response time in minutes with workload score for teams in two categories. The observed workload scores are:
| Group | Observed workload scores | Number of observations |
|---|---|---|
| Team A | 10, 12, 14, 16, 18, 20 | 6 |
| Team B | 16, 18, 20, 22, 24, 26 | 6 |
Team A’s range is 10 to 20, and Team B’s range is 16 to 26. The shared range is therefore 16 to 20. For example, both groups have observations at scores 16, 18, and 20. At score 24, only Team B has observations, so comparing the two curves there would require extending Team A’s pattern beyond its observed range.
The shared range contains only three listed workload scores per group. That is evidence of some overlap, not a guarantee that the smoothers are stable at every value in the interval. A responsible reading would compare the curves cautiously within 16 to 20, check the plotted points near the comparison, and avoid claiming a well-established difference from this small data set.
Describe the Pattern Before Naming a Difference
When comparing curves, describe what the display shows in a consistent order:
- Direction: Does each curve generally rise, fall, or remain fairly level over the shared range?
- Form: Do the curves have similar shapes, or does one bend or change direction differently?
- Vertical position: At comparable predictor values, is one curve generally above another? Is the gap roughly constant or does it change?
- Support: Are these features visible where both groups have enough observations?
Keep the description tied to the display and its units. For instance, “over workload scores of 16 to 20, the Team A smoother is higher and both curves decline” is clearer than “Team A performs worse.” The latter is vague, may impose an unstated meaning on the response, and can overreach beyond the plotted relationship.
Worked Example: Distinguishing a Crossing from a Consistent Gap
In a hypothetical plot, two categories of plants are compared by a smoother of plant height, in centimetres, against weeks since planting. Both groups have substantial observations from week 2 through week 8. Approximate curve readings are:
| Week | Group X (cm) | Group Y (cm) |
|---|---|---|
| 2 | 12 | 15 |
| 5 | 25 | 25 |
| 8 | 33 | 30 |
At week 2, the difference \(X-Y\) is \(12-15=-3\) cm, so Group X’s curve is 3 cm lower. At week 5, the difference is \(25-25=0\) cm. At week 8, it is \(33-30=3\) cm. The curves therefore meet near week 5 and switch vertical order across the displayed range. The visual pattern is not a constant gap between groups: Group Y is higher early, while Group X is higher later.
This comparison is supported over weeks 2 to 8 because both groups have substantial data there. It describes the plotted response patterns, not a formal test that the curves differ and not a causal effect of plant category.
A Short Guide to a Fair Visual Comparison
State which categories define the separate point sets and curves.
Use an overlay for a manageable number of distinct curves; use facets when overlap makes the display hard to read.
Use the same smoother type, span, and axis scales when the aim is to compare patterns directly.
Inspect the points or predictor-density display, identify shared support, and avoid relying on sparse tails.
Report direction, form, and relative position in context, and limit the statement to the range supported by both groups.
Common Mistakes
- Treating the pooled smoother as a substitute for group-specific curves. A pooled curve summarizes the combined data and can conceal differences between categories. When the question concerns within-group patterns, display the groups separately.
- Comparing curves at different predictor values. A vertical gap is meaningful as a group comparison at the same \(x\)-value. If one group has no nearby data, the apparent gap may depend on unsupported extension of its curve.
- Changing the span by group without noting it. Different spans can make one curve look more wiggly or more gradual for reasons unrelated to the underlying data pattern. Use a common span for a direct visual comparison, or clearly qualify comparisons if settings differ.
- Reading every bend as a real group feature. A smoother summarizes data, and sparse observations can produce unstable-looking turns. Check the points and density before describing a bend as a meaningful pattern.
- Turning a visual difference into a causal claim. Separate smoothers show patterns associated with group membership and predictor values. They do not establish that group membership caused the response difference.
Group-specific smoothers matter because an overall relationship can hide how the response varies across categories. Used carefully, overlays and facets make those different patterns visible. The strongest descriptive conclusions are limited to predictor regions with adequate data for each group, and they state what the curves show without claiming more than the display can establish.
Check Your Understanding
For each question, focus on the group-specific patterns and the range over which the data support comparison.
- When might an overlay be more readable than a faceted display, and when might facets be preferable?
- Two groups have observed predictor ranges 5–15 and 12–22. What is their shared range, and why should a comparison at predictor value 19 be treated cautiously?
- Why is it helpful to use the same smoother type and span for all groups in a direct comparison?
- Two smoothers cross within a region where both groups have many observations. What does the crossing say descriptively, and what does it not establish?
- A group-specific curve continues beyond the largest observed predictor value for that group. Why should its position there not be treated as a well-supported group comparison?