[R] how to compute maximum of fitted polynomial?

Joseph Clark joeclark77 at hotmail.com
Tue Jun 4 22:32:07 CEST 2013

My script fits a third-order polynomial to my data with something like this:

model <- lm( y ~ poly(x, 3) )

What I'd like to do is find the theoretical maximum of the polynomial (i.e. the x at which "model" predicts the highest y).  Specifically, I'd like to predict the maximum between 0 <= x <= 1.

What's the best way to accomplish that in R?

Bonus question: can R give me the derivative or 2nd derivative of the polynomial?  I'd like to be able to compute these at that maximum point.

Thanks in advance!

// joseph w. clark , phd , visiting research associate
\\ university of nebraska at omaha - college of IS&T 		 	   		  

More information about the R-help mailing list