# Why density plot tails are beyond maximum and minimum values?

I am trying to interpret the tails of a density curve, which go beyond xlims(0 in this case). I understand that area under the curve between any two points represents the probability of that event. Can you help me understand why the tails of a density curve can not touch minimum and maximum values either side? Especially R density plots.

Refer the image below. • Kernel Density Estimation has no idea about minimums and maximums - en.wikipedia.org/wiki/Kernel_density_estimation . Imagine: you have 10 points from Normal Distribution and you want to estimate it. The chances that these 10 points contain minimum or maximum of Normal distribution are, literally, 0. KDE tries to overcome it. Nov 19, 2019 at 13:10
• At gis.stackexchange.com/a/14376/664, I have likened a density estimate to a process in which the histogram bars are thought of as piles of sand that are allowed to slump. One beauty of this intuition is that it is immediately obvious that all such density estimates must extend beyond the extremes of the data. Furthermore, how they extend and by how far is a property of the shape of the "slumping"--that is, of the kernel itself. Some techniques for constraining this extrapolation are described at stats.stackexchange.com/questions/65866.
– whuber
Nov 19, 2019 at 15:22
• If enforcing bounds is important, you may wish to read the documentation to learn how to enforce bounds when calling hist...
– Sycorax
Nov 20, 2019 at 16:23

density method in R uses gaussian as its kernel by default. The algorithm is kernel density estimate, i.e. KDE, as also noted in the comments. It works as if we place a Gaussian density over each data point and sum all to obtain a smooth density curve. The density can extend over data boundaries because the kernel used is positive over the entire real axis. If you change the kernel to rectangular or triangular the density estimate will reach zero at some distant points but again it won't respect the data minimum and maximum. KDE is a powerful non-parametric density estimation method which means you don't assume a form, so it can't have a range. The aim is to approximate the underlying distribution; so, outside the data range the estimate will have comparably small density values which means lack of data around these points might suggest that the probability of having the next samples around here is low, but not impossible.