Home forums Mixed Models using multcomp to update glmm emmeans

Tagged: , ,

Viewing 1 reply thread
  • Author
    Posts
    • #432
      Joseph M. Orr
      Participant

      In the vignette, “Mixed Model Reanalysis of RT data” multcomp is used for a emmeans object,
      summary(as.glht(update(pairs(emm_i1), by = NULL)), test = adjusted("free"))

      I ran a glmm using mixed and generated an emm object
      emm_i3 <- emmeans(vsr_rew_m4lrt, "rewCond", by = c("prevRew","version")) but when I try to use the above example I get an error:

      summary(as.glht(update(pairs(emm_i3), by = NULL)), test = adjusted(“free”))
      Note: adjust = “tukey” was changed to “sidak”
      because “tukey” is only appropriate for one set of pairwise comparisons
      Error in UseMethod(“vcov”) :
      no applicable method for ‘vcov’ applied to an object of class “c(’emmwrap’, ‘list’)”
      Error in h(simpleError(msg, call)) :
      error in evaluating the argument ‘object’ in selecting a method for function ‘summary’: no ‘vcov’ method for ‘model’ found!

      Do I need to provide some additional options to glht to get it to work for a glmm?

    • #434
      henrik
      Keymaster

      Solving specific problems without a reproducible example is generally difficult. At least for the data oin the vignette, it still works:

      library("afex") # needed for mixed() and attaches lme4 automatically.
      library("emmeans") # emmeans is needed for follow-up tests 
      library("multcomp") # for advanced control for multiple testing/Type 1 errors.
      data("fhch2010") # load 
      fhch <- droplevels(fhch2010[ fhch2010$correct,]) # remove errors
      str(fhch2010) # structure of the data
      
      m9s <- mixed(log_rt ~ task*stimulus*density*frequency + 
                     (stimulus+frequency||id)+
                     (task|item), fhch, 
                   control = lmerControl(optCtrl = list(maxfun = 1e6)), expand_re = TRUE)
      emm_options(lmer.df = "asymptotic")
      emm_i1 <- emmeans(m9s, "frequency", by = c("stimulus", "task"))
      update(pairs(emm_i1), by = NULL, adjust = "holm")
      summary(as.glht(update(pairs(emm_i1), by = NULL)), test = adjusted("free"))

      This produces:

      Note: adjust = "tukey" was changed to "sidak"
      because "tukey" is only appropriate for one set of pairwise comparisons
      
      	 Simultaneous Tests for General Linear Hypotheses
      
      Linear Hypotheses:
                                       Estimate Std. Error z value Pr(>|z|)    
      low - high, word, naming == 0     0.05877    0.01491   3.941 0.000162 ***
      low - high, nonword, naming == 0 -0.20699    0.01497 -13.823  < 2e-16 ***
      low - high, word, lexdec == 0     0.06353    0.01669   3.807 0.000162 ***
      low - high, nonword, lexdec == 0  0.11086    0.01675   6.619 1.08e-10 ***
      ---
      Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
      (Adjusted p values reported -- free method)
Viewing 1 reply thread
  • You must be logged in to reply to this topic.