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.
1 Answer
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.
hist
... $\endgroup$