[R-sig-ME] Your response to my R-sig-ME question

Lenth, Russell V ru@@e||-|enth @end|ng |rom u|ow@@edu
Sat Nov 2 23:25:37 CET 2019

If the question is how to do multiplicity adjustments for multiple sets of comparisons in 'emmeans', that is pretty simple to do. For example, starting with

    emm <- emmeans(model, ~ factor1 | factor2)

By default,

    pairs(emm, by = "factor1")

will apply the Tukey adjustment to the pairwise comparisons of factor2 for each level of factor1, SEPARATELY. If instead, you want to multiplicity-adjust all of those simple comparisons as one family, summarize those results after removing the 'by' variable:

    summary(pairs(emm, by = "factor1"), by = NULL, adjust = "mvt")

(Note that the Tukey adjustment is not appropriate for that family because it is not ONE set of pairwise comparisons. The mvt adjustment is the same adjustment that the multcomp package appluies by default.)

You of course may also want simple comparisons of factor1 for each level of factor2; just reverse the roles of the two factors in the above.

If you want to combine both of those families into a single family consisting of all simple comparisons of both factor2|factor1 and factor1|factor2, that can be done as well via 'rbind':

    allcmps <- pairs(emm, simple = "each")   # creates a list of two emmGrid objects
    summary(do.call(rbind, allcmps), adjust = "mvt")

I hope that helps


Russell V. Lenth  -  Professor Emeritus
Department of Statistics and Actuarial Science   
The University of Iowa  -  Iowa City, IA 52242  USA   
Voice (319)335-0712 (Dept. office)  -  FAX (319)335-3017

-----Original Message-----

Date: Fri, 1 Nov 2019 21:00:03 -0400
From: Ben Bolker <bbolker using gmail.com>
To: Francesco Romano <fbromano77 using gmail.com>
Cc: "r-sig-mixed-models using r-project.org"
	<r-sig-mixed-models using r-project.org>
Subject: Re: [R-sig-ME] Your response to my R-sig-ME question
Message-ID: <c5952d23-0ab9-e201-f775-5c90d89f5dff using gmail.com>
Content-Type: text/plain; charset="utf-8"

  [cc'ing r-sig-mixed-models]

  Honestly, it looks to me like you *do* need multiple-comparisons corrections here. I can't give you detailed advice about how to do it; emmeans does the pairwise comparisons, but it's not immediately obvious how to do correction for *multiple* sets of pairwise comparisons.
(Perhaps you could get away with only doing the corrections at the level of sets of pairwise comparisons.)  As I mentioned before, this is not a particularly mixed-model-related question.  You could try CrossValidated (https://stats.stackexchange.com).  The emmeans and multcomp packages will probably be what you need in terms of machinery.

   Ben Bolker

More information about the R-sig-mixed-models mailing list