# How to replicate the predict function from R in Excel given I have access to “summary” output from R

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.

• Does the thread at stats.stackexchange.com/questions/31858 answer your question? If not, could you tell us explicitly what else you need? – whuber Jun 24 at 13:17
• @whuber could you demonstrate the "# Compute the orthogonal polynomials in terms of the powers via OLS." step from that thread with my variables? I am having trouble understanding the "xform" part with real variables (instead of the random, reproducible ones). Thank you. And just to confirm that I am understanding this correctly, that step will convert the orthogonal polynomials into the "normal" polynomial equation, right? – RegressionMan Jun 24 at 23:59
• xform is an lm object: it contains the result of a multiple, multivariate regression of the orthogonal polynomial terms against the powers of the original variable x. Thus, gamma <- coeff(xform) is the matrix that transforms those x-powers (previously computed in x.p) into the orthogonal variable values. You can see it employed for this purpose in the very next line, which includes the matrix multiplication x.p %*% gamma. – whuber Jun 25 at 14:18