I've fit a 4th order polynomial curve to my data like so:
y<-c(-13,16,35,40,28,36,43,33,40,33,22,-5,-27,-31,-29,-25,-26,-31,-26,-24,-25,-29,-23,4)
x<-1:24
#4th order polynomial fit
fit<-lm(y~poly(x,4,raw=TRUE))
plot(x,y,ylim=c(min(y)-10,max(y)+10))
lines(x,predict(fit,data.frame(x=x)),col="red")
abline(h=0,lty=2)
My final goal would be to calculate the 3 points of this curve where it meets the zero line.
So first, I need to extend the end of the curve fit so it passes beyond the zero line for a third time. Once I have done this, I would want to calculate the 3 points where this equation passes through the zero line.