We can generate orthogonal polynomials in R with
pp <- poly(cars$speed, 2)
Is there a way to get the original values out of the result pp (inverse poly function)?
In other words, what should the function f look like that returns the following result:
f(poly(cars$speed, 2)) == cars$speed?
cars$speedmust be of the form a + b * pp[, 1] for some scalars a and b and knowing that thecoefsattribute of poly objects contains values which can be used for reconstruction we find the following reconstruction ofcars$speedasspeed.