const-ae/ggsignif

I want to do paired wilcoxon test,where should I put my parameters of "paired"

Closed this issue · 2 comments

q <- ggplot(zymo, aes(Method, concentrition, fill = Method))+geom_boxplot() + geom_signif(comparisons = compaired,step_increase = 0.5,map_signif_level = F, test = wilcox.test)
I notice the "test.args " ,but I still wonder how to use it or how to have a paired wilcoxon test?
thanks a lot!

Hi,

here is some example code that should clarify how to use the test.args argument:

a <- rnorm(n = 10, mean = 5, sd = 1)
b <- rnorm(n = 10, mean = 5.8, sd = 1)

wilcox.test(a, b, paired = TRUE)
#> 
#>  Wilcoxon signed rank test
#> 
#> data:  a and b
#> V = 14, p-value = 0.1934
#> alternative hypothesis: true location shift is not equal to 0


library(tidyverse)
library(ggsignif)

data.frame(label = c(rep("A", 10), rep("B", 10)),
           id = c(1:10, 1:10), 
           value = c(a, b)) %>%
     ggplot(aes(x = label, y = value, group = id)) +
         geom_point() + 
         geom_line() + 
         geom_signif(comparison = list(c("A", "B")), 
                     test = "wilcox.test", test.args = list(paired = TRUE))

That's it ! Thanks a lot~