slope

slope — aggregate function to the slope of a best-fit linear regression line of two fields.

SYNOPSIS

slope (double field-x, double field-y)

DESCRIPTION

For the data set of fields x and y for all rows in the aggregate's window, a best-fit linear regression line is calculated, and then the function returns the line's slope. The method used to find the line that best fits a group of points is called least squares or linear least squares.

The slope() function returns a unitless double value that does not represent an angle, and is therefore in neither degrees nor radians. The internal calculation takes the tan(theta), where theta is the angle of incline of the best linear fit to the data. This calculation returns the same value whether theta is internally expressed in degrees or radians.

If the query returns no rows to the aggregate's window, the function returns null. If the query returns a row count of 1 or −1, the result is also null.

SEE ALSO

This LiveView aggregate function is based on the slope

aggregate function in the StreamBase expression language.