# select bandwidth
md(runif(100),20,0.6)
# select bandwidth and plot
data <- rnorm(100)
bandwidth <- md(data,20,0.6)
x <- seq(min(data),max(data),length=100)
plot(x,sapply(x,fhat,bandwidth,data),type="l",ylab="density")
Run the code above in your browser using DataLab