# testing fixed effect interaction in mixed model (matrix computation)

I am fitting mixed model with X fixed effect design matrix Z is random effect design matrix.

Consider the mixed model:

E[y|u] = X $\beta$ + Zu

with E[u] = 0,

y ~ (X$\beta$, ZDZ' + R), var(u) = D

V = var(y) = ZDZ' + R

We take y to be normally distributed:

y ~ N(X $\beta$, V),

estimating fixed effects for V known

According to McCulloch and Searle ( Generalized, Linear and Mixed models book, page 163)

To test the null hypothesis H0 : S'X $\beta$ = m, where S' is of full row rank (rs < rx), we can derive a chi-square statistic using

Under HQ, $\chi$ 2 has a central $\chi$ 2 distribution with rs = rank(S) degrees of freedom.

And F test for fixed effects is:

Under the null hypothesis, F has an F-distribution on rs and N — rx degrees of freedom.The null hypothesis is rejected at significance level a when F exceeds F N-rx, 1- $\alpha$ .

When I have single X variable, F test is strait forward as this include main effect only. In my case I have two X variables and want to test significance of both X variables and interactions. How can I achieve this ?

• What do your variables look like? Are they binary? Is your interaction term a simple product like this? $$\begin{bmatrix} x & y & interaction\\ 1 & 6 & 6\\ 2 & 7 & 14\\ 3 & 8 & 24 \end{bmatrix}$$ – eric_kernfeld Jun 21 '17 at 14:49
• that is categorical ( more than two options) or quantitative as you said – John Jun 21 '17 at 21:41
• Wouldn't the coefficient of the product of both X variables count as an interaction term? – Digio Jul 21 '17 at 20:45
• @Digio YES but F test will test variable X1 + X2 + X1*X2 , I need separate tests for X1, X2 and interactions (X1 * X2). – John Jul 21 '17 at 21:44
• hi John. Normally I would fit two models (ML), one including all three variables (X1 X2 and X1*X2) and one not, and do the F test for model A vs B. You probably know that. From your comment I see that you want to test for the variables separately? In that case I would first model all three (X1 X2 X1*X2). If the interaction is not significant, you can go on testing without interaction X1 and X2 as usual (either alone or by F test together). If the interaction is significant you should probably really test them together. Hope this helps and interesting if you have different opinions! – David Jul 25 '17 at 20:02