Solved – When working in matrix form, why is the sum of squared residuals given by $e’e$

least squaresmatrixmultiple regressionregression

Why is it that when calculating the sum of squared residuals in matrix form we use $e'e$ (where $e'$ is the transpose of $e$) instead of $e^2$?

Best Answer

In matrix notation, the residuals are typically written as an $n$ length column vector $\mathbf{e}$ where $n$ is the number of observations.

$$ \mathbf{e} = \left[ \begin{array}{c} e_1 \\ e_2 \\ \ldots \\ e_n \end{array} \right]$$

Then:

$$ \mathbf{e}'\mathbf{e} = \left[ \begin{array}{cccc} e_1 & e_2 & \ldots & e_n \end{array} \right] \left[ \begin{array}{c} e_1 \\ e_2 \\ \ldots \\ e_n \end{array} \right] = \sum_i e_i^2$$

In contrast, $\mathbf{e}\mathbf{e}$ is rather sloppy (arguably downright wrong) since you can't multiply an $n$ by 1 matrix by another $n$ by 1 matrix.

Notation note: I personally like the engineering convention that bold lowercase letters denote vectors and normal lowercase letters denote scalars; this notation reduces confusion about what's a vector and what's a scalar.

Related Question