Trend analysis with KQL
As we discussed in Chapter 6, Introducing Time Series Analysis, one of the components of time series data is a trend. A trend helps visualize and predict the long-term direction of data. The trend is either positive, also known as an upward trend, or negative, also known as a downward trend. KQL provides two functions, series_fit_line()
and series_fit_2lines()
, for calculating the trend. We will begin by looking at series_fit_line()
before looking at series_fit_2lines()
.
Applying linear regression with KQL
The series_fit_line()
function performs linear regression to calculate the best fit line, also known as the regression line, for our original time series. Once we have calculated our regression line, we can identify the positive and negative relationships between our x-axis, also known as the independent variable, and our y-axis, also known as the dependent variable. The series_fit_line()
function takes one argument, which is a time series, and returns...