Example
Write the following model in vector-matrix notation carefully identifying vectors \(\textbf{Y}\), \(\boldsymbol{\beta}\) and \(\boldsymbol{\epsilon}\) and design matrix \(\textbf{X}\). \[Y_i = \alpha + \beta_1 I_{\text{Feb}_i} + \beta_2 I_{\text{Mar}_i} + \epsilon_i, \quad \quad i=1,\dots,n.\] where \(\mathrm{E}(\epsilon_i) = 0 \mbox{ and } \mathrm{Var}(\epsilon_i) = \sigma^2.\) and \[ I_{\text{Mar}_i}= \begin{cases} 1 \hspace{0.5cm} \mbox{if observation } i \mbox{ was recored in March} \\ 0 \hspace{0.5cm} \mbox{if observation } i \mbox{ was not recored in March} \end{cases} \] \[ I_{\text{Feb}_i}= \begin{cases} 1 \hspace{0.5cm} \mbox{if observation } i \mbox{ was recored in February} \\ 0 \hspace{0.5cm} \mbox{if observation } i \mbox{ was not recored in February} \end{cases} \]
Order data such that observation \(1,\ldots,m_1\) were recorded in January, observation \(m_1+1, \ldots m_2\) recorded in February and observations \(m_{2}+1,\ldots,n\) observed in March. Therefore
\[\begin{aligned} y_1 & =\alpha +\epsilon_1 \\ &\vdots \\ y_{m_1} & =\alpha +\epsilon_{m_1} \\ y_{{m_1}+1} & =\alpha + \beta_1 +\epsilon_{{m_1}+1} \\ &\vdots \\ y_{m_2} & =\alpha + \beta_1 + \epsilon_{m_2} \\ y_{{m_2}+1} & =\alpha + \beta_2 +\epsilon_{{m_2}+1} \\ &\vdots \\ y_n & = \alpha+ \beta_2 + \epsilon_n \end{aligned}\]
Group all the observations, \(Y_i\), into an \(n\) dimensional vector \(Y\), and the errors \(\epsilon_i\) into another column vector \(\boldsymbol{\epsilon}\): \[\begin{aligned} \mathbf{Y} =&\left( \begin{array}{c} y_{1} \\ \vdots \\ y_{m_1} \\ y_{{m_1}+1} \\ \vdots \\ y_{m_2} \\ y_{{m_2}+1} \\ \vdots \\ y_{n} \\ \end{array} \right), \quad \quad \quad \quad \boldsymbol{\epsilon} &= \left( \begin{array}{c} \epsilon_{1} \\ \vdots \\ \epsilon_{m_1} \\ \epsilon_{{m_1}+1} \\ \vdots \\ \epsilon_{m_2} \\ \epsilon_{{m_2}+1} \\ \vdots \\ \epsilon_{n} \\ \end{array} \right).\\ \end{aligned} \] Put \(\alpha\), \(\beta_1\) and \(\beta_2\), into another column vector: \[\begin{aligned} \boldsymbol{\beta} &=&\left( \begin{array}{c} \alpha \\ \beta_1 \\ \beta_2 \end{array} \right)\end{aligned}\] Finally, specify the design matrix: \[\begin{aligned}\mathbf{X}&=&\left( \begin{array}{ccc} 1 & 0 & 0 \\ \vdots & \vdots & \vdots \\ 1 & 0 & 0\\ 1 & 1 & 0 \\ \vdots & \vdots & \vdots \\ 1 & 1 & 0 \\ 1 & 0 & 1 \\ \vdots & \vdots & \vdots \\ 1 & 0 & 1 \\ \end{array} \right). \end{aligned}\]