http://stats.stackexchange.com/questions/76959/finding-inflection-points-in-r-from-smoothed-data
x = seq(1,15)
y = c(4,5,6,5,5,6,7,8,7,7,6,6,7,8,9)
plot(x,y,type="l",ylim=c(3,10))
lo <- loess(y~x)
xl <- seq(min(x),max(x), (max(x) - min(x))/1000)
out = predict(lo,xl)
lines(xl, out, col='red', lwd=2)

infl <- c(FALSE, diff(diff(out)>0)!=0)
xl[infl ] #覲螻′
points(xl[infl ], out[infl ], col="blue")


x <- 1:10
y <- c(100, 200, 300, 350, 400, 500, 600, 800, 900, 600)

fit <- loess(y~x)
plot(x, y)
lines(x, predict(fit, data.frame(x)), col='red')

out <- predict(fit, data.frame(x))
infl <- c(FALSE, diff(diff(out)>0)!=0)
x[infl ] #覲螻′
points(x[infl ], out[infl ], col="red", pch=20)