Hello I am trying to add a Bonferroni adjustment to two comparisons, and I'm getting an error msg. The contrasts run just fine; I used a contrast matrix with dummy variables: Experimental vs Control at post1 (first contrast) and Experimental vs Control at post2 (second contrast). contrast.outcome <-contrast(emmeans.outcome, method list("experimental_post1 - control_post1" = c(1, 0, -1, 0), "experimental_post2 - control_post2" = c(0, 1, 0, -1), adjust = "bonf")) The code runs except when I add the adjust = "bonf" - The error is "Error in tcmat %*% linfct : requires numeric/complex matrix/vector arguments" I see many tutorials online about adjusting in pairwise comparisons and ANOVA but not in this situation. Any guidance you can provide would be much appreciated. Thank you! Laura [[alternative HTML version deleted]]
Patrick (Malone Quantitative)
2021-Jan-09 12:57 UTC
[R] Error in contrasts adding bonferroni adjustment
Looks like a misplaced right parenthesis. Try contrast.outcome <-contrast(emmeans.outcome, method list("experimental_post1 - control_post1" = c(1, 0, -1, 0), "experimental_post2 - control_post2" = c(0, 1, 0, -1)), adjust = "bonf") Pat On Sat, Jan 9, 2021 at 3:10 AM Laura Coco <lauracoco at gmail.com> wrote:> > Hello > > I am trying to add a Bonferroni adjustment to two comparisons, and I'm > getting an error msg. > > The contrasts run just fine; I used a contrast matrix with dummy > variables: Experimental > vs Control at post1 (first contrast) and Experimental vs Control at post2 > (second contrast). > > contrast.outcome <-contrast(emmeans.outcome, method > list("experimental_post1 - control_post1" = c(1, 0, -1, 0), > "experimental_post2 - control_post2" = c(0, 1, 0, -1), adjust = "bonf")) > > The code runs except when I add the adjust = "bonf" - The error is "Error > in tcmat %*% linfct : requires numeric/complex matrix/vector arguments" > > I see many tutorials online about adjusting in pairwise comparisons and > ANOVA but not in this situation. Any guidance you can provide would be much > appreciated. > > Thank you! > > Laura > > [[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.-- Patrick S. Malone, Ph.D., Malone Quantitative NEW Service Models: http://malonequantitative.com He/Him/His