Removing random intercepts before random slopes
Sorry, hit the send button too fast: # here c1 and c2 represent the two contrasts/numeric covariates defined for the three levels of a categorical predictor m1 <- y ~ 1 + c1 + c2 + (1 + c1 + c2 || group) On Wed, Aug 29, 2018 at 2:07 PM Maarten Jung <
Maarten.Jung at mailbox.tu-dresden.de> wrote:
On Wed, Aug 29, 2018 at 12:41 PM Phillip Alday <phillip.alday at mpi.nl> wrote:
Focusing on just the last part of your question:
And, is there any difference between LMMs with categorical and LMMs with continuous predictors regarding this?
Absolutely! Consider the trivial case of only one categorical predictor with dummy coding and no continuous predictors in a fixed-effect model. Then ~ 0 + cat.pred and ~ 1 + cat.pred produce identical models in some sense, but in the former each level of the predictor is estimated as an "absolute" value, while in the latter, one predictor is coded as the intercept and estimated as an "absolute" value, while the other levels are coded as offsets from that value. For a really interesting example, try this: data(Oats,package="nlme") summary(lm(yield ~ 1 + Variety,Oats)) summary(lm(yield ~ 0 + Variety,Oats)) Note that the residual error is identical, but all of the summary statistics -- R2, F -- are different.
Sorry, I just realized that I didn't make clear what I was talking about. I know that ~ 0 + cat.pred and ~ 1 + cat.pred in the fixed effects part are just reparameterizations of the same model. As I'm working with afex::lmer_alt() which converts categorical predictors to numeric covariates (via model.matrix()) per default, I was talking about removing random intercepts before removing random slopes in such a model, especially one without correlation parameters [e.g. m1], and whether this is conceptually different from removing random intercepts before removing random slopes in a LMM with continuous predictors. I. e., I would like to know if it makes sense in this case vs. doesn't make sense in this case but does for continuous predictors vs. does never make sense. # here c1 and c2 represent the two contrasts/numeric covariates defined for the three levels of a categorical predictor m1 <- y ~ 1 + c1 + c2 + (1 + c1 + c2 || cat.pred) Best, Maarten