How to do a linear regression in postgresql?

1

I want to do a simple linear regression directly in the database. I noticed that postgresql already has some statistical functions, which I think are for this purpose ( regr_slope(Y, X) , regr_intercept(Y, X) , regr_count(Y, X) ...) and would like to understand it better.

In a simple regression% with%,% with% would be equal to "b" and Y=aX+b equal to "a"?

    
asked by anonymous 20.09.2018 / 20:08

1 answer

0

Yes. The regr_intercept(Y, X) command returns the intercept, that is, the b value of the equation Y=aX+b , and the command regr_slope(Y, X) returns the angular coefficient, also called the slope of the challenge.     

17.12.2018 / 20:33