Question about interpreting interaction of effects coded predictors
Thanks for the MWE, Dave, but please try to use plain-text (instead of HTML) formatted email because it tends to preserve the linebreaks better on the list. You don't need to something like an ANOVA or analysis of deviance, you can interpret appropriately coded contrasts (like you have) directly from the model summary. See e.g. https://arxiv.org/abs/1807.10451 In your particular case, it's easy to show that you get the same answer as you would with a Type II analysis of deviance:
coef(summary(m))
Estimate Std. Error z value Pr(>|z|) (Intercept) 0.12290954 0.1069286 1.1494541 0.2503688 IV11 -0.05570847 0.1059129 -0.5259840 0.5988993 IV21 -0.10058387 0.1059290 -0.9495401 0.3423460 IV11:IV21 -0.05570841 0.1059128 -0.5259836 0.5988996
Anova(m, type=2)
Analysis of Deviance Table (Type II Wald chisquare tests)
Response: DV
Chisq Df Pr(>Chisq)
IV1 0.2791 1 0.5973
IV2 0.9020 1 0.3422
IV1:IV2 0.2767 1 0.5989
or even using drop1, which will do the likelihood-ratio test for you
(the other meaning of anova() in R):
drop1(m, test="Chisq")
boundary (singular) fit: see ?isSingular
Single term deletions
Model:
DV ~ IV1 * IV2 + (1 | Subject) + (1 | Item)
Df AIC LRT Pr(Chi)
<none> 508.26
IV1:IV2 1 506.53 0.27678 0.5988
One small t> drop1(m, test="Chisq")
boundary (singular) fit: see ?isSingular
Single term deletions
Model:
DV ~ IV1 * IV2 + (1 | Subject) + (1 | Item)
Df AIC LRT Pr(Chi)
<none> 508.26
IV1:IV2 1 506.53 0.27678 0.5988
Two more small tips for you:
1. Don't automatically include lmerTest whenever you want to use
mixed-effects models. It doesn't actually add any extra functionality
for glmer() and the extra degrees of freedom estimation it provides for
lmer() aren't universally seen as a good thing. (The Kenward-Roger
approximation depends on inverting a large matrix and the the
Satterthwaite approximation isn't much better than just treating the t
values as z values when you have typically sized psycholinguistic datasets.)
2. Don't automatically include data.table. You don't need it for your
example. :)
Best,
Phillip
On 11/10/2019 06:26, David Sidhu wrote:
Hi There
I have run a mixed effects logistic regression with two dichotomous predictors and their interaction. These predictors were effects coded (i.e., -1, 1).
Can I simply interpret the term for the interaction that is provided by a model summary? Or, is there another step that is necessary for testing the interaction that includes an ANOVA function? (A reviewer suggested the latter.)
I have attached some code for running an analysis of the sort I?m talking about.
Thanks very much!
Dave
require(lme4) require(lmerTest) require(data.table) Subject <- rep(1:30, each = 12) Item <- rep(1:12, times = 30) IV1 <- rep(rep(c("A", "B"), each = 6), times = 10) IV2 <- rep(c("A", "B"),times = 180) DV <- sample(c(0,1), replace = TRUE, size = 360) data <- as.data.table(cbind(Subject, Item, IV1, IV2, DV)) data$IV1 <- as.factor(data$IV1) data$IV2 <- as.factor(data$IV2) data$DV <- as.factor(data$DV) contrasts(data$IV1) <- c(1, -1) contrasts(data$IV2) <- c(1, -1) m <- glmer(DV ~ IV1*IV2 + (1|Subject) + (1|Item), family = "binomial", data = data) summary(m)
---
David M. Sidhu<http://davidmsidhu.com>, PhD
Postdoctoral Associate
Department of Psychology
University of Calgary
[[alternative HTML version deleted]]
_______________________________________________ R-sig-mixed-models at r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models