# [R] Orthogonal polynomials used by R

Ashim Kapoor @@h|mk@poor @end|ng |rom gm@||@com
Wed Nov 27 16:17:51 CET 2019

```Dear Petr,

Many thanks for the quick response.

https://en.wikipedia.org/wiki/Discrete_orthogonal_polynomials

The orthogonal polynomial is summarized by the coefficients, which
can be used to evaluate it via the three-term recursion given in
Kennedy & Gentle (1980, pp. 343-4), and used in the ‘predict’ part
of the code.

Out of curiosity, what is the name of the discrete orthogonal polynomial
used by R ?
What discrete measure is it orthogonal with respect to ?

Many thanks,
Ashim

On Wed, Nov 27, 2019 at 6:11 PM PIKAL Petr <petr.pikal using precheza.cz> wrote:

> You could get answer quickly by searching net.
>
>
> https://stackoverflow.com/questions/39031172/how-poly-generates-orthogonal-p
> olynomials-how-to-understand-the-coefs-ret/39051154#39051154
> <https://stackoverflow.com/questions/39031172/how-poly-generates-orthogonal-polynomials-how-to-understand-the-coefs-ret/39051154#39051154>
>
> Cheers
> Petr
>
> > -----Original Message-----
> > From: R-help <r-help-bounces using r-project.org> On Behalf Of Ashim Kapoor
> > Sent: Wednesday, November 27, 2019 12:55 PM
> > To: R Help <r-help using r-project.org>
> > Subject: [R] Orthogonal polynomials used by R
> >
> > Dear All,
> >
> > I have created a time trend by doing x<-1:93 because I have a time series
> > with 93 data points. Next I did :-
> >
> > y = lm(series ~ poly(x,4))\$residuals
> >
> > to detrend series.
> >
> > I choose this 4 as the order of my polynomial using cross validation/
> > checking the absence of trend in the residuals so I think I have not
> overfit
> > this series.
> >
> > I wish to document the formula of poly(x,4). I am not able to find it in
> ?poly
> >
> > Can someone please tell me what the formula for the orthogonal
> > polynomial used by R is ?
> >
> > Thank you,
> > Ashim
> >
> >       [[alternative HTML version deleted]]
> >
> > ______________________________________________
> > R-help using r-project.org mailing list -- To UNSUBSCRIBE and more, see
> > https://stat.ethz.ch/mailman/listinfo/r-help