statistics

regr_slope

Slope of the least-squares line predicting y from x; undefined for constant x. Argument order is dependent value first; incomplete pairs are ignored. Correlation or fit does not establish causation.

Formal Syntax & Structure

sql syntaxsql
regr_slope(y double precision, x double precision)

Working Example

Example Snippetsql
SELECT regr_slope(y,x) FROM (VALUES (1,3),(2,5),(3,7),(4,NULL)) AS t(x,y);
SQL Reference