2020-11-18
data(mtcars) hist(mtcars$mpg)
hist(mtcars$mpg, breaks=12, col="red")
d <- density(mtcars$mpg) # returns the density data plot(d) # plots the results
d <- density(mtcars$mpg,adjust = 1/3) # returns the density data plot(d) # plots the results
d <- density(mtcars$mpg,adjust = 2) # returns the density data plot(d) # plots the results
d <- density(mtcars$mpg, kernel = "rectangular") # returns the density data plot(d) # plots the results
d <- density(mtcars$mpg, kernel = "epanechnikov") # returns the density data plot(d) # plots the results