Why Compare Smoothed Densities?
An overlay of observed and imputed continuous values can reveal broad differences in where values lie. A density plot adds a smooth summary of their distributions: it can make a shift, change in spread, or gap easier to see than a collection of individual values. But a smooth curve is not the data themselves. Its appearance depends on a smoothing choice, and a marginal difference between the groups is not automatically evidence that the imputation model is wrong.
The comparison is most useful as a diagnostic question: does the distribution of imputed values look plausible relative to the observed values, at a level of smoothing that does not conceal meaningful features or invent them? The answer should be considered alongside the predictors used in imputation and the composition of the observed and missing cases.
Definition and Interpretation
For an incomplete continuous variable, let \(y_i\) denote the recorded value for case \(i\) when it is observed, and let \(y_i^{(m)}\) denote its imputed value in completed data set \(m\), for \(m=1,\ldots,M\). Estimate the observed density using the observed values and the imputed density using values filled in for the missing cases. The estimate has units reciprocal to the variable’s units; for example, a density for weight measured in kilograms has units per kilogram. A density’s height is not a probability at a point. The area under the curve over an interval approximates the probability of falling in that interval.
When combining the imputed values across completed data sets for a descriptive plot, give each imputed value equal weight. With the same kernel and bandwidth, this is equivalent to averaging the \(M\) density estimates, each based on the missing cases in one completed data set. Do not treat the repeated imputations of the same case as new, unrelated people. The plot is a diagnostic display, not a substitute for pooling estimates and uncertainty from the substantive analysis.
Choosing and Checking the Bandwidth
Bandwidth is central to the interpretation. A very small \(h\) gives a jagged curve that follows individual observations and may exaggerate random bumps. A very large \(h\) can flatten peaks, fill gaps, and hide distributional differences. For a direct observed-imputed comparison, use the same bandwidth and kernel for both curves as the primary display. If different bandwidths are chosen separately, a difference in smoothness may be mistaken for a difference in the data.
A standard justification for smoothing is the bias-variance tradeoff. For a symmetric kernel with second moment \(\mu_2(K)=\int u^2K(u)\,du\), and a sufficiently smooth density \(f\), the leading bias at an interior point is approximately proportional to \(h^2 f''(x)\). The variance is approximately proportional to \(f(x)/(nh)\). Thus, under these regularity conditions, squared bias is of order \(h^4\), while variance is of order \(1/(nh)\). Increasing \(h\) reduces variability but increases smoothing bias. This explains why a single automatic bandwidth cannot guarantee a useful diagnostic view for every distribution.
A practical check is to inspect the comparison at a primary bandwidth and at one moderately smaller and one moderately larger bandwidth. A feature that appears only at an extreme setting deserves caution. The purpose is not to search until curves look alike; it is to determine whether the substantive impression is robust to reasonable smoothing choices. Use a shared horizontal scale and label the variable’s units. If the curves use different vertical scales, visual comparisons of density height become unreliable.
Worked Example: Calculating Two Densities at the Same Value
Suppose a hypothetical variable is measured in units. The observed values are \(8,9,10\), and the imputed values are \(7,10,11\). Use a Gaussian kernel, bandwidth \(h=2\) units, and compare the estimates at \(x=10\) units.
For the observed values, the standardized distances \((x-z_i)/h\) are \(1,0.5,0\). Using \(\phi(1)=0.2420\), \(\phi(0.5)=0.3521\), and \(\phi(0)=0.3989\), $$ \hat f_{O,2}(10)=\frac{0.2420+0.3521+0.3989}{3(2)} =\frac{0.9930}{6}=0.1655 $$
For the imputed values, the standardized distances are \(1.5,0,-0.5\). Since the standard normal density is symmetric, \(\phi(-0.5)=\phi(0.5)\). Therefore, $$ \hat f_{I,2}(10)=\frac{0.1295+0.3989+0.3521}{3(2)} =\frac{0.8805}{6}=0.1468 $$
The estimated densities at 10 units are 0.1655 and 0.1468 per unit, respectively. This is a pointwise comparison, not a test of whether the full distributions differ. The use of the same \(h\) makes the local smoothing directly comparable.
What the Bandwidth Can Hide or Create
Worked Example: A Bandwidth Can Fill an Apparent Gap
Consider the hypothetical values \(0,0,0,4,4,4\), measured in units. Their separation produces an empty interval between the two clusters. Use the Gaussian kernel and calculate the KDE at \(x=0\) and \(x=2\), first with \(h=1\) and then with \(h=2\).
At \(x=0\), with \(h=1\), three standardized distances are 0 and three are \(-4\). Since \(\phi(0)=0.3989\) and \(\phi(-4)=0.0001338\), $$ \hat f_{1}(0)=\frac{3(0.3989)+3(0.0001338)}{6(1)} =0.1995 $$
At \(x=2\), the standardized distances are three values of \(2\) and three of \(-2\). Since \(\phi(2)=\phi(-2)=0.0540\), $$ \hat f_{1}(2)=\frac{6(0.0540)}{6(1)}=0.0540 $$
With \(h=2\), the standardized distances at zero are three 0s and three \(-2\)s: $$ \hat f_{2}(0)=\frac{3(0.3989)+3(0.0540)}{6(2)} =0.1132 $$ At \(x=2\), the distances are three \(1\)s and three \(-1\)s: $$ \hat f_{2}(2)=\frac{6(0.2420)}{6(2)}=0.1210 $$
The larger bandwidth lowers the estimated peak at zero and raises the estimated density in the gap at two. It makes the distribution look less separated. This does not mean either curve is intrinsically correct: the example shows why an apparent gap or peak should be checked across plausible bandwidths before it is interpreted.
Marginal Differences and Case Composition
Observed and missing cases may have different predictor distributions. If missingness is related to predictors, the observed values can have a different marginal distribution from the values imputed for missing cases even when the imputation model produces similar distributions within predictor groups. Under missing completely at random, the observed cases are expected to represent the full sample marginally, apart from sampling variation. Under missing at random, that marginal similarity need not hold; comparisons conditional on relevant predictors can be more informative.
A density plot is therefore a model check, not a demand that the two marginal curves coincide. The observed data do not reveal the true missing values, so resemblance cannot establish that imputations are correct, and a difference alone cannot establish that they are incorrect. Check whether the model’s conditioning variables and the different group composition could explain the pattern before treating it as a failure.
Worked Example: Identical Within-Group Distributions, Different Marginal Curves
Suppose a hypothetical predictor defines groups A and B, and a continuous outcome is measured in units. The observed values are A: \(0,0,1,1\) and B: \(10,11\). The imputed values are A: \(0,1\) and B: \(10,10,11,11\). Within each group, the observed and imputed values have the same distribution, but group A makes up \(4/6\) of observed values and \(2/6\) of imputed values. Use a Gaussian kernel with \(h=1\) and evaluate at \(x=0\).
The within-group A estimate at zero is the same in both sets: $$ \hat f_A(0)=\frac{\phi(0)+\phi(-1)}{2(1)} =\frac{0.3989+0.2420}{2}=0.3205 $$ Group B contributes virtually zero at \(x=0\), because its standardized distances are at least \(-10\). The observed marginal estimate, using the six observed values, is $$ \hat f_O(0)=\frac{2\phi(0)+2\phi(-1)+\phi(-10)+\phi(-11)}{6} \approx\frac{1.2818}{6}=0.2136 $$ The imputed marginal estimate is $$ \hat f_I(0)=\frac{\phi(0)+\phi(-1)+2\phi(-10)+2\phi(-11)}{6} \approx\frac{0.6409}{6}=0.1068 $$
The marginal density near zero is about twice as high for observed values because group A is twice as common in the observed set. Yet the within-group A density is identical, as is the distribution within B. Here, the marginal difference reflects group composition, not a within-group mismatch. In practice, assess such comparisons using predictors relevant to the imputation model.
Diagnostics, Alternatives, and Limitations
Before interpreting a difference, check that the two curves represent the intended groups, use the same measurement scale, kernel, bandwidth, and horizontal range, and have clearly stated denominators. Inspect whether conclusions change under reasonable bandwidth adjustments. Look for edge distortion when values are bounded: a symmetric kernel can place density outside the variable’s possible range, and estimates close to a boundary may be biased. A transformation, boundary-aware estimator, or another display may be more suitable, but any transformation must be applied consistently and interpreted on its transformed scale.
KDEs are useful for a smooth visual comparison, but alternatives answer different descriptive questions. An overlay of points or a histogram shows individual values or bin counts more directly, although a histogram depends on bin choices. A density curve can make a broad distributional shift easier to see but may obscure ties, rounding, or a small number of extreme observations. If a conclusion depends on a very small bump, gap, or tail feature, inspect the underlying values and use other summaries rather than relying on the curve alone. A visual comparison also does not quantify uncertainty or provide a formal test.
In MICE, density plots can be made separately by imputation or by chain when checking whether the displayed distributions are stable across those sources. Pooling all imputed values into one curve can hide between-imputation variation. Conversely, treating all repeated imputed values as an independent sample can make the display appear more informative than it is. Keep the purpose descriptive: a density plot diagnoses patterns worth investigating, but it does not validate the imputation model or replace analysis of the completed data sets.
Common Mistakes
- Using different bandwidths and comparing curve shapes. Different smoothing can create an apparent difference. Start with a shared bandwidth, then show a sensitivity check.
- Assuming the curves must match marginally. Different predictor composition can create marginal differences even when within-group distributions agree. Check relevant strata before concluding that the imputation model is misbehaving.
- Reading density height as probability. Height is density per unit, not the probability of one exact value. Probabilities correspond to areas over intervals.
- Treating a smooth curve as proof. Similar curves do not prove correct imputations; different curves do not by themselves prove an incorrect model. The missing values are unobserved, and the plot is a diagnostic, not a validation test.
Check Your Understanding
Answer each question, then compare your reasoning with the solutions below.
- If the bandwidth is doubled, what happens to the smoothness of a Gaussian KDE, and what tradeoff accompanies that change?
- For values \(0\) and \(2\), calculate the Gaussian KDE at \(x=0\) with \(n=2\) and \(h=1\). Use \(\phi(0)=0.3989\) and \(\phi(-2)=0.0540\).
- Why can a marginal observed-imputed density difference occur even if the conditional distributions agree within predictor groups?
- What is wrong with claiming that the probability of an exact value is the height of its density curve?
Solutions. (1) Doubling \(h\) makes the curve smoother and generally less variable, but increases smoothing bias and can flatten peaks or fill gaps. (2) The standardized distances are 0 and \(-2\), so \(\hat f_1(0)=[0.3989+0.0540]/[2(1)]=0.2265\) per unit. (3) The groups can have different proportions among observed and missing cases; mixing the same group-specific distributions with different weights yields different marginal distributions. (4) Density is probability per unit, not probability at a point. For a continuous variable, the probability of one exact value is zero; probabilities are represented by areas over intervals.