# [R] Summary Orthogonal Polynomials

Bliese, Paul D MAJ WRAIR-Wash DC Paul.Bliese at NA.AMEDD.ARMY.MIL
Wed Oct 9 02:56:47 CEST 2002

```As usual, the R newsgroup set me straight (thanks to Douglas Bates, Robert
Balshaw and Albyn Jones).

There is really no difference between using orthogonal polynomials of the
form:

Linear     -3 -1  1  3
Quadratic   1 -1 -1  1
Cubic      -1  3 -3  1

Versus

> poly(c(1:4),3)
1    2          3
[1,] -0.6708204  0.5 -0.2236068
[2,] -0.2236068 -0.5  0.6708204
[3,]  0.2236068 -0.5 -0.6708204
[4,]  0.6708204  0.5  0.2236068

My observation that different coding schemes yielded different results was
based upon a colleague's analysis of some data (though the jumping to the
wrong conclusion was my own doing).  The newsgroup's responses motivated me
to run my own comparisons in R, and of course the coding scheme doesn't make
a bit of difference.

The reason why the contrasts look different is that R is rescaling the
variables to have unit length.  The unit length of the first row, for
instance is 20, so R divides -3, -1, 1, 3 by sqrt(20) and returns:

> c(-3,-1,1,3)/sqrt(20)
[1] -0.6708204 -0.2236068  0.2236068  0.6708204

Paul Bliese
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._

```

More information about the R-help mailing list