Interactive element. Drag the light grey circles to adjust the linear function. Observe how the fit and the balance of the residuals changes. Reload the page to generate a new set of random samples.
Linear regression
Linear regression
This element shows what linear regression tries to achieve: it seeks the linear function (i.e., a straight line) that minimizes the average distance or residual (red and blue lines) between the prediction (dark grey line) and a collection of points (black scatter points).
Tick the checkbox to see how the optimal solution. Observe that this solution minimizes the distance, and balances the residuals above and below the prediction.