x<-seq(-5, 5,length=100) #design points where the estimate will be calculated
plot(x, dnorm(x), type="l", xlab = "x", ylab="density") #plot true density function
SampleSize <- 100
ti<- rnorm(SampleSize) #draw a random sample from the actual distribution
huse<-bw.nrd(ti)
arg2<-kde(ti, x, huse, Epanechnikov) #Calculate the estimate
lines(x, arg2, lty=2) #draw the result on the graphics device.
Run the code above in your browser using DataLab