Similar to question here.
3 variables (1 continuous (X) and 2 categorical (A & B)) predict 1 dichotomous variable in generalized linear mixed models.
Both variables A and B are dichotomous and are coded with 0 (reference category) and 1. Criterion is coded with 0 & 1.
After
library(lmerTest)
glmer(Y ~ X*A*B + (0+X|G) + (1|G), data=dat, family = "binomial", verbose = T, control = glmerControl(optimizer = "bobyqa"))
we have the following results:
Random effects:
Groups Name Variance Std.Dev.
G (Intercept) 0.1458298 0.38188
G X 0.21727 0.46612
Number of obs: 26260, groups: G, 230
Fixed effects:
Estimate Std. Error z value Pr(>|z|)
(Intercept) 1.47384 0.04094 35.997 < 2e-16 ***
X -0.03252 0.01612 -2.017 0.04370 *
A2 -0.46066 0.04853 -9.492 < 2e-16 ***
B2 -0.61576 0.04811 -12.799 < 2e-16 ***
X:A2 0.07502 0.01810 4.144 3.41e-05 ***
X:B2 0.08031 0.01945 4.129 3.64e-05 ***
A2:B2 0.62260 0.06653 9.358 < 2e-16 ***
X:A2:B2 -0.06789 0.02367 -2.868 0.00413 **
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Now, the slopes for different conditions are:
A1 A2
B1 X X+X:A2
B2 X+X:B2 X+X:A2+X:B2+X:A2:B2
How can I test the following hypothesis
X+X:B2 = X+X:A2 + X:B2 + X:A2:B2 which equals to 0 = X:A2 + X:A2:B2 and finally
X:A2 = -X:A2:B2
For logistic one-level models we use Wald's test as described in here.
library(aod)
R <- cbind(0,0,0,0,0,0,1,1)
wald.test(b = coef(model), Sigma = vcov(model), L = R)
Can we use the identical approach for mixed models?