The Data Matrix \textbf{X}
- \textbf{X} is an n \times p matrix
- The (i,j)th element of \textbf{X} is x_{ij}
\textbf{X} =
\begin{pmatrix}
x_{11} & x_{12} & \dots & x_{1p} \\
x_{21} & x_{22} & \dots & x_{2p} \\
\vdots & \vdots & \ddots & \vdots \\
x_{n1} & x_{n2} & \dots & x_{np}
\end{pmatrix}
Rows of \textbf{X}
At times we focus on the rows of \textbf{X}, written as
x_1, x_2, \dots, x_n.
Each x_i is a vector of length p, containing the p variable measurements for the ith observation:
x_i =
\begin{pmatrix}
x_{i1} \\
x_{i2} \\
\vdots \\
x_{ip}
\end{pmatrix}
- For the Wage data:
x_i is a vector of length 11 (year, age, race, etc.) for the ith individual.
Columns of \textbf{X}
We may instead focus on the columns of \textbf{X}, written as \textbf{x}_1, \textbf{x}_2, \dots, \textbf{x}_p.
Each \textbf{x}_j is a vector of length n:
\textbf{x}_j =
\begin{pmatrix}
x_{1j} \\
x_{2j} \\
\vdots \\
x_{nj}
\end{pmatrix}
- For the Wage data:
\textbf{x}_1 contains the n = 3000 values of year.
Alternative Representations of \textbf{X}
Using column notation:
\textbf{X} = \begin{pmatrix} \textbf{x}_1 & \textbf{x}_2 & \cdots & \textbf{x}_p \end{pmatrix}
Using row notation:
\textbf{X} =
\begin{pmatrix}
x_1^{T} \\
x_2^{T} \\
\vdots \\
x_n^{T}
\end{pmatrix}
Transpose Notation
The superscript T denotes the transpose of a vector or matrix.
\textbf{X}^{T} =
\begin{pmatrix}
x_{11} & x_{21} & \dots & x_{n1} \\
x_{12} & x_{22} & \dots & x_{n2} \\
\vdots & \vdots & \ddots & \vdots \\
x_{1p} & x_{2p} & \dots & x_{np}
\end{pmatrix}
while the transpose of x_i is a row vector:
x_i^{T} =
\begin{pmatrix}
x_{i1} & x_{i2} & \cdots & x_{ip}
\end{pmatrix}
Response Variable
We use y_i to denote the ith observation of the variable we wish to predict (e.g., wage).
The response vector is written as:
\mathbf{y} =
\begin{pmatrix}
y_1 \\
y_2 \\
\vdots \\
y_n
\end{pmatrix}
Our observed data consists of:
\{(x_1, y_1), (x_2, y_2), \dots, (x_n, y_n)\}
where each x_i is a vector of length p.
(If p = 1, then x_i is simply a scalar.)