Introduction


An overview of statistial learning

Statistical learning refers to a vast set of tools for understanding data.

Two categories: supervised and unsupervised.

Supervised: Build models based on known input and output data, then use the model for prediction or estimation.

Unsupervised: There are inputs but no supervised outputs. We can learn relationships and structures from such data.

Notation and simple algebra

Let the XX denotes a matrix. XijX_{ij} represents the value of row ii and column jj.

X=(x11x12x1px21x22x2pxn1xn2xnp) X = \left(\begin{array}{cc} x_{11} &x_{12} &\cdots &x_{1p}\\ x_{21} &x_{22} &\cdots &x_{2p}\\ \ldots &\ldots &\ldots &\ldots\\ x_{n1} &x_{n2} &\cdots &x_{np} \end{array}\right)

For the rows of XX, wich we write as x1,x2,,xnx_1, x_2, …, x_n .

xi=(xi1xi2xip) x_i = \begin{pmatrix} x_{i1} \\ x_{i2} \\ \vdots x_{ip} \end{pmatrix}

Vectors are by default represented as columns. We use X1X_1, X2X_2, \ldots, to represent the columns of XX.

Xj=(x1jx2jxnj) X_j = \begin{pmatrix} x_{1j} \\ x_{2j} \\ \vdots \\ x_{nj} \end{pmatrix}

Using this notation, the matirx XX can be written as:

X=(X1 X2  Xp) X = \left(X_1 \space X_2 \space \cdots \space X_p\right)

or

X=(x1Tx2TxnT) X = \begin{pmatrix} x_{1}^T \\ x_{2}^T \\ \vdots \\ x_{n}^T \end{pmatrix}

The T^T notation denotes the transpose of a matrix.

We use yiy_i to denote the ii th observation of the variable on which we wish to make predictions. Hence we wirte the set of all nn observations in vector format as

y=(y1y2yn) y = \begin{pmatrix} y_1 \\ y_2 \\ \vdots \\ y_n \end{pmatrix}

The out observed data consits of {(x1,y1),(x2,y2),,(xn,yn) (x_1,y_1),(x_2,y_2),\ldots ,(x_n,y_n)}, where each xix_i is a vector of length pp.

Occationally we will want to indicate the dimension of a particular object.

To indicate that an object is a scalar: aRa \in \mathbb{R}.

To indicate that it is avector of length kk: aRka \in \mathbb{R}^k.

To indicate that an object is a r×sr \times s matrix: ARr×s A \in \mathbb{R}^{r \times s}.

The product of matrix AA and matrixt BB is denoted ABAB.

A=(1234)and B=(5678) A = \begin{pmatrix} 1 &2 \\ 3 &4 \end{pmatrix} and \space B=\begin{pmatrix} 5 &6\\ 7 &8 \end{pmatrix}

Then

AB=(1234)(5678)=(1×5+2×71×6+2×83×5+4×73×6+3×8) AB = \begin{pmatrix} 1 &2 \\ 3 &4 \end{pmatrix} \begin{pmatrix} 5 &6 \\ 7 &8 \end{pmatrix} =\begin{pmatrix} 1 \times 5 + 2 \times 7 & 1 \times 6 + 2 \times 8 \\ 3 \times 5 + 4 \times 7 & 3 \times 6 + 3 \times 8 \\ \end{pmatrix}

get the R package

install.packages("ISLR")