Computes a linear relationship model between two variables using least-squares fitting. Given variables x and y, the relationship is
y = slope * x + intercept
The result is output in fields named _slope and _intercept — unless a different prefix than _ is specified. Also output are the adjusted R-squared value _r2 and the number of data points _n. No output is produced, however, if all x values are the same or if all y values are the same.
|string||false||Prefix for the names of all the output fields.|
|string||true||The name of the field containing the independent variable.|
|string||true||The name of the field containing the dependent variable.|
Find the correlation between the bytes sent in a server response and the time to send them.
Find the correlation between server load and total response size across time.
bucket(function=[ sum(bytes_sent, as=x), avg(server_load_pct, as=y) ]) | linReg(x=x, y=y)
Find the correlation between server load and each of several types of request types across time.
bucket(function=[ avg(server_load_pct, as=y), groupby(request_type, function=count(as=x)) ]) | groupby(request_type, function=linReg(x=x, y=y))