# Defining a contrast matrix to test the null hypothesis $H_0: \beta_5=\beta_6=0$

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\times\text{age}_{ij}+\beta_6\text{gender}_i\times\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?

• As far as I know, contrast matrices are useful for testing the null hypothesis that two unknown parameters are equal, but NOT for testing the null hypothesis that one (or more) unknown parameters equals zero. You can see this easily in the case of a model with a single parameter: there is no such thing as a matrix (in this case a 1x1 matrix) with row-sum zero that will test whether this parameter is zero. With two parameters, you can test whether they are equal to each other with a contrast matrix [1,-1], but you cannot test whether either of them is equal to zero with a contrast matrix. – Jacob Socolar May 20 '16 at 0:45
• What can be the alternative to test $H_0:\beta_5=\beta_6=0$ ? – user 31466 May 20 '16 at 10:11

In dummy or treatment coding, the default for the lm() function in R, "contrast" coefficients can sum to 1, not 0, for individual predictor variables, and they can have higher sums when interactions are considered. This makes it easier to identify individual treatment effects in output summaries, although I suppose it doesn't meet the strict definition of a "contrast" and it does lead to non-orthogonality.
For testing your hypothesis $H_0:\beta_5=\beta_6=0$, you can simply compare the full model against the model that omits both $\beta_5$ and $\beta_6$, and avoid the definition of "contrasts" completely. In R, that could be provided by anova(fullModel,reducedModel), which works on logistic regressions (or other generalized linear models) produced by glm() as well as on standard linear models.