Writing $\beta$ and X for a qualitative model

46 Views Asked by At

Express the following model in matrix form, ie: specify $\beta$ and $X$ so that the model can be written as $Y = X \beta + \epsilon$.

The model $Y_{ij} = \mu_i + \epsilon_i$ where $Y_{ij}$ represents the $j$-th observation observed at level $i$ of a qualitative explanatory variable $T$, for $i=0,...,4$ and $j=1,2$.

I know how to write the vector $\beta$ (just a column of $\mu_0$ to $\mu_4$), but how do you write the matrix X?

1

There are 1 best solutions below

4
On

Write $\tilde{Y}$ as a vector of length $10,$ by stacking $Y_{01},Y_{02},Y_{11},Y_{12},...,Y_{42}.$ Similarly define $\tilde{\varepsilon}.$ You are now looking for a $10\times 5$ matrix $X$.

$\beta^T=(\mu_0,\mu_1,\mu_2,\mu_3,\mu_4)$

$$X=\begin{bmatrix}1&0&0&0&0\\ 1&0&0&0&0\\ 0&1&0&0&0\\ 0&1&0&0&0\\ 0&0&1&0&0\\ 0&0&1&0&0\\ 0&0&0&1&0\\ 0&0&0&1&0\\ 0&0&0&0&1\\ 0&0&0&0&1\end{bmatrix}$$

Then $\tilde{Y}=X\beta+\tilde{\varepsilon}$ is an expression of $Y_{ij}=\mu_i+\varepsilon_{ij}.$

If instead you had $Y_{ij}=\mu_0+\mu_i+\varepsilon_{ij},$ $\tilde{Y}$ and $\tilde{\varepsilon}$ will have length $8.$ Then

$$X=\begin{bmatrix}1&1&0&0\\ 1&1&0&0\\ 1&1&0&0\\ 1&1&0&0\\ 1&0&1&0\\ 1&0&1&0\\ 1&0&0&1\\ 1&0&0&1\end{bmatrix}$$

will be your design matrix so that $\tilde{Y}=X\beta+\tilde{\varepsilon}.$