Skip to content
Prev 138822 / 398506 Next

Puzzling coefficients for linear fitting to polynom

On 07-Mar-08 08:16:06, Firas Swidan, PhD wrote:
Have a look at the values returned by poly(x,2).
The coefficients you are getting are the results of fitting

  y = a + b1*poly(x,2)[,1] + b2*poly(x,2)[,2]

where

  poly(x, 2)[,1]
# [1] -7.071068e-01 -9.073264e-17  7.071068e-01
  poly(x, 2)[,2]
# [1]  0.4082483 -0.8164966  0.4082483

which is probably not what you may have thought you were doing!

It is certainly not the same as fitting

  y = a + b1*x + b2*(x^2)

though of course the fitted values will be the same.

Best wishes,
Ted.

--------------------------------------------------------------------
E-Mail: (Ted Harding) <Ted.Harding at manchester.ac.uk>
Fax-to-email: +44 (0)870 094 0861
Date: 07-Mar-08                                       Time: 08:40:46
------------------------------ XFMail ------------------------------