I smoothed my data using smooth.spline(x,y)
and now I want to calculate the mode or maximum of smoothed curve.
x <- vect.1
y <- vect.2
plot(x, y, type = 'l')
smth <- smooth.spline(x, y)
lines(smth, col = 'red', lwd = 2)
My current approach is simply to look up the x
which gives me the maximum y
which is not so accurate. Is there a better way for doing this?