I plotted density function in R and under the plot is number of bandwith. What does this number mean?
1 Answer
The bandwidth is a measure of how closely you want the density to match the distribution.
See help(density):
bw the smoothing bandwidth to be used. The kernels are scaled such that this is the standard deviation of the smoothing kernel. (Note this differs from the reference books cited below, and from S-PLUS.)
See also
adjust the bandwidth used is actually adjust*bw. This makes it easy to specify values like ‘half the default’ bandwidth.
At least for me, bandwidth doesn't match any particular intuition, but you can see the effect of changing it:
set.seed(201010)
x <- rnorm(1000, 10, 2)
par(mfrow = c(2,2))
plot(density(x)) #A bit bumpy
plot(density(x,adjust = 10)) #Very smmoth
plot(density(x,adjust = .1)) #crazy bumpy
-
3$\begingroup$ An intuitive explanation (in the bivariate case) is given on the GIS site at gis.stackexchange.com/questions/1553/… (where "half-width" is synonymous with "bandwidth"). It would be no trouble to adapt this explanation to the univariate case. $\endgroup$– whuber ♦Jun 10, 2013 at 18:28
?density
gives a direct answer: "the bandwidth bw is the standard deviation of the kernel". $\endgroup$