Related Function:

Rendered by QuickLaTeX.com

The SLOPE function returns the slope of the linear regression line through a supplied set of x- and y-values.

Syntax

=SLOPE(known_y’s,known_x’s)

Arguments

Argument Description
known_y’s An array known y-values
known_x’x An array of known x-values

Note: The length of the known_x’s array should be the same length as known_y’s, and the variance of the known_x’s must not be zero.

Examples

  A B C D
1 Known x Known y    
2 12 15    
3 17 18    
4 14 27    
5 13 16    
6 5 28    
7        
8 Formula Result Notes
9 =SLOPE(B2:B6,A2:A6) -0.72081 Slope of the linear regression line through the data points in A2:A6 and B2:B6

Note: The underlying algorithm used in the SLOPE and INTERCEPT functions is different than the underlying algorithm used in the LINEST function. The difference between these algorithms can lead to different results when data is undetermined and collinear. For example, if the data points of the known_y’s argument are 0 and the data points of the known_x’s argument are 1:

  • SLOPE and INTERCEPT return a #DIV/0! error. The SLOPE and INTERCEPT algorithm is designed to look for one and only one answer, and in this case there can be more than one answer.
  • LINEST returns a value of 0. The LINEST algorithm is designed to return reasonable results for collinear data, and in this case at least one answer can be found.

Common Function Error(s)

Problem What went wrong
#N/A Occurs if the supplied known_x’s and known_y’s arrays are of different lengths
#DIV/0! Occurs if either:

  the variance of the supplied known_x’s evaluates to zero
  the supplied known_x’s array or the supplied known_y’s array is empty

Notes The equation for the slope of the regression line is:

    \[    b = \frac { \sum (x-\bar{x})(y-\bar{y} }{ \sum (x-\bar{x})^2 }    \]

where \bar{x} and \bar{y} are the sample means (averages) of known_x’s and known_y’s.

See Wikipedia for more information on linear regression.