Home › forums › Mixed Models › using multcomp to update glmm emmeans
- This topic has 1 reply, 2 voices, and was last updated 2 years, 9 months ago by henrik.
-
AuthorPosts
-
-
March 9, 2022 at 17:27 GMT+0000 #432Joseph M. OrrParticipant
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?
-
March 10, 2022 at 09:06 GMT+0000 #434henrikKeymaster
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)
-
-
AuthorPosts
- You must be logged in to reply to this topic.