I have run a 3rd order polynomial regression in R and have run the "summary" function, but I need to be able to replicate the "predict" function in Excel. I have my current working code below. Thank you for your help!
#Have access to this output:
AICFit <- lm(R60 ~ poly(M20, 3) + poly(M40, 3), data = mydata)
summary(AICFit)
#do not have access to output:
predict(AICFit,data.frame(M20=0.972375241,M40=0.989086129,interval ="prediction")
Basically, I don't have access to R when I have access to these numbers: 0.972375241,0.989086129.
xform
is anlm
object: it contains the result of a multiple, multivariate regression of the orthogonal polynomial terms against the powers of the original variablex
. Thus,gamma <- coeff(xform)
is the matrix that transforms thosex
-powers (previously computed inx.p
) into the orthogonal variable values. You can see it employed for this purpose in the very next line, which includes the matrix multiplicationx.p %*% gamma
. $\endgroup$