## 數據矩陣的列與行

$\displaystyle \mathbf{X}=\begin{bmatrix} x_{11}&x_{12}&\cdots&x_{1p}\\ x_{21}&x_{22}&\cdots&x_{2p}\\ \vdots&\vdots&\ddots&\vdots\\ x_{n1}&x_{n2}&\cdots&x_{np} \end{bmatrix}$

$\displaystyle \mathbf{X}=\begin{bmatrix} x_{11}&x_{12}&\cdots&x_{1p}\\ x_{21}&x_{22}&\cdots&x_{2p}\\ \vdots&\vdots&\ddots&\vdots\\ x_{n1}&x_{n2}&\cdots&x_{np} \end{bmatrix}=\begin{bmatrix} \mathbf{p}_1^T\\ \mathbf{p}_2^T\\ \vdots\\ \mathbf{p}_n^T \end{bmatrix}$

$\displaystyle \mathbf{X}=\begin{bmatrix} x_{11}&x_{12}&\cdots&x_{1p}\\ x_{21}&x_{22}&\cdots&x_{2p}\\ \vdots&\vdots&\ddots&\vdots\\ x_{n1}&x_{n2}&\cdots&x_{np} \end{bmatrix}=\begin{bmatrix} \mathbf{x}_1&\mathbf{x}_2&\cdots &\mathbf{x}_p \end{bmatrix}$

$\displaystyle E(\mathbf{a})=\sum_{k=1}^n\Vert\mathbf{p}_k-\mathbf{a}\Vert^2$

$\displaystyle \mathbf{m}=\frac{1}{n}\sum_{k=1}^n\mathbf{p}_k$

\displaystyle\begin{aligned} E(\mathbf{a})&=\sum_{k=1}^n\Vert(\mathbf{p}_k-\mathbf{m})+(\mathbf{m}-\mathbf{a})\Vert^2\\ &=\sum_{k=1}^n\Vert\mathbf{p}_k-\mathbf{m}\Vert^2+\sum_{k=1}^n\Vert\mathbf{m}-\mathbf{a}\Vert^2+2\sum_{k=1}^n(\mathbf{p}_k-\mathbf{m})^T(\mathbf{m}-\mathbf{a})\\ &=\sum_{k=1}^n\Vert\mathbf{p}_k-\mathbf{m}\Vert^2+n\Vert\mathbf{m}-\mathbf{a}\Vert^2+2\left(\sum_{k=1}^n\mathbf{p}_k-n\mathbf{m}\right)^T(\mathbf{m}-\mathbf{a}). \end{aligned}

$\displaystyle \mathbf{X}=\left[\!\!\begin{array}{rc} -1&3\\ 4&1\\ 3&5 \end{array}\!\!\right]$

$\displaystyle \mathbf{m}=\overline{\mathbf{p}}=\frac{1}{3}\sum_{i=1}^3\mathbf{p}_i=\frac{1}{3}\begin{bmatrix} -1+4+3\\ 3+1+5 \end{bmatrix}=\begin{bmatrix} 2\\ 3 \end{bmatrix}$

$\displaystyle E(a_j)=\sum_{k=1}^n(x_{kj}-a_j)^2=(\mathbf{x}_j-a_j\mathbf{1})^T(\mathbf{x}_j-a_j\mathbf{1})=\Vert\mathbf{x}_j-a_j\mathbf{1}\Vert^2$

$\displaystyle (\mathbf{x}_j-a_j\mathbf{1})^T\mathbf{1}=\mathbf{x}_j^T\mathbf{1}-a_j\mathbf{1}^T\mathbf{1}=\sum_{k=1}^nx_{kj}-na_j=0$

$\displaystyle m_j=\overline{x}_j=\frac{1}{n}\mathbf{x}_j^T\mathbf{1}=\frac{1}{n}\sum_{k=1}^n x_{kj}$

$\displaystyle \mathbf{d}_j=\mathbf{x}_j-m_j\mathbf{1}=\begin{bmatrix} x_{1j}-m_j\\ x_{2j}-m_j\\ \vdots\\ x_{nj}-m_j \end{bmatrix}$

\displaystyle\begin{aligned} \mathbf{x}_1&=\left[\!\!\begin{array}{r} -1\\ 4\\ 3 \end{array}\!\!\right]=\begin{bmatrix} 2\\ 2\\ 2 \end{bmatrix}+\left[\!\!\begin{array}{r} -3\\ 2\\ 1 \end{array}\!\!\right]\\ \mathbf{x}_2&=\begin{bmatrix} 3\\ 1\\ 5 \end{bmatrix}=\begin{bmatrix} 3\\ 3\\ 3 \end{bmatrix}+\left[\!\!\begin{array}{r} 0\\ -2\\ 2 \end{array}\!\!\right].\end{aligned}

$\displaystyle s_j^2=\frac{1}{n-1}\sum_{i=1}^n(x_{ij}-m_j)^2=\frac{1}{n-1}\mathbf{d}_j^T\mathbf{d}_j=\frac{1}{n-1}\Vert\mathbf{d}_j\Vert^2$

\displaystyle\begin{aligned} s_{ij}&=\frac{1}{n-1}\sum_{k=1}^n(x_{ki}-m_i)(x_{kj}-m_j)\\ &=\frac{1}{n-1}\mathbf{d}_i^T\mathbf{d}_j=\frac{1}{n-1}\Vert\mathbf{d}_i\Vert \Vert\mathbf{d}_j\Vert\cos\theta_{ij},\end{aligned}

$\displaystyle r_{ij}=\cos\theta_{ij}=\frac{s_{ij}}{s_is_j}$

[1] 在台灣，橫向稱為列，縱向稱為行。在中國大陸，橫向稱為行，縱向稱為列。

This entry was posted in 機率統計 and tagged , , , , . Bookmark the permalink.