# Linear regression from scratch using QR decomposition

**URL:** https://discourse.julialang.org/t/linear-regression-from-scratch-using-qr-decomposition/71363
**Category:** General Usage
**Tags:** linearalgebra, regression, qr
**Created:** [November 12, 2021, 5:31am UTC](https://discourse.julialang.org/t/linear-regression-from-scratch-using-qr-decomposition/71363 "2021-11-12T05:31:26Z")
**Posts on this page:** 1
**Showing post:** 4

<div class="post-metadata">

### Author: ![nilshg](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/nilshg/32/2283_2.png) [@nilshg](https://discourse.julialang.org/u/nilshg)
#### Post date: [November 12, 2021, 6:27am UTC](https://discourse.julialang.org/t/linear-regression-from-scratch-using-qr-decomposition/71363/4 "2021-11-12T06:27:08Z")

</div>

I think this has been discussed as extensively as possible here:

> [@Efficient way of doing linear regression](https://discourse.julialang.org/t/efficient-way-of-doing-linear-regression/31232):
>
> Hello, I need an efficient way to performs linear regression because I have to fit several segments in a big for loops which takes time to achieve. In the past, their was a linreg function which has been depreciated. Currently I am using polyfit to do a polynomial fit of order 1, for each segment. Is there a more efficient way to do this ?

---

_[View the full topic](https://discourse.julialang.org/t/linear-regression-from-scratch-using-qr-decomposition/71363)._
