回歸分析多元線性回歸矩陣形式的迴歸模型本頁導覽矩陣形式的迴歸模型 當我們有 nnn 筆數據,並且有 kkk 個自變數時,我們有以下的迴歸模型: Y1=β0+β1X11+β2X12+⋯+βkX1k+εiY2=β0+β1X21+β2X22+⋯+βkX2k+ε2⋮Yn=β0+β1Xn1+β2Xn2+⋯+βkXnk+εn\begin{align*} Y_1=&\beta_0+\beta_1X_{11}+\beta_2X_{12}+\cdots+\beta_kX_{1k}+\varepsilon_i\\ Y_2=&\beta_0+\beta_1X_{21}+\beta_2X_{22}+\cdots+\beta_kX_{2k}+\varepsilon_2\\ &\vdots\\ Y_n=&\beta_0+\beta_1X_{n1}+\beta_2X_{n2}+\cdots+\beta_kX_{nk}+\varepsilon_n \end{align*}Y1=Y2=Yn=β0+β1X11+β2X12+⋯+βkX1k+εiβ0+β1X21+β2X22+⋯+βkX2k+ε2⋮β0+β1Xn1+β2Xn2+⋯+βkXnk+εn 我們可以將這個模型寫成矩陣形式: Y~=[1X11X12⋯X1k1X21X22⋯X2k⋮⋮⋮⋱⋮1Xn1Xn2⋯Xnk]⏟Design Matrixβ~+ε~\utilde{Y}=\underbrace{\begin{bmatrix} 1 & X_{11} & X_{12} & \cdots & X_{1k}\\ 1 & X_{21} & X_{22} & \cdots & X_{2k}\\ \vdots & \vdots & \vdots & \ddots & \vdots\\ 1 & X_{n1} & X_{n2} & \cdots & X_{nk} \end{bmatrix}}_{\text{Design Matrix}}\utilde{\beta}+\utilde{\varepsilon}Y=Design Matrix11⋮1X11X21⋮Xn1X12X22⋮Xn2⋯