Interpreting Kernel density Plot

Below I am showing the kernel density with the size of the informal economy, and would appreciate support on interpreting this. For instance, what does the of the Kdensity line around .017 represent relative to the normal density line?

What does a bandwidth of 7.31 tell us? • Contrary to your description the graph is clearly showing the distribution of residuals from some earlier model. Although the program does what it is designed to do, many practitioners regard a normal quantile plot as a better check on normality of residuals (which is often desirable but not essential). Apr 1 '21 at 21:15
• The density is subject to the rule that the area under the curve must total $1$, as it represents the total probability. This is easiest to think about by imagining replacing the density by a rectangle with the same area. The base of the rectangle is the range from (roughly) $-50$ to $50$, so about $100$, So the height of the rectangle must be about $0.01$, i.e. $\sim 100 \times \sim 0.01 \approx 1$. That seems about right for the average density. Apr 1 '21 at 21:28
• The units of measurement of the residuals are the same as those of your response or outcome variable. The units of density are the reciprocal of those units. The units therefore wash out of the calculation. Apr 1 '21 at 21:29

Given a random sample from a population, a kernel density estimator (KDE) seeks to estimate the density function of the population distribution. You can read Wikipedia's article on KDEs or various other Internet pages for details of how a KDE is formed. (I have found referenced papers by Silverman to be extraordinarily clear.)

Roughly speaking, one chooses the shape of a 'kernel' density (often normal, sometimes uniform or others) and then makes a mixture of several such distributions as the KDE. The smaller the bandwidth, the more the components of the mixture. Results are often smoother than you get by trying to estimate a density function using a histogram. You can think of a KDE as a 'smoothed histogram', but the KDE works entirely independently of the histogram.

If you have a large sample, you will generally get a KDE that comes closer to the density function of the population.

Suppose you have a sample of size $$n = 500$$ from $$\mathsf{Gamma}(\mathsf{shape}=5,\mathsf{rate}=0.1),$$ which has $$\mu=50,\sigma^2=500.$$

set.seed(2021)
x = rgamma(500, 5, 0.1)
summary(x);  sd(x)
Min. 1st Qu.  Median    Mean 3rd Qu.    Max.
4.33   32.18   44.91   49.11   62.64  163.26
 23.9333   # sample SD

Here is a histogram of the sample, a graph of the density function of $$\mathsf{Gamma}(5, .1)$$ [dotted black], individual observations [tick marks], and the default KDE from R [solid brown].

hdr = "n = 500: Sample from GAMMA(5,.1) with Density (dotted) and KDE"
hist(x, prob=T, col="skyblue2", br=20,  main=hdr);  rug(x)
curve(dgamma(x, 5, .1), add=T, lwd=2, lty="dotted")
lines(density(x), lwd=2, col="brown") With obvious changes in the R code, here is a similar plot with $$n = 10\,000$$ observations. Here we have used KDEs with bandwidths half (with parameter 'adj=.5' in 'density') and double the default size.

set.seed(401)
x = rgamma(10^4, 5, .1)
hdr = "n = 100,000: Sample from GAMMA(5,.1) with KDEs of two bandwidths"
hist(x, prob=T, col="skyblue2", br=20,  main=hdr)
curve(dgamma(x, 5, .1), add=T, lwd=2, lty="dotted") • Also, although details vary, in principle the kernel density estimate from $n$ observations is the sum of just as many miniature distributions each based on a sample value. So, what you call the number of components doesn't depend on the bandwidth at all. What does depend on the bandwidth is how much they are smeared out and therefore how lumpy or smooth the estimated density is. Some algorithms use very good approximations to that recipe. Apr 1 '21 at 21:07