angelo.arcadi at virgilio.it
2015-Jul-06 22:50 UTC
[R] R: RE: Bonferroni post hoc test in R for repeated measure ANOVA with mixed within and between subjects design
Dear Michael, thank you for your answer, however, I am not asking for the tukey with the bonferroni adjustment, but doing the post hoc with the bonferroni method. Apparently this is done easily in SPSS, I am wondering whether it is possible with R. Can anyone help me? Thanks in advance Angelo ----Messaggio originale---- Da: meyners.m at pg.com Data: 6-lug-2015 17.52 A: "angelo.arcadi at virgilio.it"<angelo.arcadi at virgilio.it>, "r-help at r-project.org"<r-help at r-project.org> Ogg: RE: [R] Bonferroni post hoc test in R for repeated measure ANOVA with mixed within and between subjects design Untested, but if anything, your best bet is likely something like summary(glht(lme_H2H, linfct=mcp(Emotion = "Tukey")), test=adjusted("bonferroni")) should work (despite the question why you'd want to use Bonferroni rather than Tukey For a reference, see the book on the topic by the package authors. Might be in the paper, too, which is given by citation("multcomp") HTH, Michael> -----Original Message----- > From: R-help [mailto:r-help-bounces at r-project.org] On Behalf Of > angelo.arcadi at virgilio.it > Sent: Montag, 6. Juli 2015 16:01 > To: r-help at r-project.org > Subject: [R] Bonferroni post hoc test in R for repeated measure ANOVA with > mixed within and between subjects design > > Dear List Members, > > > > I need to perform a Bonferroni post hoc test in R on a table with three within > subjects factors (Emotion, having 5 levels, Material, having 4 levels, Shoes, > having 2 levels) and one between subject factor (Musician, having 2 levels). > > > I normally use the Tukey method with the following formula > > require(nlme) > lme_H2H = lme(H2H ~ Emotion*Material*Shoes*Musician, data=scrd, > random = ~1|Subject) > require(multcomp) > summary(glht(lme_H2H, linfct=mcp(Emotion = "Tukey"))) > > > > I am not able to find any reference that explains with an example of R code > how to perform a post hoc test with the Bonferroni procedure. > Can anyone provide an example to perform the same post hoc test in the > code above but with Bonferroni instead of Tukey? > > > Thank you in advance > > > > Angelo > > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting- > guide.html > and provide commented, minimal, self-contained, reproducible code.[[alternative HTML version deleted]]
John Fox
2015-Jul-07 01:23 UTC
[R] R: RE: Bonferroni post hoc test in R for repeated measure ANOVA with mixed within and between subjects design
Dear Angelo, The Bonferroni p-value is just the ordinary p-value times the number of tests, so, since R supports multiplication, you can apply the Bonferroni adjustment in R. Because Bonferroni tests for multiple comparisons can be very conservative, asking why you want to use them is a fair question. Best, John ------------------------------------------------ John Fox, Professor McMaster University Hamilton, Ontario, Canada http://socserv.mcmaster.ca/jfox/ On Tue, 7 Jul 2015 00:50:49 +0200 (CEST) "angelo.arcadi at virgilio.it" <angelo.arcadi at virgilio.it> wrote:> Dear Michael, > thank you for your answer, however, I am not asking for the tukey > with the bonferroni adjustment, but doing the post hoc with the bonferroni method. > Apparently this is done easily in SPSS, I am wondering whether it is possible with R. > > Can anyone help me? > > Thanks in advance > > > Angelo > > > > ----Messaggio originale---- > Da: meyners.m at pg.com > Data: 6-lug-2015 17.52 > A: "angelo.arcadi at virgilio.it"<angelo.arcadi at virgilio.it>, "r-help at r-project.org"<r-help at r-project.org> > Ogg: RE: [R] Bonferroni post hoc test in R for repeated measure ANOVA with mixed within and between subjects design > > Untested, but if anything, your best bet is likely something like > > summary(glht(lme_H2H, linfct=mcp(Emotion = "Tukey")), test=adjusted("bonferroni")) > > should work (despite the question why you'd want to use Bonferroni rather than Tukey > For a reference, see the book on the topic by the package authors. Might be in the paper, too, which is given by > > citation("multcomp") > > HTH, Michael > > > > -----Original Message----- > > From: R-help [mailto:r-help-bounces at r-project.org] On Behalf Of > > angelo.arcadi at virgilio.it > > Sent: Montag, 6. Juli 2015 16:01 > > To: r-help at r-project.org > > Subject: [R] Bonferroni post hoc test in R for repeated measure ANOVA with > > mixed within and between subjects design > > > > Dear List Members, > > > > > > > > I need to perform a Bonferroni post hoc test in R on a table with three within > > subjects factors (Emotion, having 5 levels, Material, having 4 levels, Shoes, > > having 2 levels) and one between subject factor (Musician, having 2 levels). > > > > > > I normally use the Tukey method with the following formula > > > > require(nlme) > > lme_H2H = lme(H2H ~ Emotion*Material*Shoes*Musician, data=scrd, > > random = ~1|Subject) > > require(multcomp) > > summary(glht(lme_H2H, linfct=mcp(Emotion = "Tukey"))) > > > > > > > > I am not able to find any reference that explains with an example of R code > > how to perform a post hoc test with the Bonferroni procedure. > > Can anyone provide an example to perform the same post hoc test in the > > code above but with Bonferroni instead of Tukey? > > > > > > Thank you in advance > > > > > > > > Angelo > > > > > > [[alternative HTML version deleted]] > > > > ______________________________________________ > > R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see > > https://stat.ethz.ch/mailman/listinfo/r-help > > PLEASE do read the posting guide http://www.R-project.org/posting- > > guide.html > > and provide commented, minimal, self-contained, reproducible code. > > > > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code.
Meyners, Michael
2015-Jul-07 06:58 UTC
[R] R: RE: Bonferroni post hoc test in R for repeated measure ANOVA with mixed within and between subjects design
Angelo, the conservatism of Bonferroni aside for a moment, I don't really see what you are after. mcp(Emotion = "Tukey") just defines the contrasts to test; in this case, all pairwise comparisons. The test=adjusted("bonferroni") argument then says that these contrasts should not be corrected for according to Tukey's procedure, but using Bonferroni adjustment. So this should give you tests for all pairwise comparisons with multiplicity correction according to Bonferroni. I wonder how this differs from the results you get from SPSS. Seemingly, this is not what you want, so the question is what you really want. "Bonferroni method" does not indicate which comparisons / contrasts to look at, but just takes all those that you are interested in and multiply the corresponding p values with the number of comparisons (and making sure it does not exceed 1). As John indicated, that can easily be handled manually. Yet, you need to create the tests for all comparisons that you are interested in - if not via linfct=mcp(Emotion = "Tukey"), you need to specify them otherwise (see the three options indicated on ?glht). The code I suggested offers a convenient shortcut in case you are interested in all pairwise comparisons and want them to be corrected according to Bonferroni, but if something else is of interest, you'd need to specify this (and let us know, as "Bonferroni method" does not give a clue about which comparisons to test). NB: You may want to pay attention to the warning halfway down the helppage for ?mcp; it may not be clear exactly which effects you want to compare; mcp uses just the main effects w/o interactions etc. Michael> -----Original Message----- > From: John Fox [mailto:jfox at mcmaster.ca] > Sent: Dienstag, 7. Juli 2015 03:24 > To: angelo.arcadi at virgilio.it > Cc: Meyners, Michael; r-help at r-project.org > Subject: Re: [R] R: RE: Bonferroni post hoc test in R for repeated measure > ANOVA with mixed within and between subjects design > > Dear Angelo, > > The Bonferroni p-value is just the ordinary p-value times the number of > tests, so, since R supports multiplication, you can apply the Bonferroni > adjustment in R. Because Bonferroni tests for multiple comparisons can be > very conservative, asking why you want to use them is a fair question. > > Best, > John > > ------------------------------------------------ > John Fox, Professor > McMaster University > Hamilton, Ontario, Canada > http://socserv.mcmaster.ca/jfox/ > > > > On Tue, 7 Jul 2015 00:50:49 +0200 (CEST) "angelo.arcadi at virgilio.it" > <angelo.arcadi at virgilio.it> wrote: > > Dear Michael, > > thank you for your answer, however, I am not asking for the tukey with > > the bonferroni adjustment, but doing the post hoc with the bonferroni > method. > > Apparently this is done easily in SPSS, I am wondering whether it is possible > with R. > > > > Can anyone help me? > > > > Thanks in advance > > > > > > Angelo > > > > > > > > ----Messaggio originale---- > > Da: meyners.m at pg.com > > Data: 6-lug-2015 17.52 > > A: "angelo.arcadi at virgilio.it"<angelo.arcadi at virgilio.it>, > > "r-help at r-project.org"<r-help at r-project.org> > > Ogg: RE: [R] Bonferroni post hoc test in R for repeated measure ANOVA > > with mixed within and between subjects design > > > > Untested, but if anything, your best bet is likely something like > > > > summary(glht(lme_H2H, linfct=mcp(Emotion = "Tukey")), > > test=adjusted("bonferroni")) > > > > should work (despite the question why you'd want to use Bonferroni > > rather than Tukey For a reference, see the book on the topic by the > > package authors. Might be in the paper, too, which is given by > > > > citation("multcomp") > > > > HTH, Michael > > > > > > > -----Original Message----- > > > From: R-help [mailto:r-help-bounces at r-project.org] On Behalf Of > > > angelo.arcadi at virgilio.it > > > Sent: Montag, 6. Juli 2015 16:01 > > > To: r-help at r-project.org > > > Subject: [R] Bonferroni post hoc test in R for repeated measure > > > ANOVA with mixed within and between subjects design > > > > > > Dear List Members, > > > > > > > > > > > > I need to perform a Bonferroni post hoc test in R on a table with > > > three within subjects factors (Emotion, having 5 levels, Material, > > > having 4 levels, Shoes, having 2 levels) and one between subject factor > (Musician, having 2 levels). > > > > > > > > > I normally use the Tukey method with the following formula > > > > > > require(nlme) > > > lme_H2H = lme(H2H ~ Emotion*Material*Shoes*Musician, data=scrd, > > > random = ~1|Subject) > > > require(multcomp) > > > summary(glht(lme_H2H, linfct=mcp(Emotion = "Tukey"))) > > > > > > > > > > > > I am not able to find any reference that explains with an example of > > > R code how to perform a post hoc test with the Bonferroni procedure. > > > Can anyone provide an example to perform the same post hoc test in > > > the code above but with Bonferroni instead of Tukey? > > > > > > > > > Thank you in advance > > > > > > > > > > > > Angelo > > > > > > > > > [[alternative HTML version deleted]] > > > > > > ______________________________________________ > > > R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see > > > https://stat.ethz.ch/mailman/listinfo/r-help > > > PLEASE do read the posting guide http://www.R-project.org/posting- > > > guide.html and provide commented, minimal, self-contained, > > > reproducible code. > > > > > > > > > > [[alternative HTML version deleted]] > > > > ______________________________________________ > > R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see > > https://stat.ethz.ch/mailman/listinfo/r-help > > PLEASE do read the posting guide > > http://www.R-project.org/posting-guide.html > > and provide commented, minimal, self-contained, reproducible code.