Why Dense Diagnostics Need Display Choices
An NLME diagnostic plot may place many observations on the same axes: for example, residuals against time or predictions. When points overlap, a plot can conceal how many observations occupy a location, whether a dense region contains one subject or many, and whether apparent patterns are shared across individuals. Overplotting is a display problem, not evidence that the underlying observations are identical or statistically independent.
The remedy should depend on the diagnostic question. A display of all observation-level residuals is useful for seeing local patterns, but it can give disproportionate visual weight to frequently sampled subjects. A subject-level summary makes subjects easier to compare, but it removes within-subject detail. Transparency, jitter, binning, faceting, and aggregation each address a different part of the problem; none is a universal correction.
Start by stating what one point represents and what pattern the plot is intended to reveal. Then choose a remedy that makes that pattern more legible without implying information the data do not contain. The earlier material on residual patterns, unequal sampling, and individual fit displays provides context for deciding whether the target is a pooled observation pattern, a between-subject comparison, or a within-subject pattern.
Transparency: Reveal Density Without Removing Points
Transparency, or alpha blending, draws each point with partial opacity. An isolated point remains visible, while many overlapping points accumulate into a darker region. This can preserve the locations of all observations while making dense areas visually distinct. Its usefulness depends on the point color, background, marker size, and chosen opacity; a transparent plot is not automatically a faithful density map.
For identical point colors composited over a uniform background, let \(\alpha\) be the opacity of one point, between 0 and 1. At a location where \(k\) points overlap, the combined opacity is:
This follows because after one point, a fraction \(1-\alpha\) of the background remains visible; after \(k\) identical overlays, the remaining fraction is \((1-\alpha)^k\). The displayed opacity is therefore one minus that remaining fraction. This relationship is nonlinear: a dark patch does not reveal the exact count once many points overlap.
Worked Example: Choosing Transparency for a Dense Cloud
Suppose a hypothetical residual-versus-prediction plot has ten observations at the same displayed location and uses point opacity \(\alpha=0.12\). One isolated point has opacity 0.12. For ten coincident points:
The location with ten points is therefore much darker than a location with one, while the exact count is not readable from the darkness alone. If opacity were increased to 0.50, two overlapping points would have combined opacity \(1-0.50^2=0.75\), so the cloud would saturate quickly. A low opacity is more useful for this hypothetical dense display, but the final choice should be checked against the full plot: if isolated points become nearly invisible, opacity is too low for the intended purpose.
Transparency preserves each point's coordinates and avoids inventing coordinate values. It is often a good first choice when the main question concerns the overall shape or location of a dense cloud. Its limitations are that overlapping subjects cannot be identified from darkness, colors may blend ambiguously, and a large opaque region may conceal local structure. Compare plots at consistent settings when judging changes across groups or candidate displays.
Jitter: Separate Coincident Marks Carefully
Jitter adds a small random displacement to plotted coordinates so that points that would otherwise coincide can be seen separately. It is useful when values are recorded on a grid or several observations share exactly the same x- or y-coordinate. Jitter is only a visual aid: it does not alter the recorded values or justify treating them as different measurements.
The magnitude and direction of jitter matter. Horizontal jitter can make repeated times easier to count, but it can suggest observations occurred at times that were never recorded. Vertical jitter can similarly imply residual differences that are not present. Use a displacement small relative to the scale and meaningful resolution of the axis, and state in a caption or legend that jitter is visual only. Do not jitter so widely that points cross a meaningful boundary, obscure a trend, or suggest a range of values unsupported by the measurements.
Worked Example: Jittering Repeated Sampling Times
In a hypothetical dataset, eight residuals were recorded at exactly 2.0 hours. On an unadjusted plot, all eight marks occupy the same horizontal coordinate. Suppose the time axis is in hours and a display-only horizontal jitter is chosen uniformly between \(-0.03\) and \(0.03\) hours. The displayed x-coordinate is the recorded time plus the jitter. Thus a point might appear at \(2.0+0.02=2.02\) hours, and another at \(2.0-0.01=1.99\) hours.
The displayed spread is at most 0.06 hours from leftmost to rightmost, even though the recorded time for every observation remains 2.0 hours. A clear caption should say that horizontal jitter of at most 0.03 hours was applied for visibility. Because the residual values are the diagnostic quantities of interest here, leaving the vertical coordinates unchanged avoids suggesting residual variation that was not observed. If differences of a few hundredths of an hour are substantively important, this jitter size would be inappropriate and a different display should be used.
Binning: Summarize Dense Regions, Not Individual Points
Binning partitions an axis or the two-dimensional plot area into intervals or cells, then summarizes the observations in each. A bin can show a count, a mean residual, or another clearly specified summary. Binning can reveal broad concentration or trends when individual points are too numerous to distinguish, but it replaces locations with summaries and depends on the chosen bin boundaries and widths.
Worked Example: What a Time Bin Hides
Consider four hypothetical residuals in the time interval from 0 to 2 hours: \(-0.8\), \(-0.2\), \(0.3\), and \(0.7\), in standardized residual units. A bin showing only the mean reports:
The zero mean says that positive and negative values balance in this bin. It does not say that the four residuals are all near zero: their range is \(0.7-(-0.8)=1.5\) standardized residual units. A count-and-mean display would preserve the bin count of four and its average, but still hide the individual values and their ordering in time. A useful display may therefore pair a binned summary with a transparent point layer, or show the within-bin spread as well as the mean. The bin width should be selected so that the summary resolves the pattern of interest rather than smoothing it away.
Binning is particularly sensitive to arbitrary boundaries: shifting the bin edges can move observations between summaries and change the apparent pattern. Check whether conclusions persist under reasonable alternative widths or alignments. Do not interpret a bin mean as an individual prediction or as proof that every observation in the bin behaves similarly.
Faceting and Subject-Level Aggregation
Faceting makes separate panels for defined subsets, such as study, dose group, or subject. It can reveal patterns hidden in a pooled display and help distinguish a group-specific pattern from a pattern shared across the dataset. Comparisons are clearest when panels use the same axis limits and units. Independent scales can be useful when ranges differ greatly, but can make equally sized visual patterns correspond to different numerical changes; if scales differ, label that fact clearly.
Worked Example: Faceting by Study
A hypothetical diagnostic dataset contains 120 residuals from Study A and 30 from Study B. A pooled plot is dense and dominated by Study A. In separate panels with common axes, suppose both studies show residuals centered near zero, but Study B has a wider vertical spread. The shared scales let the reader compare that spread directly while seeing the study-specific clouds separately. If each panel instead rescales its vertical axis to fill the same height, the two spreads may look similar even though their numerical ranges differ. The faceted display helps reveal study structure, but it does not equalize the studies' observation counts or establish why their spreads differ.
Subject-level aggregation answers a different question. For example, plotting one mean residual per subject gives each subject one displayed value, rather than allowing subjects with more observations to contribute more points. This can aid a between-subject comparison, but it removes the timing, within-subject spread, and potentially important patterns of individual observations. State how each subject summary is calculated and how subjects with missing or very sparse data are handled.
Worked Example: Observation-Weighted and Subject-Weighted Means
Suppose a hypothetical subject A has ten residuals with mean \(0.2\), and subject B has two residuals with mean \(-1.0\). The pooled observation-level mean weights each residual equally, so subjects with more observations contribute more:
A subject-level mean gives the two subjects equal weight:
These different values are both correct for their respective summaries. The pooled mean describes the mean across the 12 observations; the subject-level mean describes the mean of the two subject means. Neither alone describes the full diagnostic structure. In particular, the subject-level summary conceals the within-subject residual patterns, while the pooled summary can obscure how differently the two subjects behave.
Choosing and Checking a Remedy
The display choice should follow the diagnostic target, not merely the desire for a cleaner-looking figure. The options can be compared by what they make visible and what they set aside.
| Remedy | Useful for | Information obscured or at risk |
|---|---|---|
| Transparency | Showing dense regions while retaining point locations | Exact counts, subject identities, and points in saturated areas |
| Jitter | Separating repeated or quantized coordinates | Exact displayed coordinates; jitter can imply unsupported variation |
| Binning | Summarizing broad density or local average patterns | Individual values, within-bin shape, and sensitivity to bin boundaries |
| Faceting | Comparing defined subsets and exposing subset-specific patterns | Easy overall comparison if scales differ; small subsets may appear sparse |
| Subject-level aggregation | Comparing subjects with equal display weight | Observation counts, within-subject variation, and time ordering |
A practical diagnostic sequence is to retain an unmodified point display as a reference, then apply a remedy whose trade-off is explicit. If transparency is used, inspect whether the densest regions saturate. If jitter is used, verify its range against the axis units and disclose it. If binning is used, compare alternative reasonable bin definitions and inspect the original observations where a bin suggests a pattern. If faceting or aggregation is used, check whether the panels or summaries change the weighting of subjects or groups.
Decide whether the plot should reveal individual observations, density, subgroup differences, or subject-to-subject variation.
Prefer transparency when point coordinates matter, faceting when subsets matter, and aggregation only when the summary itself answers the question.
Compare with the unmodified data or another complementary view before treating a visual pattern as a diagnostic finding.
A common mistake is to interpret a jittered cloud as evidence of additional measurement variation, or to read a binned mean near zero as evidence that residuals are individually close to zero. Both conclusions mistake the display for the underlying data. Jitter changes plotted coordinates only; binning summarizes multiple values and can conceal their spread. The correction is to state the display transformation, inspect the original values or a complementary view, and make conclusions only at the level the display supports.
These remedies improve legibility; they do not repair model misspecification, remove dependence among observations, correct unequal sampling, or establish that residual assumptions hold. A visually clean plot can still be diagnostically misleading. Retain axis units, identify the plotted residual quantity, show sample sizes where relevant, and avoid comparing panels whose scales or weighting differ without making those differences explicit.
Check Your Understanding
Answer each question, then compare with the brief solutions below.
- With opacity \(\alpha=0.20\), what is the combined opacity of five coincident points of the same color?
- Why might horizontal jitter be misleading when repeated sampling times are scientifically meaningful?
- A bin contains residuals \(-1\), \(0\), and \(1\). What does its mean of zero establish, and what does it not establish?
- When would a subject-level mean be preferable to a pooled observation mean, and what information does it discard?
- Why should faceted panels usually share axis limits for direct visual comparison?
Solutions. (1) \(1-(1-0.20)^5=1-0.8^5=1-0.32768=0.67232\), or about 0.672. (2) Jitter can make an observation appear at a time that was not recorded, potentially obscuring the true repeated-time design; disclose it and keep it small. (3) The values balance to a mean of zero, but they are not all zero or necessarily close to zero. (4) It is useful when the target is an equally weighted comparison of subjects; it discards observation counts and within-subject detail. (5) Common limits ensure equal visual distances represent equal numerical changes; independent limits can make different ranges look alike.