I'm doing a mediation analysis using the mediation package in R.
These are the mediator and outcome model that I have specified:
model.m1 <- lm(AttentionForWords ~ NewCondition, data = mediate1) model.y1 <- glmer(cbind(PhonemesCorrectRelative,PhonemesIncorrectRelative) ~ 1 + NewCondition + AttentionForWords + TestingMoment + NewCondition:TestingMoment + (1|Participant), data = data, family = 'binomial')
The causal mediation analysis itself is this:
mediate(model.m1, model.y1, treat = "NewCondition", mediator = "AttentionForWords", control.value = "SilentWithoutNoticing", treat.value = "Noticing", boot = FALSE, sims = 1000)
Thus, my independent variable is NewCondition, my mediator is AttentionForWords, and my outcome is a vector of correct and incorrect phonemes.
As you can see, in the outcome model (model.y1) I have also specified two other predictors: TestingMoment, and NewCondition:TestingMoment. I included these predictors because they make the model fit to the data better.
My question is whether this is allowed. In other words: is it acceptable for the outcome model to contain predictors that were not specified in the mediator model? (the reason they were not specified in that model, is that each participant only has one value for AttentionForWords, whereas TestingMoment is a within-participant manipulation).