# Defining Contrast Matrix

#### Cynderella

##### New Member
In the book Applied Longitudinal Analysis, 2nd Edition there is an example in the chapter "Marginal Models: Generalized Estimating Equations (GEE)" in "Muscatine Coronary Risk Factor Study" sub-section. I am illustrating it below :

Let $$Y_{ij}=1$$if the $$i^{\text{th}}$$ child is classified as obese at the $$j^{\text{th}}$$ occasion, and $$Y_{ij}=0$$ otherwise.

The marginal probability of obesity at each occasion follows the logistic model

$$log\frac{\Pr(Y_{ij}=1)}{\Pr(Y_{ij}=0)}= \beta_1+\beta_2\text{gender}_i+\beta_3\text{age}_{ij}+\beta_4\text{age}_{ij}^2+\beta_5\text{gender}_i\text{age}_{ij}+\beta_6\text{gender}_i\text{age}_{ij}^2.$$

If one construct the hypothesis that changes in the log odds of obesity are the same for boys and girls, then $H_0:\beta_5=\beta_6=0$.

To test the hypothesis $$H_0:\beta_5=\beta_6=0$$
$$\Rightarrow\mathbf L\mathbf\beta = 0,$$

where $$\mathbf\beta = \begin{pmatrix} \beta_1 &\beta_2 &\beta_3 & \beta_4 &\beta_5 & \beta_6\\ \end{pmatrix}'$$ and $$\mathbf L$$ is the contrast matrix.

But I can't write the contrast matrix for the $$H_0:\beta_5=\beta_6=0$$.

Because if the $$H_0$$ were $$H_0:\beta_5=\beta_6$$ (notice that there ISN'T equal to $$0$$ at the most right ), then I can construct the contrast matrix easily as :
$$\mathbf L = \begin{pmatrix} 0& 0&0& 0&1& -1\\ \end{pmatrix}$$ so that

$$\mathbf L\mathbf\beta = 0$$
$$\Rightarrow \begin{pmatrix} 0& 0&0& 0&1& -1\\ \end{pmatrix}\begin{pmatrix} \beta_1\\ \beta_2\\ \beta_3\\ \beta_4\\ \beta_5\\ \beta_6\\ \end{pmatrix}=0$$

$$\Rightarrow \beta_5=\beta_6.$$

But When the $$H_0$$ is $$H_0:\beta_5=\beta_6 = 0$$ (notice that there IS equal to $$0$$ at the most right ), then
$$\mathbf L = \begin{pmatrix} 0& 0&0& 0&1& 0\\ 0& 0&0& 0&0& 1\\ \end{pmatrix}$$ so that

$$\mathbf L\mathbf\beta = 0$$
$$\Rightarrow \begin{pmatrix} 0& 0&0& 0&1& 0\\ 0& 0&0& 0&0& 1\\ \end{pmatrix}\begin{pmatrix} \beta_1\\ \beta_2\\ \beta_3\\ \beta_4\\ \beta_5\\ \beta_6\\ \end{pmatrix}=0$$

$$\Rightarrow \beta_5=0 \quad \text{and}\quad \beta_6=0,$$

but necessarily the contrast matrix is NOT correct as the row sum of a contrast matrix is equal to $$0$$. How can I define the contrast matrix?

Last edited: