Lessons Learned
This chapter introduces linear regression (best-fit lines) from the perspective of SQL and Excel. Linear regression is an example of a statistical model and is similar to the models discussed in the previous chapter.
There are several ways to approach linear regressions using SQL and Excel. Excel has at least four ways to create such models for a given set of data. Excel charting has a very nice feature where a trend line can be added to a chart. One of the types of trend lines is the best-fit line, which can be included on a chart along with its equation and statistics describing the line. Other types of trend lines—polynomial fits, exponential curves, power curves, logarithmic curves, and moving averages—are also useful for capturing and visualizing patterns in data.
A second way to estimate coefficients for a linear regression is with the array function LINEST() and various other functions that return individual coefficients, such as SLOPE() and INTERCEPT...