# What is the best way to get orthogonal polynomials for a regression like R's poly function

**URL:** <https://discourse.julialang.org/t/what-is-the-best-way-to-get-orthogonal-polynomials-for-a-regression-like-rs-poly-function/64972>\
**Category:** General Usage\
**Created:** [July 20, 2021, 8:57am UTC](https://discourse.julialang.org/t/what-is-the-best-way-to-get-orthogonal-polynomials-for-a-regression-like-rs-poly-function/64972 "2021-07-20T08:57:50Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![andrewjessop](https://avatars.discourse-cdn.com/v4/letter/a/8797f3/32.png) [@andrewjessop](https://discourse.julialang.org/u/andrewjessop)\
**Post date:** [July 20, 2021, 8:57am UTC](https://discourse.julialang.org/t/what-is-the-best-way-to-get-orthogonal-polynomials-for-a-regression-like-rs-poly-function/64972/1 "2021-07-20T08:57:51Z")

</div>

R has [a very easy-to-use function](https://www.rdocumentation.org/packages/stats/versions/3.6.2/topics/poly) where you provide a vector and it will return orthogonal polynomial vectors that can be used in linear models.

There are a few different polynomial packages available. Can this be done with Polynomials.jl?

---

<div class="post-metadata">

**Author:** ![stevengj](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stevengj/32/71_2.png) [@stevengj](https://discourse.julialang.org/u/stevengj)\
**Post date:** [July 20, 2021, 11:51am UTC](https://discourse.julialang.org/t/what-is-the-best-way-to-get-orthogonal-polynomials-for-a-regression-like-rs-poly-function/64972/2 "2021-07-20T11:51:59Z")

</div>

Orthogonal polynomials of various types are provided by [GitHub - jverzani/SpecialPolynomials.jl: Families of polynomials](https://github.com/jverzani/SpecialPolynomials.jl)
