0
$\begingroup$

I have a lmer model with two within factors

lmer (variable ~ time * condition + (1|id), data= df)

with time having 2 levels (pre - post) and condition having 2 levels (cond1, cond2)

The coefficient estimation computes parameters for:

cond2
cond2:post
post

How does R take the reference term to compare the level?

How can I get the other interactions between cond:time? If I run a model with a 3 levels fixed effect, it always misses some interactions. It seems that generate only comparison with the reference term and not among the other levels of a fixed effect.

$\endgroup$
  • $\begingroup$ They coincide with the intercept. You can change which category of a factor ends up there by using my_factor <- relevel(my_factor, "my_reference"). The reason for this is to avoid perfect colinearity with the intercept. $\endgroup$ – Frans Rodenburg Jul 12 '19 at 2:03
1
$\begingroup$

You have four possible combinations of your two factors, and the fitted model predicts for all of them. I think of the coefficients as 'modifiers' to the reference level.

The four combinations and how to predict them using your fitted coefficients are as follows:

pre and cond1 (reference level: the prediction is the intercept plus the random effect (1|id))

pre and cond2 (add the coefficient for cond2 to the prediction for the reference level)

post and cond1 (add the coefficient for post to the prediction for the reference level)

post and cond2 (add the coefficient post and the coefficient cond2:post to the prediction for the reference level).

You don't go into detail about your three levels fixed effect. You may find, if you examine it more closely, that you do in fact have predictions for all the possible interactions. If not, check that you have sufficient degrees of freedom to fit all of the coefficients you are trying to fit, and that you actually have data for all of the possible combinations of your factor levels.

Please see @Macro's answer to this question for an explanation of what is being compared.

$\endgroup$
  • $\begingroup$ @Tony K, suggest you post your proposed edit as a separate answer. $\endgroup$ – Izy Jun 27 '19 at 21:10

Not the answer you're looking for? Browse other questions tagged or ask your own question.