I have a data set with 20 users who were exposed to three levels and two variants (except the low level was only exposed to one variant). There are two measurements for each combination. Below are example data for one user:

enter image description here

I know the two measurements are correlated for the same user, level and variant (not in this example data) so I'm imposing an AR1 structure. Below is the lme model and estimation of interactions I'm interested in using the emmeans package.

enter image description here

enter image description here

Two questions:

  1. Am I specifying the correlation structure correctly given I expect scores within user, level, and variant to be correlated?
  2. How does the emmeans function produce an estimate for level = low and variant = B when that combination is not even in the data.

Full code for reproducibility:



for(i in 1:NUM_USERS){

a1 = bind_rows(save_list) 



1 Answer 1


The answer to your second question is that those two factors do not interact in your model. Therefore the effects of those two factors are additive, meaning that we are assuming that the interaction effect between them is equal to zero. if your model had included the interaction between variant and level, then that missing combination would not have been estimable. Try it and see!

  • $\begingroup$ @RussThanks. I cannot estimate the model (Singularity) when I include the variant and level interaction and that make sense. However, I don't understand how I can get an estimate for the score one - two in level = low and variant = B. $\endgroup$
    – Glen
    Nov 5, 2021 at 11:44
  • $\begingroup$ The estimate for each factor combination is the overall mean plus the marginal effect for one factor plus the marginal effect of the other factor. You can estimate those marginal effects even when there are a few holes in the data. It's related to a method you could find in an old, old experimental design book for imputing a missing observation in a block experiment. $\endgroup$
    – Russ Lenth
    Nov 5, 2021 at 14:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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