Linear Regression
Linear regression models a scalar response as an affine function of one or more inputs . Given a dataset with , the simple linear regression model is
where is the intercept, is the slope, and is a noise term with . The parameters are estimated by ordinary least squares (OLS), minimizing the residual sum of squares
Setting the partial derivatives to zero yields the closed-form estimators
The fitted values are , and the residuals are . The fitted line always passes through the centroid . The coefficient of determination measures the fraction of the variance of that the line explains.The general case with predictors is the multiple linear regression model, covered in its own note. It writes each observation as , where the vector holds a leading and the predictor values. Stacking the as the rows of a matrix gives the OLS solution .
Under the additional assumption that the noise is i.i.d. Gaussian, , the OLS coefficients coincide with the maximum-likelihood estimates. The framework then gains exact distributional theory for inference: confidence intervals, -tests on individual coefficients, and -tests on groups. Even without Gaussianity, OLS is the best linear unbiased estimator when the noise is uncorrelated with constant variance. This result is the Gauss-Markov theorem.
Intuition
Linear regression is the simplest model that explains how one quantity changes with another. The slope is the expected change in for a unit change in . The intercept is the expected when . Fitting reduces to minimizing the squared vertical distance between the observed points and the line. This is what least squares means. The closed-form solution exists because the squared-error objective is a quadratic in . When the are not all equal, it has a unique minimum, which the partial-derivative equations recover exactly.
The estimator has an interpretable structure. The numerator measures how strongly moves with in the data; the denominator rescales by how much varies. So the slope is a normalized covariance, with units of per unit of . If and are uncorrelated, and the best linear prediction is the constant . Knowing then does not help.
The MLE perspective adds a probability model on top. If the noise really is Gaussian, the likelihood of the data factors into Gaussian densities. Maximizing the log-likelihood is then mathematically identical to minimizing the sum of squared errors. So OLS and MLE agree on the regression coefficients. The Gaussian assumption adds only a closed-form variance estimator and the distributional theory for inference. Without Gaussianity the coefficient estimates remain valid by Gauss-Markov. The standard errors and -values then become approximate, relying on the central limit theorem, rather than exact.
The animation turns a line about the mean point . The right panel tracks the SSE of each slope. The SSE is lowest at the OLS slope .
\usepackage{tikz}
\usetikzlibrary{animations, arrows.meta}
\begin{document}
\definecolor{hot}{HTML}{D9483B}
\definecolor{cold}{HTML}{2F80ED}
\definecolor{grn}{HTML}{2F9E44}
\newcommand{\rs}[3]{\draw[#1, very thick] #2 -- #3;}
\begin{tikzpicture}[font=\small, >={Stealth[length=2.2mm]}]
\draw[->] (0,0) -- (6.78,0) node[right] {$x$};
\draw[->] (0,0) -- (0,5.82) node[above] {$y$};
\draw (1.44,0.08) -- (1.44,-0.08) node[below] {\footnotesize $2$};
\draw (2.88,0.08) -- (2.88,-0.08) node[below] {\footnotesize $4$};
\draw (4.32,0.08) -- (4.32,-0.08) node[below] {\footnotesize $6$};
\draw (5.76,0.08) -- (5.76,-0.08) node[below] {\footnotesize $8$};
\draw (0.08,0.48) -- (-0.08,0.48) node[left] {\footnotesize $0$};
\draw (0.08,1.68) -- (-0.08,1.68) node[left] {\footnotesize $2$};
\draw (0.08,2.88) -- (-0.08,2.88) node[left] {\footnotesize $4$};
\draw (0.08,4.08) -- (-0.08,4.08) node[left] {\footnotesize $6$};
\draw (0.08,5.28) -- (-0.08,5.28) node[left] {\footnotesize $8$};
\draw[->] (8.6,0) -- (14.59,0) node[right] {$\beta_1$};
\draw[->] (8.6,0) -- (8.6,4.96) node[above] {SSE};
\draw (9.41,0.08) -- (9.41,-0.08);
\draw (11.04,0.08) -- (11.04,-0.08);
\draw (12.66,0.08) -- (12.66,-0.08);
\draw (14.29,0.08) -- (14.29,-0.08);
\node[below] at (9.41,-0.08) {\footnotesize $0$};
\node[below] at (12.66,-0.08) {\footnotesize $1$};
\draw (8.52,0.95) -- (8.68,0.95) node[pos=0, left] {\footnotesize $5$};
\draw (8.52,1.90) -- (8.68,1.90) node[pos=0, left] {\footnotesize $10$};
\draw (8.52,2.85) -- (8.68,2.85) node[pos=0, left] {\footnotesize $15$};
\draw (8.52,3.80) -- (8.68,3.80) node[pos=0, left] {\footnotesize $20$};
\draw (8.52,4.75) -- (8.68,4.75) node[pos=0, left] {\footnotesize $25$};
\draw[dashed] (8.99,4.56) -- (9.12,4.13) -- (9.25,3.73) -- (9.38,3.36) -- (9.50,3.01) -- (9.63,2.69) -- (9.76,2.39) -- (9.89,2.11) -- (10.02,1.87) -- (10.15,1.64) -- (10.28,1.45) -- (10.41,1.27) -- (10.54,1.13) -- (10.67,1.00) -- (10.80,0.91) -- (10.93,0.84) -- (11.06,0.79) -- (11.19,0.77) -- (11.31,0.77) -- (11.44,0.80) -- (11.57,0.86) -- (11.70,0.94) -- (11.83,1.04) -- (11.96,1.18) -- (12.09,1.33) -- (12.22,1.51) -- (12.35,1.72) -- (12.48,1.95) -- (12.61,2.21) -- (12.74,2.49) -- (12.87,2.80) -- (12.99,3.13) -- (13.12,3.49) -- (13.25,3.87) -- (13.38,4.28) -- (13.51,4.71);
\node[anchor=west] at (0.25,5.37) {\footnotesize $\times$: the mean point $(\bar x, \bar y) = (4.5, 3.64)$};
\begin{scope}[animate = {myself: = {:visible = {0s = "true", 2.4s = "false", 11.1s = "false", repeats}}}]
\rs{hot}{(0.72,1.14)}{(0.72,0.25)}
\rs{hot}{(1.44,1.74)}{(1.44,0.94)}
\rs{hot}{(2.16,2.94)}{(2.16,1.63)}
\rs{hot}{(2.88,2.82)}{(2.88,2.32)}
\rs{cold}{(3.60,2.10)}{(3.60,3.01)}
\rs{cold}{(4.32,3.24)}{(4.32,3.70)}
\rs{cold}{(5.04,3.30)}{(5.04,4.39)}
\rs{cold}{(5.76,4.02)}{(5.76,5.08)}
\draw[grn, very thick] (0.46,0.00) -- (6.22,5.52);
\draw[very thick] (13.15,3.56);
\filldraw[draw=black, fill=grn] (13.15,3.56) circle (3pt);
\node at (11.70,5.75) {$\beta_1 = 1.15$, \ $\mathrm{SSE} = 18.75$};
\node[anchor=west] at (-0.6,-1.2) {Every line passes through $(\bar x, \bar y)$. Only the slope $\beta_1$ changes.};
\end{scope}
\begin{scope}[animate = {myself: = {:visible = {0s = "false", 2.4s = "true", 2.6s = "false", 11.1s = "false", repeats}}}]
\rs{hot}{(0.72,1.14)}{(0.72,0.39)}
\rs{hot}{(1.44,1.74)}{(1.44,1.04)}
\rs{hot}{(2.16,2.94)}{(2.16,1.69)}
\rs{hot}{(2.88,2.82)}{(2.88,2.34)}
\rs{cold}{(3.60,2.10)}{(3.60,2.99)}
\rs{cold}{(4.32,3.24)}{(4.32,3.64)}
\rs{cold}{(5.04,3.30)}{(5.04,4.29)}
\rs{cold}{(5.76,4.02)}{(5.76,4.94)}
\draw[grn, very thick] (0.29,0.00) -- (6.40,5.52);
\draw[very thick] (12.93,2.97) -- (13.02,3.21) -- (13.15,3.56);
\filldraw[draw=black, fill=grn] (12.93,2.97) circle (3pt);
\node at (11.70,5.75) {$\beta_1 = 1.08$, \ $\mathrm{SSE} = 15.63$};
\node[anchor=west] at (-0.6,-1.2) {Red sticks: points above the line. Blue sticks: points below. SSE adds up their squares.};
\end{scope}
\begin{scope}[animate = {myself: = {:visible = {0s = "false", 2.6s = "true", 2.8s = "false", 11.1s = "false", repeats}}}]
\rs{hot}{(0.72,1.14)}{(0.72,0.75)}
\rs{hot}{(1.44,1.74)}{(1.44,1.29)}
\rs{hot}{(2.16,2.94)}{(2.16,1.84)}
\rs{hot}{(2.88,2.82)}{(2.88,2.39)}
\rs{cold}{(3.60,2.10)}{(3.60,2.94)}
\rs{cold}{(4.32,3.24)}{(4.32,3.48)}
\rs{cold}{(5.04,3.30)}{(5.04,4.03)}
\rs{cold}{(5.76,4.02)}{(5.76,4.58)}
\draw[grn, very thick] (0.00,0.20) -- (6.48,5.13);
\draw[very thick] (12.38,1.77) -- (12.39,1.79) -- (12.55,2.09) -- (12.71,2.42) -- (12.87,2.80) -- (13.02,3.21) -- (13.15,3.56);
\filldraw[draw=black, fill=grn] (12.38,1.77) circle (3pt);
\node at (11.70,5.75) {$\beta_1 = 0.91$, \ $\mathrm{SSE} = 9.30$};
\node[anchor=west] at (-0.6,-1.2) {Red sticks: points above the line. Blue sticks: points below. SSE adds up their squares.};
\end{scope}
\begin{scope}[animate = {myself: = {:visible = {0s = "false", 2.8s = "true", 3s = "false", 11.1s = "false", repeats}}}]
\rs{cold}{(0.72,1.14)}{(0.72,1.24)}
\rs{hot}{(1.44,1.74)}{(1.44,1.65)}
\rs{hot}{(2.16,2.94)}{(2.16,2.05)}
\rs{hot}{(2.88,2.82)}{(2.88,2.46)}
\rs{cold}{(3.60,2.10)}{(3.60,2.87)}
\rs{cold}{(4.32,3.24)}{(4.32,3.27)}
\rs{cold}{(5.04,3.30)}{(5.04,3.68)}
\rs{cold}{(5.76,4.02)}{(5.76,4.09)}
\draw[grn, very thick] (0.00,0.83) -- (6.48,4.49);
\draw[very thick] (11.62,0.88) -- (11.76,0.98) -- (11.92,1.13) -- (12.08,1.31) -- (12.23,1.53) -- (12.39,1.79) -- (12.55,2.09) -- (12.71,2.42) -- (12.87,2.80) -- (13.02,3.21) -- (13.15,3.56);
\filldraw[draw=black, fill=grn] (11.62,0.88) circle (3pt);
\node at (11.70,5.75) {$\beta_1 = 0.68$, \ $\mathrm{SSE} = 4.64$};
\node[anchor=west] at (-0.6,-1.2) {Red sticks: points above the line. Blue sticks: points below. SSE adds up their squares.};
\end{scope}
\begin{scope}[animate = {myself: = {:visible = {0s = "false", 3s = "true", 3.2s = "false", 11.1s = "false", repeats}}}]
\rs{cold}{(0.72,1.14)}{(0.72,1.78)}
\rs{cold}{(1.44,1.74)}{(1.44,2.03)}
\rs{hot}{(2.16,2.94)}{(2.16,2.28)}
\rs{hot}{(2.88,2.82)}{(2.88,2.54)}
\rs{cold}{(3.60,2.10)}{(3.60,2.79)}
\rs{hot}{(4.32,3.24)}{(4.32,3.04)}
\rs{hot}{(5.76,4.02)}{(5.76,3.55)}
\draw[grn, very thick] (0.00,1.52) -- (6.48,3.80);
\draw[very thick] (10.78,0.92) -- (10.81,0.90) -- (10.97,0.82) -- (11.13,0.78) -- (11.29,0.77) -- (11.44,0.80) -- (11.60,0.87) -- (11.76,0.98) -- (11.92,1.13) -- (12.08,1.31) -- (12.23,1.53) -- (12.39,1.79) -- (12.55,2.09) -- (12.71,2.42) -- (12.87,2.80) -- (13.02,3.21) -- (13.15,3.56);
\filldraw[draw=black, fill=grn] (10.78,0.92) circle (3pt);
\node at (11.70,5.75) {$\beta_1 = 0.42$, \ $\mathrm{SSE} = 4.82$};
\node[anchor=west] at (-0.6,-1.2) {Red sticks: points above the line. Blue sticks: points below. SSE adds up their squares.};
\end{scope}
\begin{scope}[animate = {myself: = {:visible = {0s = "false", 3.2s = "true", 3.4s = "false", 11.1s = "false", repeats}}}]
\rs{cold}{(0.72,1.14)}{(0.72,2.27)}
\rs{cold}{(1.44,1.74)}{(1.44,2.38)}
\rs{hot}{(2.16,2.94)}{(2.16,2.49)}
\rs{hot}{(2.88,2.82)}{(2.88,2.61)}
\rs{cold}{(3.60,2.10)}{(3.60,2.72)}
\rs{hot}{(4.32,3.24)}{(4.32,2.83)}
\rs{hot}{(5.04,3.30)}{(5.04,2.94)}
\rs{hot}{(5.76,4.02)}{(5.76,3.06)}
\draw[grn, very thick] (0.00,2.16) -- (6.48,3.17);
\draw[very thick] (10.02,1.86) -- (10.18,1.60) -- (10.34,1.37) -- (10.50,1.17) -- (10.65,1.02) -- (10.81,0.90) -- (10.97,0.82) -- (11.13,0.78) -- (11.29,0.77) -- (11.44,0.80) -- (11.60,0.87) -- (11.76,0.98) -- (11.92,1.13) -- (12.08,1.31) -- (12.23,1.53) -- (12.39,1.79) -- (12.55,2.09) -- (12.71,2.42) -- (12.87,2.80) -- (13.02,3.21) -- (13.15,3.56);
\filldraw[draw=black, fill=grn] (10.02,1.86) circle (3pt);
\node at (11.70,5.75) {$\beta_1 = 0.19$, \ $\mathrm{SSE} = 9.81$};
\node[anchor=west] at (-0.6,-1.2) {Red sticks: points above the line. Blue sticks: points below. SSE adds up their squares.};
\end{scope}
\begin{scope}[animate = {myself: = {:visible = {0s = "false", 3.4s = "true", 3.6s = "false", 11.1s = "false", repeats}}}]
\rs{cold}{(0.72,1.14)}{(0.72,2.63)}
\rs{cold}{(1.44,1.74)}{(1.44,2.64)}
\rs{hot}{(2.16,2.94)}{(2.16,2.65)}
\rs{hot}{(2.88,2.82)}{(2.88,2.66)}
\rs{cold}{(3.60,2.10)}{(3.60,2.67)}
\rs{hot}{(4.32,3.24)}{(4.32,2.68)}
\rs{hot}{(5.04,3.30)}{(5.04,2.69)}
\rs{hot}{(5.76,4.02)}{(5.76,2.70)}
\draw[grn, very thick] (0.00,2.62) -- (6.48,2.71);
\draw[very thick] (9.47,3.11) -- (9.55,2.90) -- (9.71,2.52) -- (9.86,2.17) -- (10.02,1.87) -- (10.18,1.60) -- (10.34,1.37) -- (10.50,1.17) -- (10.65,1.02) -- (10.81,0.90) -- (10.97,0.82) -- (11.13,0.78) -- (11.29,0.77) -- (11.44,0.80) -- (11.60,0.87) -- (11.76,0.98) -- (11.92,1.13) -- (12.08,1.31) -- (12.23,1.53) -- (12.39,1.79) -- (12.55,2.09) -- (12.71,2.42) -- (12.87,2.80) -- (13.02,3.21) -- (13.15,3.56);
\filldraw[draw=black, fill=grn] (9.47,3.11) circle (3pt);
\node at (11.70,5.75) {$\beta_1 = 0.02$, \ $\mathrm{SSE} = 16.38$};
\node[anchor=west] at (-0.6,-1.2) {Red sticks: points above the line. Blue sticks: points below. SSE adds up their squares.};
\end{scope}
\begin{scope}[animate = {myself: = {:visible = {0s = "false", 3.6s = "true", 4.1s = "false", 11.1s = "false", repeats}}}]
\rs{cold}{(0.72,1.14)}{(0.72,2.77)}
\rs{cold}{(1.44,1.74)}{(1.44,2.74)}
\rs{hot}{(2.16,2.94)}{(2.16,2.71)}
\rs{hot}{(2.88,2.82)}{(2.88,2.68)}
\rs{cold}{(3.60,2.10)}{(3.60,2.65)}
\rs{hot}{(4.32,3.24)}{(4.32,2.62)}
\rs{hot}{(5.04,3.30)}{(5.04,2.59)}
\rs{hot}{(5.76,4.02)}{(5.76,2.56)}
\draw[grn, very thick] (0.00,2.80) -- (6.48,2.53);
\draw[very thick] (9.25,3.72) -- (9.39,3.32) -- (9.55,2.90) -- (9.71,2.52) -- (9.86,2.17) -- (10.02,1.87) -- (10.18,1.60) -- (10.34,1.37) -- (10.50,1.17) -- (10.65,1.02) -- (10.81,0.90) -- (10.97,0.82) -- (11.13,0.78) -- (11.29,0.77) -- (11.44,0.80) -- (11.60,0.87) -- (11.76,0.98) -- (11.92,1.13) -- (12.08,1.31) -- (12.23,1.53) -- (12.39,1.79) -- (12.55,2.09) -- (12.71,2.42) -- (12.87,2.80) -- (13.02,3.21) -- (13.15,3.56);
\filldraw[draw=black, fill=grn] (9.25,3.72) circle (3pt);
\node at (11.70,5.75) {$\beta_1 = -0.05$, \ $\mathrm{SSE} = 19.59$};
\node[anchor=west] at (-0.6,-1.2) {Red sticks: points above the line. Blue sticks: points below. SSE adds up their squares.};
\end{scope}
\begin{scope}[animate = {myself: = {:visible = {0s = "false", 4.1s = "true", 4.3s = "false", 11.1s = "false", repeats}}}]
\rs{cold}{(0.72,1.14)}{(0.72,2.56)}
\rs{cold}{(1.44,1.74)}{(1.44,2.59)}
\rs{hot}{(2.16,2.94)}{(2.16,2.62)}
\rs{hot}{(2.88,2.82)}{(2.88,2.65)}
\rs{cold}{(3.60,2.10)}{(3.60,2.68)}
\rs{hot}{(4.32,3.24)}{(4.32,2.71)}
\rs{hot}{(5.04,3.30)}{(5.04,2.74)}
\rs{hot}{(5.76,4.02)}{(5.76,2.76)}
\draw[grn, very thick] (0.00,2.53) -- (6.48,2.79);
\draw[very thick] (9.25,3.72) -- (9.39,3.32) -- (9.55,2.90) -- (9.71,2.52) -- (9.86,2.17) -- (10.02,1.87) -- (10.18,1.60) -- (10.34,1.37) -- (10.50,1.17) -- (10.65,1.02) -- (10.81,0.90) -- (10.97,0.82) -- (11.13,0.78) -- (11.29,0.77) -- (11.44,0.80) -- (11.60,0.87) -- (11.76,0.98) -- (11.92,1.13) -- (12.08,1.31) -- (12.23,1.53) -- (12.39,1.79) -- (12.55,2.09) -- (12.71,2.42) -- (12.87,2.80) -- (13.02,3.21) -- (13.15,3.56);
\filldraw[draw=black, fill=grn] (9.57,2.84) circle (3pt);
\node at (11.70,5.75) {$\beta_1 = 0.05$, \ $\mathrm{SSE} = 14.95$};
\node[anchor=west] at (-0.6,-1.2) {Red sticks: points above the line. Blue sticks: points below. SSE adds up their squares.};
\end{scope}
\begin{scope}[animate = {myself: = {:visible = {0s = "false", 4.3s = "true", 4.5s = "false", 11.1s = "false", repeats}}}]
\rs{cold}{(0.72,1.14)}{(0.72,2.07)}
\rs{cold}{(1.44,1.74)}{(1.44,2.24)}
\rs{hot}{(2.16,2.94)}{(2.16,2.41)}
\rs{hot}{(2.88,2.82)}{(2.88,2.58)}
\rs{cold}{(3.60,2.10)}{(3.60,2.75)}
\rs{hot}{(4.32,3.24)}{(4.32,2.92)}
\rs{hot}{(5.04,3.30)}{(5.04,3.09)}
\rs{hot}{(5.76,4.02)}{(5.76,3.26)}
\draw[grn, very thick] (0.00,1.89) -- (6.48,3.43);
\draw[very thick] (9.25,3.72) -- (9.39,3.32) -- (9.55,2.90) -- (9.71,2.52) -- (9.86,2.17) -- (10.02,1.87) -- (10.18,1.60) -- (10.34,1.37) -- (10.50,1.17) -- (10.65,1.02) -- (10.81,0.90) -- (10.97,0.82) -- (11.13,0.78) -- (11.29,0.77) -- (11.44,0.80) -- (11.60,0.87) -- (11.76,0.98) -- (11.92,1.13) -- (12.08,1.31) -- (12.23,1.53) -- (12.39,1.79) -- (12.55,2.09) -- (12.71,2.42) -- (12.87,2.80) -- (13.02,3.21) -- (13.15,3.56);
\filldraw[draw=black, fill=grn] (10.34,1.37) circle (3pt);
\node at (11.70,5.75) {$\beta_1 = 0.28$, \ $\mathrm{SSE} = 7.20$};
\node[anchor=west] at (-0.6,-1.2) {Red sticks: points above the line. Blue sticks: points below. SSE adds up their squares.};
\end{scope}
\begin{scope}[animate = {myself: = {:visible = {0s = "false", 4.5s = "true", 4.7s = "false", 11.1s = "false", repeats}}}]
\rs{cold}{(0.72,1.14)}{(0.72,1.47)}
\rs{cold}{(1.44,1.74)}{(1.44,1.81)}
\rs{hot}{(2.16,2.94)}{(2.16,2.15)}
\rs{hot}{(2.88,2.82)}{(2.88,2.49)}
\rs{cold}{(3.60,2.10)}{(3.60,2.83)}
\rs{hot}{(4.32,3.24)}{(4.32,3.17)}
\rs{cold}{(5.04,3.30)}{(5.04,3.51)}
\rs{hot}{(5.76,4.02)}{(5.76,3.85)}
\draw[grn, very thick] (0.00,1.14) -- (6.48,4.19);
\draw[very thick] (9.25,3.72) -- (9.39,3.32) -- (9.55,2.90) -- (9.71,2.52) -- (9.86,2.17) -- (10.02,1.87) -- (10.18,1.60) -- (10.34,1.37) -- (10.50,1.17) -- (10.65,1.02) -- (10.81,0.90) -- (10.97,0.82) -- (11.13,0.78) -- (11.29,0.77) -- (11.44,0.80) -- (11.60,0.87) -- (11.76,0.98) -- (11.92,1.13) -- (12.08,1.31) -- (12.23,1.53) -- (12.39,1.79) -- (12.55,2.09) -- (12.71,2.42) -- (12.87,2.80) -- (13.02,3.21) -- (13.15,3.56);
\filldraw[draw=black, fill=grn] (11.25,0.77) circle (3pt);
\node at (11.70,5.75) {$\beta_1 = 0.57$, \ $\mathrm{SSE} = 4.05$};
\node[anchor=west] at (-0.6,-1.2) {Red sticks: points above the line. Blue sticks: points below. SSE adds up their squares.};
\end{scope}
\begin{scope}[animate = {myself: = {:visible = {0s = "false", 4.7s = "true", 4.9s = "false", 11.1s = "false", repeats}}}]
\rs{hot}{(0.72,1.14)}{(0.72,0.98)}
\rs{hot}{(1.44,1.74)}{(1.44,1.46)}
\rs{hot}{(2.16,2.94)}{(2.16,1.94)}
\rs{hot}{(2.88,2.82)}{(2.88,2.42)}
\rs{cold}{(3.60,2.10)}{(3.60,2.90)}
\rs{cold}{(4.32,3.24)}{(4.32,3.38)}
\rs{cold}{(5.04,3.30)}{(5.04,3.86)}
\rs{cold}{(5.76,4.02)}{(5.76,4.35)}
\draw[grn, very thick] (0.00,0.50) -- (6.48,4.83);
\draw[very thick] (9.25,3.72) -- (9.39,3.32) -- (9.55,2.90) -- (9.71,2.52) -- (9.86,2.17) -- (10.02,1.87) -- (10.18,1.60) -- (10.34,1.37) -- (10.50,1.17) -- (10.65,1.02) -- (10.81,0.90) -- (10.97,0.82) -- (11.13,0.78) -- (11.29,0.77) -- (11.44,0.80) -- (11.60,0.87) -- (11.76,0.98) -- (11.92,1.13) -- (12.08,1.31) -- (12.23,1.53) -- (12.39,1.79) -- (12.55,2.09) -- (12.71,2.42) -- (12.87,2.80) -- (13.02,3.21) -- (13.15,3.56);
\filldraw[draw=black, fill=grn] (12.02,1.24) circle (3pt);
\node at (11.70,5.75) {$\beta_1 = 0.80$, \ $\mathrm{SSE} = 6.52$};
\node[anchor=west] at (-0.6,-1.2) {Red sticks: points above the line. Blue sticks: points below. SSE adds up their squares.};
\end{scope}
\begin{scope}[animate = {myself: = {:visible = {0s = "false", 4.9s = "true", 5.4s = "false", 11.1s = "false", repeats}}}]
\rs{hot}{(0.72,1.14)}{(0.72,0.77)}
\rs{hot}{(1.44,1.74)}{(1.44,1.31)}
\rs{hot}{(2.16,2.94)}{(2.16,1.85)}
\rs{hot}{(2.88,2.82)}{(2.88,2.39)}
\rs{cold}{(3.60,2.10)}{(3.60,2.93)}
\rs{cold}{(4.32,3.24)}{(4.32,3.47)}
\rs{cold}{(5.04,3.30)}{(5.04,4.01)}
\rs{cold}{(5.76,4.02)}{(5.76,4.55)}
\draw[grn, very thick] (0.00,0.23) -- (6.48,5.09);
\draw[very thick] (9.25,3.72) -- (9.39,3.32) -- (9.55,2.90) -- (9.71,2.52) -- (9.86,2.17) -- (10.02,1.87) -- (10.18,1.60) -- (10.34,1.37) -- (10.50,1.17) -- (10.65,1.02) -- (10.81,0.90) -- (10.97,0.82) -- (11.13,0.78) -- (11.29,0.77) -- (11.44,0.80) -- (11.60,0.87) -- (11.76,0.98) -- (11.92,1.13) -- (12.08,1.31) -- (12.23,1.53) -- (12.39,1.79) -- (12.55,2.09) -- (12.71,2.42) -- (12.87,2.80) -- (13.02,3.21) -- (13.15,3.56);
\filldraw[draw=black, fill=grn] (12.34,1.70) circle (3pt);
\node at (11.70,5.75) {$\beta_1 = 0.90$, \ $\mathrm{SSE} = 8.95$};
\node[anchor=west] at (-0.6,-1.2) {Red sticks: points above the line. Blue sticks: points below. SSE adds up their squares.};
\end{scope}
\begin{scope}[animate = {myself: = {:visible = {0s = "false", 5.4s = "true", 5.6s = "false", 11.1s = "false", repeats}}}]
\rs{hot}{(0.72,1.14)}{(0.72,0.89)}
\rs{hot}{(1.44,1.74)}{(1.44,1.40)}
\rs{hot}{(2.16,2.94)}{(2.16,1.90)}
\rs{hot}{(2.88,2.82)}{(2.88,2.41)}
\rs{cold}{(3.60,2.10)}{(3.60,2.92)}
\rs{cold}{(4.32,3.24)}{(4.32,3.42)}
\rs{cold}{(5.04,3.30)}{(5.04,3.93)}
\rs{cold}{(5.76,4.02)}{(5.76,4.43)}
\draw[grn, very thick] (0.00,0.38) -- (6.48,4.94);
\draw[very thick] (9.25,3.72) -- (9.39,3.32) -- (9.55,2.90) -- (9.71,2.52) -- (9.86,2.17) -- (10.02,1.87) -- (10.18,1.60) -- (10.34,1.37) -- (10.50,1.17) -- (10.65,1.02) -- (10.81,0.90) -- (10.97,0.82) -- (11.13,0.78) -- (11.29,0.77) -- (11.44,0.80) -- (11.60,0.87) -- (11.76,0.98) -- (11.92,1.13) -- (12.08,1.31) -- (12.23,1.53) -- (12.39,1.79) -- (12.55,2.09) -- (12.71,2.42) -- (12.87,2.80) -- (13.02,3.21) -- (13.15,3.56);
\filldraw[draw=black, fill=grn] (12.15,1.42) circle (3pt);
\node at (11.70,5.75) {$\beta_1 = 0.84$, \ $\mathrm{SSE} = 7.47$};
\node[anchor=west] at (-0.6,-1.2) {Red sticks: points above the line. Blue sticks: points below. SSE adds up their squares.};
\end{scope}
\begin{scope}[animate = {myself: = {:visible = {0s = "false", 5.6s = "true", 5.8s = "false", 11.1s = "false", repeats}}}]
\rs{cold}{(0.72,1.14)}{(0.72,1.17)}
\rs{hot}{(1.44,1.74)}{(1.44,1.60)}
\rs{hot}{(2.16,2.94)}{(2.16,2.02)}
\rs{hot}{(2.88,2.82)}{(2.88,2.45)}
\rs{cold}{(3.60,2.10)}{(3.60,2.88)}
\rs{cold}{(4.32,3.24)}{(4.32,3.30)}
\rs{cold}{(5.04,3.30)}{(5.04,3.73)}
\rs{cold}{(5.76,4.02)}{(5.76,4.15)}
\draw[grn, very thick] (0.00,0.75) -- (6.48,4.58);
\draw[very thick] (9.25,3.72) -- (9.39,3.32) -- (9.55,2.90) -- (9.71,2.52) -- (9.86,2.17) -- (10.02,1.87) -- (10.18,1.60) -- (10.34,1.37) -- (10.50,1.17) -- (10.65,1.02) -- (10.81,0.90) -- (10.97,0.82) -- (11.13,0.78) -- (11.29,0.77) -- (11.44,0.80) -- (11.60,0.87) -- (11.76,0.98) -- (11.92,1.13) -- (12.08,1.31) -- (12.23,1.53) -- (12.39,1.79) -- (12.55,2.09) -- (12.71,2.42) -- (12.87,2.80) -- (13.02,3.21) -- (13.15,3.56);
\filldraw[draw=black, fill=grn] (11.72,0.95) circle (3pt);
\node at (11.70,5.75) {$\beta_1 = 0.71$, \ $\mathrm{SSE} = 5.01$};
\node[anchor=west] at (-0.6,-1.2) {Red sticks: points above the line. Blue sticks: points below. SSE adds up their squares.};
\end{scope}
\begin{scope}[animate = {myself: = {:visible = {0s = "false", 5.8s = "true", 6s = "false", 11.1s = "false", repeats}}}]
\rs{cold}{(0.72,1.14)}{(0.72,1.51)}
\rs{cold}{(1.44,1.74)}{(1.44,1.84)}
\rs{hot}{(2.16,2.94)}{(2.16,2.17)}
\rs{hot}{(2.88,2.82)}{(2.88,2.50)}
\rs{cold}{(3.60,2.10)}{(3.60,2.83)}
\rs{hot}{(4.32,3.24)}{(4.32,3.16)}
\rs{cold}{(5.04,3.30)}{(5.04,3.49)}
\rs{hot}{(5.76,4.02)}{(5.76,3.82)}
\draw[grn, very thick] (0.00,1.18) -- (6.48,4.15);
\draw[very thick] (9.25,3.72) -- (9.39,3.32) -- (9.55,2.90) -- (9.71,2.52) -- (9.86,2.17) -- (10.02,1.87) -- (10.18,1.60) -- (10.34,1.37) -- (10.50,1.17) -- (10.65,1.02) -- (10.81,0.90) -- (10.97,0.82) -- (11.13,0.78) -- (11.29,0.77) -- (11.44,0.80) -- (11.60,0.87) -- (11.76,0.98) -- (11.92,1.13) -- (12.08,1.31) -- (12.23,1.53) -- (12.39,1.79) -- (12.55,2.09) -- (12.71,2.42) -- (12.87,2.80) -- (13.02,3.21) -- (13.15,3.56);
\filldraw[draw=black, fill=grn] (11.20,0.77) circle (3pt);
\node at (11.70,5.75) {$\beta_1 = 0.55$, \ $\mathrm{SSE} = 4.05$};
\node[anchor=west] at (-0.6,-1.2) {Red sticks: points above the line. Blue sticks: points below. SSE adds up their squares.};
\end{scope}
\begin{scope}[animate = {myself: = {:visible = {0s = "false", 6s = "true", 6.2s = "false", 11.1s = "false", repeats}}}]
\rs{cold}{(0.72,1.14)}{(0.72,1.79)}
\rs{cold}{(1.44,1.74)}{(1.44,2.04)}
\rs{hot}{(2.16,2.94)}{(2.16,2.29)}
\rs{hot}{(2.88,2.82)}{(2.88,2.54)}
\rs{cold}{(3.60,2.10)}{(3.60,2.79)}
\rs{hot}{(4.32,3.24)}{(4.32,3.04)}
\rs{hot}{(5.76,4.02)}{(5.76,3.54)}
\draw[grn, very thick] (0.00,1.54) -- (6.48,3.79);
\draw[very thick] (9.25,3.72) -- (9.39,3.32) -- (9.55,2.90) -- (9.71,2.52) -- (9.86,2.17) -- (10.02,1.87) -- (10.18,1.60) -- (10.34,1.37) -- (10.50,1.17) -- (10.65,1.02) -- (10.81,0.90) -- (10.97,0.82) -- (11.13,0.78) -- (11.29,0.77) -- (11.44,0.80) -- (11.60,0.87) -- (11.76,0.98) -- (11.92,1.13) -- (12.08,1.31) -- (12.23,1.53) -- (12.39,1.79) -- (12.55,2.09) -- (12.71,2.42) -- (12.87,2.80) -- (13.02,3.21) -- (13.15,3.56);
\filldraw[draw=black, fill=grn] (10.77,0.93) circle (3pt);
\node at (11.70,5.75) {$\beta_1 = 0.42$, \ $\mathrm{SSE} = 4.89$};
\node[anchor=west] at (-0.6,-1.2) {Red sticks: points above the line. Blue sticks: points below. SSE adds up their squares.};
\end{scope}
\begin{scope}[animate = {myself: = {:visible = {0s = "false", 6.2s = "true", 6.7s = "false", 11.1s = "false", repeats}}}]
\rs{cold}{(0.72,1.14)}{(0.72,1.91)}
\rs{cold}{(1.44,1.74)}{(1.44,2.12)}
\rs{hot}{(2.16,2.94)}{(2.16,2.34)}
\rs{hot}{(2.88,2.82)}{(2.88,2.55)}
\rs{cold}{(3.60,2.10)}{(3.60,2.77)}
\rs{hot}{(4.32,3.24)}{(4.32,2.99)}
\rs{hot}{(5.04,3.30)}{(5.04,3.20)}
\rs{hot}{(5.76,4.02)}{(5.76,3.42)}
\draw[grn, very thick] (0.00,1.69) -- (6.48,3.63);
\draw[very thick] (9.25,3.72) -- (9.39,3.32) -- (9.55,2.90) -- (9.71,2.52) -- (9.86,2.17) -- (10.02,1.87) -- (10.18,1.60) -- (10.34,1.37) -- (10.50,1.17) -- (10.65,1.02) -- (10.81,0.90) -- (10.97,0.82) -- (11.13,0.78) -- (11.29,0.77) -- (11.44,0.80) -- (11.60,0.87) -- (11.76,0.98) -- (11.92,1.13) -- (12.08,1.31) -- (12.23,1.53) -- (12.39,1.79) -- (12.55,2.09) -- (12.71,2.42) -- (12.87,2.80) -- (13.02,3.21) -- (13.15,3.56);
\filldraw[draw=black, fill=grn] (10.58,1.08) circle (3pt);
\node at (11.70,5.75) {$\beta_1 = 0.36$, \ $\mathrm{SSE} = 5.70$};
\node[anchor=west] at (-0.6,-1.2) {Red sticks: points above the line. Blue sticks: points below. SSE adds up their squares.};
\end{scope}
\begin{scope}[animate = {myself: = {:visible = {0s = "false", 6.7s = "true", 6.9s = "false", 11.1s = "false", repeats}}}]
\rs{cold}{(0.72,1.14)}{(0.72,1.86)}
\rs{cold}{(1.44,1.74)}{(1.44,2.09)}
\rs{hot}{(2.16,2.94)}{(2.16,2.32)}
\rs{hot}{(2.88,2.82)}{(2.88,2.55)}
\rs{cold}{(3.60,2.10)}{(3.60,2.78)}
\rs{hot}{(4.32,3.24)}{(4.32,3.01)}
\rs{hot}{(5.04,3.30)}{(5.04,3.23)}
\rs{hot}{(5.76,4.02)}{(5.76,3.46)}
\draw[grn, very thick] (0.00,1.63) -- (6.48,3.69);
\draw[very thick] (9.25,3.72) -- (9.39,3.32) -- (9.55,2.90) -- (9.71,2.52) -- (9.86,2.17) -- (10.02,1.87) -- (10.18,1.60) -- (10.34,1.37) -- (10.50,1.17) -- (10.65,1.02) -- (10.81,0.90) -- (10.97,0.82) -- (11.13,0.78) -- (11.29,0.77) -- (11.44,0.80) -- (11.60,0.87) -- (11.76,0.98) -- (11.92,1.13) -- (12.08,1.31) -- (12.23,1.53) -- (12.39,1.79) -- (12.55,2.09) -- (12.71,2.42) -- (12.87,2.80) -- (13.02,3.21) -- (13.15,3.56);
\filldraw[draw=black, fill=grn] (10.65,1.02) circle (3pt);
\node at (11.70,5.75) {$\beta_1 = 0.38$, \ $\mathrm{SSE} = 5.37$};
\node[anchor=west] at (-0.6,-1.2) {Red sticks: points above the line. Blue sticks: points below. SSE adds up their squares.};
\end{scope}
\begin{scope}[animate = {myself: = {:visible = {0s = "false", 6.9s = "true", 7.1s = "false", 11.1s = "false", repeats}}}]
\rs{cold}{(0.72,1.14)}{(0.72,1.76)}
\rs{cold}{(1.44,1.74)}{(1.44,2.02)}
\rs{hot}{(2.16,2.94)}{(2.16,2.28)}
\rs{hot}{(2.88,2.82)}{(2.88,2.53)}
\rs{cold}{(3.60,2.10)}{(3.60,2.79)}
\rs{hot}{(4.32,3.24)}{(4.32,3.05)}
\rs{hot}{(5.76,4.02)}{(5.76,3.57)}
\draw[grn, very thick] (0.00,1.50) -- (6.48,3.82);
\draw[very thick] (9.25,3.72) -- (9.39,3.32) -- (9.55,2.90) -- (9.71,2.52) -- (9.86,2.17) -- (10.02,1.87) -- (10.18,1.60) -- (10.34,1.37) -- (10.50,1.17) -- (10.65,1.02) -- (10.81,0.90) -- (10.97,0.82) -- (11.13,0.78) -- (11.29,0.77) -- (11.44,0.80) -- (11.60,0.87) -- (11.76,0.98) -- (11.92,1.13) -- (12.08,1.31) -- (12.23,1.53) -- (12.39,1.79) -- (12.55,2.09) -- (12.71,2.42) -- (12.87,2.80) -- (13.02,3.21) -- (13.15,3.56);
\filldraw[draw=black, fill=grn] (10.81,0.90) circle (3pt);
\node at (11.70,5.75) {$\beta_1 = 0.43$, \ $\mathrm{SSE} = 4.74$};
\node[anchor=west] at (-0.6,-1.2) {Red sticks: points above the line. Blue sticks: points below. SSE adds up their squares.};
\end{scope}
\begin{scope}[animate = {myself: = {:visible = {0s = "false", 7.1s = "true", 7.3s = "false", 11.1s = "false", repeats}}}]
\rs{cold}{(0.72,1.14)}{(0.72,1.64)}
\rs{cold}{(1.44,1.74)}{(1.44,1.93)}
\rs{hot}{(2.16,2.94)}{(2.16,2.22)}
\rs{hot}{(2.88,2.82)}{(2.88,2.52)}
\rs{cold}{(3.60,2.10)}{(3.60,2.81)}
\rs{hot}{(4.32,3.24)}{(4.32,3.10)}
\rs{cold}{(5.04,3.30)}{(5.04,3.40)}
\rs{hot}{(5.76,4.02)}{(5.76,3.69)}
\draw[grn, very thick] (0.00,1.34) -- (6.48,3.98);
\draw[very thick] (9.25,3.72) -- (9.39,3.32) -- (9.55,2.90) -- (9.71,2.52) -- (9.86,2.17) -- (10.02,1.87) -- (10.18,1.60) -- (10.34,1.37) -- (10.50,1.17) -- (10.65,1.02) -- (10.81,0.90) -- (10.97,0.82) -- (11.13,0.78) -- (11.29,0.77) -- (11.44,0.80) -- (11.60,0.87) -- (11.76,0.98) -- (11.92,1.13) -- (12.08,1.31) -- (12.23,1.53) -- (12.39,1.79) -- (12.55,2.09) -- (12.71,2.42) -- (12.87,2.80) -- (13.02,3.21) -- (13.15,3.56);
\filldraw[draw=black, fill=grn] (11.00,0.81) circle (3pt);
\node at (11.70,5.75) {$\beta_1 = 0.49$, \ $\mathrm{SSE} = 4.25$};
\node[anchor=west] at (-0.6,-1.2) {Red sticks: points above the line. Blue sticks: points below. SSE adds up their squares.};
\end{scope}
\begin{scope}[animate = {myself: = {:visible = {0s = "false", 7.3s = "true", 7.5s = "false", 11.1s = "false", repeats}}}]
\rs{cold}{(0.72,1.14)}{(0.72,1.53)}
\rs{cold}{(1.44,1.74)}{(1.44,1.86)}
\rs{hot}{(2.16,2.94)}{(2.16,2.18)}
\rs{hot}{(2.88,2.82)}{(2.88,2.50)}
\rs{cold}{(3.60,2.10)}{(3.60,2.82)}
\rs{hot}{(4.32,3.24)}{(4.32,3.15)}
\rs{cold}{(5.04,3.30)}{(5.04,3.47)}
\rs{hot}{(5.76,4.02)}{(5.76,3.79)}
\draw[grn, very thick] (0.00,1.21) -- (6.48,4.11);
\draw[very thick] (9.25,3.72) -- (9.39,3.32) -- (9.55,2.90) -- (9.71,2.52) -- (9.86,2.17) -- (10.02,1.87) -- (10.18,1.60) -- (10.34,1.37) -- (10.50,1.17) -- (10.65,1.02) -- (10.81,0.90) -- (10.97,0.82) -- (11.13,0.78) -- (11.29,0.77) -- (11.44,0.80) -- (11.60,0.87) -- (11.76,0.98) -- (11.92,1.13) -- (12.08,1.31) -- (12.23,1.53) -- (12.39,1.79) -- (12.55,2.09) -- (12.71,2.42) -- (12.87,2.80) -- (13.02,3.21) -- (13.15,3.56);
\filldraw[draw=black, fill=grn] (11.16,0.77) circle (3pt);
\node at (11.70,5.75) {$\beta_1 = 0.54$, \ $\mathrm{SSE} = 4.06$};
\node[anchor=west] at (-0.6,-1.2) {Red sticks: points above the line. Blue sticks: points below. SSE adds up their squares.};
\end{scope}
\begin{scope}[animate = {myself: = {:visible = {0s = "false", 7.5s = "true", 11.1s = "true", repeats}}}]
\rs{cold}{(0.72,1.14)}{(0.72,1.49)}
\rs{cold}{(1.44,1.74)}{(1.44,1.83)}
\rs{hot}{(2.16,2.94)}{(2.16,2.16)}
\rs{hot}{(2.88,2.82)}{(2.88,2.49)}
\rs{cold}{(3.60,2.10)}{(3.60,2.83)}
\rs{hot}{(4.32,3.24)}{(4.32,3.17)}
\rs{cold}{(5.04,3.30)}{(5.04,3.50)}
\rs{hot}{(5.76,4.02)}{(5.76,3.83)}
\draw[grn, very thick] (0.00,1.16) -- (6.48,4.17);
\draw[very thick] (9.25,3.72) -- (9.39,3.32) -- (9.55,2.90) -- (9.71,2.52) -- (9.86,2.17) -- (10.02,1.87) -- (10.18,1.60) -- (10.34,1.37) -- (10.50,1.17) -- (10.65,1.02) -- (10.81,0.90) -- (10.97,0.82) -- (11.13,0.78) -- (11.29,0.77) -- (11.44,0.80) -- (11.60,0.87) -- (11.76,0.98) -- (11.92,1.13) -- (12.08,1.31) -- (12.23,1.53) -- (12.39,1.79) -- (12.55,2.09) -- (12.71,2.42) -- (12.87,2.80) -- (13.02,3.21) -- (13.15,3.56);
\draw[dashed] (11.23,0.77) -- (11.23,0) node[below] {$\hat\beta_1$};
\filldraw[draw=black, fill=grn] (11.23,0.77) circle (3pt);
\node at (11.70,5.75) {$\beta_1 = 0.56$, \ $\mathrm{SSE} = 4.05$};
\node[anchor=west] at (-0.6,-1.2) {OLS: $\hat\beta_1 = S_{xy}/S_{xx} = 23.45/42 = 0.558$, \ $\hat\beta_0 = \bar y - \hat\beta_1 \bar x = 1.125$, \ lowest $\mathrm{SSE} = 4.05$.};
\end{scope}
\filldraw[draw=black, fill=white] (0.72,1.14) circle (2.6pt);
\filldraw[draw=black, fill=white] (1.44,1.74) circle (2.6pt);
\filldraw[draw=black, fill=white] (2.16,2.94) circle (2.6pt);
\filldraw[draw=black, fill=white] (2.88,2.82) circle (2.6pt);
\filldraw[draw=black, fill=white] (3.60,2.10) circle (2.6pt);
\filldraw[draw=black, fill=white] (4.32,3.24) circle (2.6pt);
\filldraw[draw=black, fill=white] (5.04,3.30) circle (2.6pt);
\filldraw[draw=black, fill=white] (5.76,4.02) circle (2.6pt);
\draw[thick] (3.09,2.51) -- (3.39,2.81) (3.09,2.81) -- (3.39,2.51);
\end{tikzpicture}
\end{document}Properties
(Slope in Standard Units) The OLS slope is the sample correlation rescaled by the ratio of standard deviations.
Dividing the numerator and denominator of by gives . Here is the sample correlation, and and are the sample standard deviations. In standard units (each variable centered and divided by its standard deviation), the fitted slope is itself, and . A point one standard deviation above is therefore predicted to sit only standard deviations above . This pull toward the mean is called regression to the mean. The fit is also not symmetric. Regressing on gives the slope , which equals only when . Both estimators are weighted sums of the responses , which is what makes their distributional properties clean under noise assumptions.
(Population Interpretation) OLS estimates the line that minimizes the population mean-squared prediction error.
Viewing as a random pair, the population objective is minimized at and . These are the population analogues of the sample formulas. So OLS estimates the parameters of the best linear predictor of from . This holds whether or not the true conditional expectation is linear. When it is not, OLS still recovers the linear approximation that minimizes squared error.
(Maximum Likelihood Under Gaussian Noise) OLS coincides with the MLE when .
Under the Gaussian noise assumption, each is independently , and the log-likelihood is
Maximizing over is identical to minimizing the sum of squared errors. The MLE coefficients are therefore the OLS coefficients exactly. Maximizing over gives the biased estimator . The unbiased version divides by instead. It is the residual sum of squares per degree of freedom remaining after fitting two parameters.
(Inference Under Normality) Standardized coefficients follow a -distribution.
If the Gaussian noise assumption holds, the slope estimate is exactly Gaussian, . The intercept estimate has variance , which grows as moves away from zero. Replacing by its unbiased estimate gives the standard errors. The statistic follows a distribution under . This gives exact finite-sample -values and confidence intervals. Without Gaussianity, the same statistic is approximately Normal by the central limit theorem when is large. The -tables then remain a good approximation. 3.1a. Multiple Linear Regression gives the matrix form for many coefficients.
(Residual Diagnostics) Plot the residuals before trusting the fit.
Three checks are standard after fitting. A plot of residuals against fitted values spots heteroskedasticity (fanning) or model misspecification (curvature). A Q-Q plot of the residuals against the Normal distribution checks the noise assumption. When the data are sequential, the ACF of the residuals checks for serial correlation. If the residuals show clear patterns, the linear-Gaussian assumptions fail and the standard errors are unreliable. Curvature can often be fixed by adding transformed inputs, as in 3.1b. Basis Function Regression.
Examples
(Easy) Heights of Fathers and Sons
Pairs of father-son heights are recorded for families. Fit and interpret.
What do the slope and intercept mean? measures how many inches taller a son is, on average, when his father is one inch taller. In Pearson and Lee's 1903 data on 1,078 father-son pairs, , much less than 1. Fathers and sons have similar spreads, so the slope is close to the correlation . Tall fathers tend to have sons closer to the population mean than they themselves are. Galton first described this effect in 1886, using the heights of parents and their adult children. He called it "regression towards mediocrity," which gave the technique its name. The intercept then absorbs whatever shift makes the line pass through the data centroid.
(Medium) Predicting House Price from Square Footage
is the sale price in thousands of dollars; is the square footage. After fitting OLS on houses, and with standard errors and .
How do we read the two coefficients and their standard errors? thousand dollars ($180) to the predicted price. The quantile is , so the confidence interval is roughly . The intercept of $30k is the predicted price of a hypothetical zero-square-foot house. It is not physically meaningful, but it allows the line to fit the data. The large standard error on the intercept reflects that the data probably do not extend down to . The coefficient of determination would give the fraction of price variance the model explains. For example, would mean square footage alone explains 65% of the price variation.
Each additional square foot adds
See Also
- 3.1a. Multiple Linear Regression, the matrix-form generalization to many predictors.
- 3.1b. Basis Function Regression, for curves fit with the same least squares machinery.
- 3.3. Nonlinear Regression, when the response is not linear in the parameters.
- 3.2. Regularization, ridge and lasso for high-dimensional or correlated designs.
- 2.1.4. R-Squared, the variance decomposition behind the coefficient of determination.
- 2.3.2. Cross-Validation, model-selection machinery for regression and classification.
- 3.8.1 Bayesian Linear Regression, the Bayesian counterpart, where has a prior and the output is a posterior distribution.
- 2.4 Time Series Regression, how OLS adapts to time series with correlated errors and time-indexed predictors.
- 1.2.3 Linear Least Squares Estimation, the inferential framework’s treatment of linear least squares.