Skip to content

Error in contrasts adding bonferroni adjustment

2 messages · Laura Coco, Patrick (Malone Quantitative)

#
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
#
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: