SLOPE (YValues, XValues) SLOPE (YValues; XValues)

YValues

The vertical coordinates of the data points. This array must have the same size as the other array parameter.

XValues

The horizontal coordinates of the data points. This array must have the same size as the other array parameter.

Returns

Number Number

The slope of a straight line which has been fitted to data using linear regression.

Fits a straight line to data using least-squares linear regression and returns its slope. Use INTERCEPT to obtain the y-intercept of the same line.

Examples

SLOPE ({ 3, 5, 7, 9 }, { 1, 2, 3, 4 })
SLOPE ({ 3; 5; 7; 9 }; { 1; 2; 3; 4 })

Returns 2. The data points lie exactly on the line y = 2x + 1 , so the slope is exactly 2.

SLOPE ({ 10, 14, 18, 20, 25 }, { 2, 4, 6, 8, 10 })
SLOPE ({ 10; 14; 18; 20; 25 }; { 2; 4; 6; 8; 10 })

Returns 1.8. The best-fit line through these five points has a slope of 1.8.

fxEngine Shell Want this in your own terminal? A standalone version is coming. Get notified.
Loading fxEngine Shell