Performing and Interpreting Linear Regression
In Exercise 5.01, Predicting Sales from Advertising Spend Using Linear Regression, we implemented and saw the output of a linear regression model without discussing the inner workings. Let us understand the technique of linear regression better now. Linear regression is a type of regression model that predicts the outcome using linear relationships between predictors and the outcome. Linear regression models can be thought of as a line running through the feature space that minimizes the distance between the line and the data points.
The model that a linear regression learns is the equation of this line. It is an equation that expresses the dependent variable as a linear function of the independent variables. This is best visualized when there is a single predictor (see Figure 5.28). In such a case, you can draw a line that best fits the data on a scatter plot between the two variables.
Figure 5.28: A visualization of a linear regression...