Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- library(ggplot2)
- set.seed(1)
- x <- 1:100
- y <- x^2*sin(2*pi*x/100) + 500*rnorm(length(x))
- df <- data.frame(x, y)
- h <- 12
- smoother <- data.frame(ksmooth(x, y, "normal", bandwidth = h, n.points = 100))
- ggplot(df, aes(x,y)) + geom_point() + geom_line(data = smoother, aes(x,y))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement