regr_slope(...)

regr_slope(...)

Returns the slope of the linear least squares fit

Works with the following datatypes:

This function works with 2.1 endpoint(s). What does this mean? »

The regr_slope(...) function returns the slope of a linear least squares fit of two sets of numeric values (Numbers). For example, to obtain the slope of the linear least squares fit between the typical number of hours assigned and their hourly rate for all employees in the City of Chicago:

https://data.cityofchicago.org/resource/tt4n-kn4t.json?$select=regr_slope(typical_hours,hourly_rate)

It can also be used in $group aggregations, like this one to get the regression slope by full or part time status:

https://data.cityofchicago.org/resource/tt4n-kn4t.json?$select=full_or_part_time,regr_slope(typical_hours,hourly_rate)&$group=full_or_part_time