Skip to content

Find the prediction or the fitted values for an lm model

3 messages · John, Achim Zeileis, Rolf Turner

#
On Thu, 28 Nov 2013, jpm miao wrote:

            
You need to call the variable x1 because that is the name you used in the 
original data:

plot(x, predict(prodfn,data.frame(x1=x)), type = "l")
points(x1, y1)
#
See in-line below.
On 11/28/13 20:50, jpm miao wrote:
Because poly() produces orthonormalized polynomials,  Look at poly(x1,4).
It is not much like cbind(x1,x1^2,x1^3,x1^4), is it?

     cheers,

     Rolf Turner