advanced aggregation PostgreSQL
Fit a Linear Regression With REGR_SLOPE and REGR_INTERCEPT
Compute the least-squares slope, intercept, and R² of a linear regression directly in SQL using `REGR_SLOPE(y, x)`, `REGR_INTERCEPT(y, x)`, and `REGR_R2(y, x)` in PostgreSQL.