[R-sig-ME] Mixed model interpretation with interaction
d@iuedecke m@iii@g oii uke@de
d@iuedecke m@iii@g oii uke@de
Sun Jun 9 12:45:16 CEST 2019
Dear Patricia,
when you include an interaction, your assumption is that the relationship between an independent X1 and the dependent variable Y varies *depending on the values of another independent variable X2*. Indeed, for logistic regression models (as well as for many models with non-Gaussian families), the interpretation of interaction terms can be tricky. In such cases, I would recommend to compute (at least additionally) marginal effects, which give you an intuitive output of your results.
You can do so e.g. with the "ggeffects" package (https://strengejacke.github.io/ggeffects/), and there is also an example for a logistic mixed effects model (https://strengejacke.github.io/ggeffects/articles/practical_logisticmixedmodel.html), which might help you.
In your case, the code would be
ggpredict(M1, c("feed", "year")) for the model with interaction. If you want to plot the results, simply call
me <- ggpredict(M1, c("feed", "year"))
plot(me)
A comment on your model: I'm not sure, but if you compare subjects (or feeding sites) at two time points, you might want to model the auto-correlation of subjects / feeding site ("repeated measure") using your time variable as random slope:
M1 <- glmer((bear_pres ~ feed * year + (1 + year | Feeding.site), family = binomial, data = df10)
Computing marginal effects than would be the same function call:
ggpredict(M1, c("feed", "year"))
Best
Daniel
-----Ursprüngliche Nachricht-----
Von: R-sig-mixed-models <r-sig-mixed-models-bounces using r-project.org> Im Auftrag von Patricia Graf
Gesendet: Sonntag, 9. Juni 2019 09:17
An: r-sig-mixed-models using r-project.org
Betreff: [R-sig-ME] Mixed model interpretation with interaction
Hello,
I have a few questions concering the interpretation of a GLMM output table
when the model includes an interaction.
We want to analyse bear presence at feeding sites (bear_pres) related to
the year (two years: 2016, 2017) and the feed supplied at feeding sites
(carrion, maize). So the response is binary (0 = no bear present, 1 = bear
present within 5-min intervals over the whole day) and both predictors are
categorical, we include feeding site ID as random factor.
The model includes some other variables too but for simplicity I just use
those two variables for explanation.
1) As I understand, in a model without interaction, the interpretation of
the results would be as follows:
M1 <- glmer((bear_pres ~ feed + year + (1|Feeding.site), family=binomial,
data=df10)
Fixed effects:
Estimate Std. Error z value Pr(>|z|)
(Intercept) -4.58524 0.08529 -53.76 <2e-16 ***the intercept is bear
presence at maize sites in 2016
feedcarrion 0.39178 0.02139 18.32 <2e-16 ***bear presence at
feeding sites in 2017 compared to 2016
year2017 0.23027 0.01978 11.64 <2e-16 ***bear presence at carrion
feeding sites compared to maize feeding sites
Is this interpretation right?
2) To my knowledge, the output changes when you include an interaction:
M2<- glmer(bear_pres ~ year*feed + (1|Feeding.site), family=binomial,
data=df10)
Fixed effects:
Estimate Std. Error z value Pr(>|z|)
(Intercept) -4.36413 0.10730 -40.67 < 2e-16 ***the intercept is
bear presence at maize sites in 2016 (baseline)
year2017 -0.18010 0.05119 -3.52 0.000434 ***difference in bear
presence in 2017 compared to 2016 for maize
feedcarrion -0.02933 0.05318 -0.55 0.581222 difference in
bear presence at carrion sites compared to maize sites in 2016
year2017:feedcarrion 0.85275 0.09953 8.57 < 2e-16 ***difference in
bear presence at carrion sites 2017 and the sum of ß0+ ß1+ ß2
So to my questions: Is this interpretation right? What is the coding of the
model so it does produce this output, e.g. why is the year not comparing
2016 to 2017 anymore as in the model without the interaction? Or why
doesn’t the model still use the two food types for comparison?
As I understand, when you include an intercation between the two binary
dummy-coded categorical variables, the interpretation of what was main
effects before (year, carrion) changes, and so do the betas (these are
called „simple effects“ afterwards).
In my group, there is a strong believe that in M2, the year still compares
the two years (and so does feed), it’s just the coefficient cannot be
interpreted anymore. Also, there is a believe that the interaction term
compares to feedmaize in the year 2016.
If my interpreation is correct, I need some background on how the algorithm
works, how simple effects evolve and why the interaction should be
interpreted as in the output table of M2.
Thank you for your help in advance!
[[alternative HTML version deleted]]
_______________________________________________
R-sig-mixed-models using r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models
--
_____________________________________________________________________
Universitätsklinikum Hamburg-Eppendorf; Körperschaft des öffentlichen Rechts; Gerichtsstand: Hamburg | www.uke.de
Vorstandsmitglieder: Prof. Dr. Burkhard Göke (Vorsitzender), Prof. Dr. Dr. Uwe Koch-Gromus, Joachim Prölß, Marya Verdel
_____________________________________________________________________
SAVE PAPER - THINK BEFORE PRINTING
More information about the R-sig-mixed-models
mailing list