Home forums Mixed Models Trouble with ordered contrasts and lmer_alt

Viewing 2 reply threads
  • Author
    Posts
    • #327
      David Sidhu
      Participant

      I’m using the MASS package to create ordered contrasts (i.e., compare level 3 to level 2; level 2 to level 1). However, I am running into an error when I try to use lmer_alt() and uncorrelated random effects with this coding. Do you have any idea why this might be? I’m attaching a reproducible example below.

      Subj <- rep(1:10, each = 10)
      Item <- rep(1:10, times = 10)
      IV1 <- rep(1:5, times = 20)
      DV <- rnorm(100)
      
      library(data.table)
      data <- as.data.table(cbind(Subj, Item, IV1, DV))
      
      data$Subj <- as.factor(data$Subj)
      data$Item <- as.factor(data$Item)
      data$IV1 <- as.factor(data$IV1)
      
      library(MASS)
      contrasts(data$IV1) <- contr.sdif(5)
      
      library(lme4)
      library(afex)
      mafex <- lmer_alt(DV ~ IV1 + (1 + IV1||Subj) + (1|Item), data = data)

      I get the following error:

      Error in terms.formula(frml) : invalid model formula in ExtractVars

    • #328
      henrik
      Keymaster

      Thanks for the bug report. I have fixed this in the development version on github, which you can get via:
      devtools::install_github("singmann/afex@master")

      It might take some time until it gets on CRAN as there are some things I still want to fix before that.

    • #329
      David Sidhu
      Participant

      Thanks very much!

Viewing 2 reply threads
  • You must be logged in to reply to this topic.