Animated violin/boxplots plots with p-values for paired Wilcoxon tests












3















I am trying to add p values for paired wilcox test in R. I am using the following code. The code below creates violins (density distributions) of an outcome reading (bicep) for two diets (treatment). These violins are animated over time 1, time 2, time 3. And the top of the graph prints p-values. I would like these p-values to be paired values such that



For Diet 'a' Bicep reading at time 2 is compared to time 1, and bicep reading at time 3 is compared to time 1.



And the same for Diet 'b'. So, there should be two separate p-values printed on top of the violins at time 2 and time 3. Indicating paired tests (Time 2 vs Time 1 and Time 3 vs Time 1) for both Diet 'a' and Diet 'b'.



What should be the correct code for this test? I have tried something here below based on a suggestion I got yesterday, but I ran into an error. I also think the code below just does paired tests for Time 2 vs Time 1, and Time 3 vs Time 2. Which is not what I want.



Thanks for reading.



 library(ggplot2)
library(ggpubr)
library(gganimate)
library(tidyverse)


Example Data



 structure(list(code = c(1L, 1L, 1L, 2L, 2L, 2L, 3L, 3L, 3L, 4L, 
4L, 4L, 5L, 5L, 5L, 6L, 6L, 6L, 7L, 7L, 7L, 8L, 8L, 8L), diet = c("a",
"a", "a", "b", "b", "b", "a", "a", "a", "b", "b", "b", "a", "a",
"a", "b", "b", "b", "a", "a", "a", "b", "b", "b"), time = c(1L,
2L, 3L, 1L, 2L, 3L, 1L, 2L, 3L, 1L, 2L, 3L, 1L, 2L, 3L, 1L, 2L,
3L, 1L, 2L, 3L, 1L, 2L, 3L), bicep = c(8L, 7L, 7L, 9L, 9L, 9L,
11L, 10L, 9L, 11L, 11L, 12L, 12L, 11L, 10L, 9L, 9L, 9L, 12L,
10L, 8L, 12L, 12L, 12L)), class = "data.frame", row.names = c(NA,
-24L))


Example Code



example3 %>%
group_by(time) %>%
mutate(p=pairwise.wilcox.test(example3$bicep, interaction(example3$diet, example3$time), p.adjust.method = "none")$p.value,
max=max(bicep, na.rm = T)) %>%
ggplot() +
geom_violin(aes(x=diet, y=bicep, fill=diet)) +
geom_text(data = . %>% distinct(p, max, time),
aes(x=1.5, y = max+.5, label=as.character(round(p,2))),
size=12) +
transition_time(time) +
ease_aes('linear')


This is the error I get



 Error in mutate_impl(.data, dots) : 
Column `p` must be length 8 (the group size) or one, not 25
In addition: There were 15 warnings (use warnings() to see them)









share|improve this question





























    3















    I am trying to add p values for paired wilcox test in R. I am using the following code. The code below creates violins (density distributions) of an outcome reading (bicep) for two diets (treatment). These violins are animated over time 1, time 2, time 3. And the top of the graph prints p-values. I would like these p-values to be paired values such that



    For Diet 'a' Bicep reading at time 2 is compared to time 1, and bicep reading at time 3 is compared to time 1.



    And the same for Diet 'b'. So, there should be two separate p-values printed on top of the violins at time 2 and time 3. Indicating paired tests (Time 2 vs Time 1 and Time 3 vs Time 1) for both Diet 'a' and Diet 'b'.



    What should be the correct code for this test? I have tried something here below based on a suggestion I got yesterday, but I ran into an error. I also think the code below just does paired tests for Time 2 vs Time 1, and Time 3 vs Time 2. Which is not what I want.



    Thanks for reading.



     library(ggplot2)
    library(ggpubr)
    library(gganimate)
    library(tidyverse)


    Example Data



     structure(list(code = c(1L, 1L, 1L, 2L, 2L, 2L, 3L, 3L, 3L, 4L, 
    4L, 4L, 5L, 5L, 5L, 6L, 6L, 6L, 7L, 7L, 7L, 8L, 8L, 8L), diet = c("a",
    "a", "a", "b", "b", "b", "a", "a", "a", "b", "b", "b", "a", "a",
    "a", "b", "b", "b", "a", "a", "a", "b", "b", "b"), time = c(1L,
    2L, 3L, 1L, 2L, 3L, 1L, 2L, 3L, 1L, 2L, 3L, 1L, 2L, 3L, 1L, 2L,
    3L, 1L, 2L, 3L, 1L, 2L, 3L), bicep = c(8L, 7L, 7L, 9L, 9L, 9L,
    11L, 10L, 9L, 11L, 11L, 12L, 12L, 11L, 10L, 9L, 9L, 9L, 12L,
    10L, 8L, 12L, 12L, 12L)), class = "data.frame", row.names = c(NA,
    -24L))


    Example Code



    example3 %>%
    group_by(time) %>%
    mutate(p=pairwise.wilcox.test(example3$bicep, interaction(example3$diet, example3$time), p.adjust.method = "none")$p.value,
    max=max(bicep, na.rm = T)) %>%
    ggplot() +
    geom_violin(aes(x=diet, y=bicep, fill=diet)) +
    geom_text(data = . %>% distinct(p, max, time),
    aes(x=1.5, y = max+.5, label=as.character(round(p,2))),
    size=12) +
    transition_time(time) +
    ease_aes('linear')


    This is the error I get



     Error in mutate_impl(.data, dots) : 
    Column `p` must be length 8 (the group size) or one, not 25
    In addition: There were 15 warnings (use warnings() to see them)









    share|improve this question



























      3












      3








      3


      1






      I am trying to add p values for paired wilcox test in R. I am using the following code. The code below creates violins (density distributions) of an outcome reading (bicep) for two diets (treatment). These violins are animated over time 1, time 2, time 3. And the top of the graph prints p-values. I would like these p-values to be paired values such that



      For Diet 'a' Bicep reading at time 2 is compared to time 1, and bicep reading at time 3 is compared to time 1.



      And the same for Diet 'b'. So, there should be two separate p-values printed on top of the violins at time 2 and time 3. Indicating paired tests (Time 2 vs Time 1 and Time 3 vs Time 1) for both Diet 'a' and Diet 'b'.



      What should be the correct code for this test? I have tried something here below based on a suggestion I got yesterday, but I ran into an error. I also think the code below just does paired tests for Time 2 vs Time 1, and Time 3 vs Time 2. Which is not what I want.



      Thanks for reading.



       library(ggplot2)
      library(ggpubr)
      library(gganimate)
      library(tidyverse)


      Example Data



       structure(list(code = c(1L, 1L, 1L, 2L, 2L, 2L, 3L, 3L, 3L, 4L, 
      4L, 4L, 5L, 5L, 5L, 6L, 6L, 6L, 7L, 7L, 7L, 8L, 8L, 8L), diet = c("a",
      "a", "a", "b", "b", "b", "a", "a", "a", "b", "b", "b", "a", "a",
      "a", "b", "b", "b", "a", "a", "a", "b", "b", "b"), time = c(1L,
      2L, 3L, 1L, 2L, 3L, 1L, 2L, 3L, 1L, 2L, 3L, 1L, 2L, 3L, 1L, 2L,
      3L, 1L, 2L, 3L, 1L, 2L, 3L), bicep = c(8L, 7L, 7L, 9L, 9L, 9L,
      11L, 10L, 9L, 11L, 11L, 12L, 12L, 11L, 10L, 9L, 9L, 9L, 12L,
      10L, 8L, 12L, 12L, 12L)), class = "data.frame", row.names = c(NA,
      -24L))


      Example Code



      example3 %>%
      group_by(time) %>%
      mutate(p=pairwise.wilcox.test(example3$bicep, interaction(example3$diet, example3$time), p.adjust.method = "none")$p.value,
      max=max(bicep, na.rm = T)) %>%
      ggplot() +
      geom_violin(aes(x=diet, y=bicep, fill=diet)) +
      geom_text(data = . %>% distinct(p, max, time),
      aes(x=1.5, y = max+.5, label=as.character(round(p,2))),
      size=12) +
      transition_time(time) +
      ease_aes('linear')


      This is the error I get



       Error in mutate_impl(.data, dots) : 
      Column `p` must be length 8 (the group size) or one, not 25
      In addition: There were 15 warnings (use warnings() to see them)









      share|improve this question
















      I am trying to add p values for paired wilcox test in R. I am using the following code. The code below creates violins (density distributions) of an outcome reading (bicep) for two diets (treatment). These violins are animated over time 1, time 2, time 3. And the top of the graph prints p-values. I would like these p-values to be paired values such that



      For Diet 'a' Bicep reading at time 2 is compared to time 1, and bicep reading at time 3 is compared to time 1.



      And the same for Diet 'b'. So, there should be two separate p-values printed on top of the violins at time 2 and time 3. Indicating paired tests (Time 2 vs Time 1 and Time 3 vs Time 1) for both Diet 'a' and Diet 'b'.



      What should be the correct code for this test? I have tried something here below based on a suggestion I got yesterday, but I ran into an error. I also think the code below just does paired tests for Time 2 vs Time 1, and Time 3 vs Time 2. Which is not what I want.



      Thanks for reading.



       library(ggplot2)
      library(ggpubr)
      library(gganimate)
      library(tidyverse)


      Example Data



       structure(list(code = c(1L, 1L, 1L, 2L, 2L, 2L, 3L, 3L, 3L, 4L, 
      4L, 4L, 5L, 5L, 5L, 6L, 6L, 6L, 7L, 7L, 7L, 8L, 8L, 8L), diet = c("a",
      "a", "a", "b", "b", "b", "a", "a", "a", "b", "b", "b", "a", "a",
      "a", "b", "b", "b", "a", "a", "a", "b", "b", "b"), time = c(1L,
      2L, 3L, 1L, 2L, 3L, 1L, 2L, 3L, 1L, 2L, 3L, 1L, 2L, 3L, 1L, 2L,
      3L, 1L, 2L, 3L, 1L, 2L, 3L), bicep = c(8L, 7L, 7L, 9L, 9L, 9L,
      11L, 10L, 9L, 11L, 11L, 12L, 12L, 11L, 10L, 9L, 9L, 9L, 12L,
      10L, 8L, 12L, 12L, 12L)), class = "data.frame", row.names = c(NA,
      -24L))


      Example Code



      example3 %>%
      group_by(time) %>%
      mutate(p=pairwise.wilcox.test(example3$bicep, interaction(example3$diet, example3$time), p.adjust.method = "none")$p.value,
      max=max(bicep, na.rm = T)) %>%
      ggplot() +
      geom_violin(aes(x=diet, y=bicep, fill=diet)) +
      geom_text(data = . %>% distinct(p, max, time),
      aes(x=1.5, y = max+.5, label=as.character(round(p,2))),
      size=12) +
      transition_time(time) +
      ease_aes('linear')


      This is the error I get



       Error in mutate_impl(.data, dots) : 
      Column `p` must be length 8 (the group size) or one, not 25
      In addition: There were 15 warnings (use warnings() to see them)






      r ggplot2 dplyr gganimate ggpubr






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Nov 21 '18 at 17:37







      DiscoR

















      asked Nov 20 '18 at 17:33









      DiscoRDiscoR

      1179




      1179
























          1 Answer
          1






          active

          oldest

          votes


















          0














          If I understand you problem right then there is very easy solution. You got this error because of wrong syntax inside mutate. There is no need to call for values with $ when you using mutate and pipes %>%:



          This code gives a desired animation with minor warnings:



          example3 %>%
          group_by(time) %>%
          mutate(p=pairwise.wilcox.test(bicep, interaction(diet, time), p.adjust.method = "none")$p.value,
          max=max(bicep, na.rm = T)) %>%
          ggplot() +
          geom_violin(aes(x=diet, y=bicep, fill=diet)) +
          geom_text(data = . %>% distinct(p, max, time),
          aes(x=1.5, y = max+.5, label=as.character(round(p,2))),
          size=12) +
          transition_time(time) +
          ease_aes('linear')


          enter image description here



          UPDATE



          In case of independent p-values you just need to add facet_wrap(), for example. It seems to be the easiest:



          example3 %>%
          group_by(time) %>%
          mutate(p = pairwise.wilcox.test(bicep, interaction(diet, time), p.adjust.method = "none")$p.value,
          max = max(bicep, na.rm = T)) %>%
          ggplot() +
          geom_violin(aes(x = diet, y = bicep, fill = diet)) +
          geom_text(data = . %>% distinct(p, max, time),
          aes(x = 1, y = max+.5, label = as.character(round(p,2))),
          size = 12) +
          facet_wrap(~diet, scales = "free_x") + # add facets
          theme(legend.position = "none") +
          transition_time(time) +
          ease_aes('linear')


          enter image description here






          share|improve this answer


























          • Thanks! I am looking for a solution where there would be two individual p-values for paired tests printed on top of the two violins.

            – DiscoR
            Nov 22 '18 at 16:20











          • Let me clarify a little more. This works but I am looking for a solution where there would be two individual p-values for paired tests printed on top of the two violins. a) paired tests for diet 'a'; Time 3 vs Time 1, and b) paired test for diet 'b' for Time 3 vs Time 1.

            – DiscoR
            Nov 22 '18 at 16:27











          • @DiscoR I've just updated the answer. Take a look. However, the p-value are equal for both a and b. So I can't see the point

            – atsyplenkov
            Nov 22 '18 at 19:30








          • 1





            Thanks, this somewhat solves the problem. The point for having two separate p values is that I am doing a paired wilcoxon test where means of one group at time 3 are compared to means of the same group at time 1. And the same for the other group. So this should result in two separate paired tests. Test 1: Means of Bicep at Time 1 on Diet A compared to Mean of Bicep at Time 12 on Diet A. Test 2: Means of Bicep at Time 1 on Diet B compared to Mean of Bicep at Time 12 on Diet B.

            – DiscoR
            Nov 23 '18 at 16:37













          Your Answer






          StackExchange.ifUsing("editor", function () {
          StackExchange.using("externalEditor", function () {
          StackExchange.using("snippets", function () {
          StackExchange.snippets.init();
          });
          });
          }, "code-snippets");

          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "1"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53398475%2fanimated-violin-boxplots-plots-with-p-values-for-paired-wilcoxon-tests%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          0














          If I understand you problem right then there is very easy solution. You got this error because of wrong syntax inside mutate. There is no need to call for values with $ when you using mutate and pipes %>%:



          This code gives a desired animation with minor warnings:



          example3 %>%
          group_by(time) %>%
          mutate(p=pairwise.wilcox.test(bicep, interaction(diet, time), p.adjust.method = "none")$p.value,
          max=max(bicep, na.rm = T)) %>%
          ggplot() +
          geom_violin(aes(x=diet, y=bicep, fill=diet)) +
          geom_text(data = . %>% distinct(p, max, time),
          aes(x=1.5, y = max+.5, label=as.character(round(p,2))),
          size=12) +
          transition_time(time) +
          ease_aes('linear')


          enter image description here



          UPDATE



          In case of independent p-values you just need to add facet_wrap(), for example. It seems to be the easiest:



          example3 %>%
          group_by(time) %>%
          mutate(p = pairwise.wilcox.test(bicep, interaction(diet, time), p.adjust.method = "none")$p.value,
          max = max(bicep, na.rm = T)) %>%
          ggplot() +
          geom_violin(aes(x = diet, y = bicep, fill = diet)) +
          geom_text(data = . %>% distinct(p, max, time),
          aes(x = 1, y = max+.5, label = as.character(round(p,2))),
          size = 12) +
          facet_wrap(~diet, scales = "free_x") + # add facets
          theme(legend.position = "none") +
          transition_time(time) +
          ease_aes('linear')


          enter image description here






          share|improve this answer


























          • Thanks! I am looking for a solution where there would be two individual p-values for paired tests printed on top of the two violins.

            – DiscoR
            Nov 22 '18 at 16:20











          • Let me clarify a little more. This works but I am looking for a solution where there would be two individual p-values for paired tests printed on top of the two violins. a) paired tests for diet 'a'; Time 3 vs Time 1, and b) paired test for diet 'b' for Time 3 vs Time 1.

            – DiscoR
            Nov 22 '18 at 16:27











          • @DiscoR I've just updated the answer. Take a look. However, the p-value are equal for both a and b. So I can't see the point

            – atsyplenkov
            Nov 22 '18 at 19:30








          • 1





            Thanks, this somewhat solves the problem. The point for having two separate p values is that I am doing a paired wilcoxon test where means of one group at time 3 are compared to means of the same group at time 1. And the same for the other group. So this should result in two separate paired tests. Test 1: Means of Bicep at Time 1 on Diet A compared to Mean of Bicep at Time 12 on Diet A. Test 2: Means of Bicep at Time 1 on Diet B compared to Mean of Bicep at Time 12 on Diet B.

            – DiscoR
            Nov 23 '18 at 16:37


















          0














          If I understand you problem right then there is very easy solution. You got this error because of wrong syntax inside mutate. There is no need to call for values with $ when you using mutate and pipes %>%:



          This code gives a desired animation with minor warnings:



          example3 %>%
          group_by(time) %>%
          mutate(p=pairwise.wilcox.test(bicep, interaction(diet, time), p.adjust.method = "none")$p.value,
          max=max(bicep, na.rm = T)) %>%
          ggplot() +
          geom_violin(aes(x=diet, y=bicep, fill=diet)) +
          geom_text(data = . %>% distinct(p, max, time),
          aes(x=1.5, y = max+.5, label=as.character(round(p,2))),
          size=12) +
          transition_time(time) +
          ease_aes('linear')


          enter image description here



          UPDATE



          In case of independent p-values you just need to add facet_wrap(), for example. It seems to be the easiest:



          example3 %>%
          group_by(time) %>%
          mutate(p = pairwise.wilcox.test(bicep, interaction(diet, time), p.adjust.method = "none")$p.value,
          max = max(bicep, na.rm = T)) %>%
          ggplot() +
          geom_violin(aes(x = diet, y = bicep, fill = diet)) +
          geom_text(data = . %>% distinct(p, max, time),
          aes(x = 1, y = max+.5, label = as.character(round(p,2))),
          size = 12) +
          facet_wrap(~diet, scales = "free_x") + # add facets
          theme(legend.position = "none") +
          transition_time(time) +
          ease_aes('linear')


          enter image description here






          share|improve this answer


























          • Thanks! I am looking for a solution where there would be two individual p-values for paired tests printed on top of the two violins.

            – DiscoR
            Nov 22 '18 at 16:20











          • Let me clarify a little more. This works but I am looking for a solution where there would be two individual p-values for paired tests printed on top of the two violins. a) paired tests for diet 'a'; Time 3 vs Time 1, and b) paired test for diet 'b' for Time 3 vs Time 1.

            – DiscoR
            Nov 22 '18 at 16:27











          • @DiscoR I've just updated the answer. Take a look. However, the p-value are equal for both a and b. So I can't see the point

            – atsyplenkov
            Nov 22 '18 at 19:30








          • 1





            Thanks, this somewhat solves the problem. The point for having two separate p values is that I am doing a paired wilcoxon test where means of one group at time 3 are compared to means of the same group at time 1. And the same for the other group. So this should result in two separate paired tests. Test 1: Means of Bicep at Time 1 on Diet A compared to Mean of Bicep at Time 12 on Diet A. Test 2: Means of Bicep at Time 1 on Diet B compared to Mean of Bicep at Time 12 on Diet B.

            – DiscoR
            Nov 23 '18 at 16:37
















          0












          0








          0







          If I understand you problem right then there is very easy solution. You got this error because of wrong syntax inside mutate. There is no need to call for values with $ when you using mutate and pipes %>%:



          This code gives a desired animation with minor warnings:



          example3 %>%
          group_by(time) %>%
          mutate(p=pairwise.wilcox.test(bicep, interaction(diet, time), p.adjust.method = "none")$p.value,
          max=max(bicep, na.rm = T)) %>%
          ggplot() +
          geom_violin(aes(x=diet, y=bicep, fill=diet)) +
          geom_text(data = . %>% distinct(p, max, time),
          aes(x=1.5, y = max+.5, label=as.character(round(p,2))),
          size=12) +
          transition_time(time) +
          ease_aes('linear')


          enter image description here



          UPDATE



          In case of independent p-values you just need to add facet_wrap(), for example. It seems to be the easiest:



          example3 %>%
          group_by(time) %>%
          mutate(p = pairwise.wilcox.test(bicep, interaction(diet, time), p.adjust.method = "none")$p.value,
          max = max(bicep, na.rm = T)) %>%
          ggplot() +
          geom_violin(aes(x = diet, y = bicep, fill = diet)) +
          geom_text(data = . %>% distinct(p, max, time),
          aes(x = 1, y = max+.5, label = as.character(round(p,2))),
          size = 12) +
          facet_wrap(~diet, scales = "free_x") + # add facets
          theme(legend.position = "none") +
          transition_time(time) +
          ease_aes('linear')


          enter image description here






          share|improve this answer















          If I understand you problem right then there is very easy solution. You got this error because of wrong syntax inside mutate. There is no need to call for values with $ when you using mutate and pipes %>%:



          This code gives a desired animation with minor warnings:



          example3 %>%
          group_by(time) %>%
          mutate(p=pairwise.wilcox.test(bicep, interaction(diet, time), p.adjust.method = "none")$p.value,
          max=max(bicep, na.rm = T)) %>%
          ggplot() +
          geom_violin(aes(x=diet, y=bicep, fill=diet)) +
          geom_text(data = . %>% distinct(p, max, time),
          aes(x=1.5, y = max+.5, label=as.character(round(p,2))),
          size=12) +
          transition_time(time) +
          ease_aes('linear')


          enter image description here



          UPDATE



          In case of independent p-values you just need to add facet_wrap(), for example. It seems to be the easiest:



          example3 %>%
          group_by(time) %>%
          mutate(p = pairwise.wilcox.test(bicep, interaction(diet, time), p.adjust.method = "none")$p.value,
          max = max(bicep, na.rm = T)) %>%
          ggplot() +
          geom_violin(aes(x = diet, y = bicep, fill = diet)) +
          geom_text(data = . %>% distinct(p, max, time),
          aes(x = 1, y = max+.5, label = as.character(round(p,2))),
          size = 12) +
          facet_wrap(~diet, scales = "free_x") + # add facets
          theme(legend.position = "none") +
          transition_time(time) +
          ease_aes('linear')


          enter image description here







          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Nov 22 '18 at 19:28

























          answered Nov 22 '18 at 10:22









          atsyplenkovatsyplenkov

          160111




          160111













          • Thanks! I am looking for a solution where there would be two individual p-values for paired tests printed on top of the two violins.

            – DiscoR
            Nov 22 '18 at 16:20











          • Let me clarify a little more. This works but I am looking for a solution where there would be two individual p-values for paired tests printed on top of the two violins. a) paired tests for diet 'a'; Time 3 vs Time 1, and b) paired test for diet 'b' for Time 3 vs Time 1.

            – DiscoR
            Nov 22 '18 at 16:27











          • @DiscoR I've just updated the answer. Take a look. However, the p-value are equal for both a and b. So I can't see the point

            – atsyplenkov
            Nov 22 '18 at 19:30








          • 1





            Thanks, this somewhat solves the problem. The point for having two separate p values is that I am doing a paired wilcoxon test where means of one group at time 3 are compared to means of the same group at time 1. And the same for the other group. So this should result in two separate paired tests. Test 1: Means of Bicep at Time 1 on Diet A compared to Mean of Bicep at Time 12 on Diet A. Test 2: Means of Bicep at Time 1 on Diet B compared to Mean of Bicep at Time 12 on Diet B.

            – DiscoR
            Nov 23 '18 at 16:37





















          • Thanks! I am looking for a solution where there would be two individual p-values for paired tests printed on top of the two violins.

            – DiscoR
            Nov 22 '18 at 16:20











          • Let me clarify a little more. This works but I am looking for a solution where there would be two individual p-values for paired tests printed on top of the two violins. a) paired tests for diet 'a'; Time 3 vs Time 1, and b) paired test for diet 'b' for Time 3 vs Time 1.

            – DiscoR
            Nov 22 '18 at 16:27











          • @DiscoR I've just updated the answer. Take a look. However, the p-value are equal for both a and b. So I can't see the point

            – atsyplenkov
            Nov 22 '18 at 19:30








          • 1





            Thanks, this somewhat solves the problem. The point for having two separate p values is that I am doing a paired wilcoxon test where means of one group at time 3 are compared to means of the same group at time 1. And the same for the other group. So this should result in two separate paired tests. Test 1: Means of Bicep at Time 1 on Diet A compared to Mean of Bicep at Time 12 on Diet A. Test 2: Means of Bicep at Time 1 on Diet B compared to Mean of Bicep at Time 12 on Diet B.

            – DiscoR
            Nov 23 '18 at 16:37



















          Thanks! I am looking for a solution where there would be two individual p-values for paired tests printed on top of the two violins.

          – DiscoR
          Nov 22 '18 at 16:20





          Thanks! I am looking for a solution where there would be two individual p-values for paired tests printed on top of the two violins.

          – DiscoR
          Nov 22 '18 at 16:20













          Let me clarify a little more. This works but I am looking for a solution where there would be two individual p-values for paired tests printed on top of the two violins. a) paired tests for diet 'a'; Time 3 vs Time 1, and b) paired test for diet 'b' for Time 3 vs Time 1.

          – DiscoR
          Nov 22 '18 at 16:27





          Let me clarify a little more. This works but I am looking for a solution where there would be two individual p-values for paired tests printed on top of the two violins. a) paired tests for diet 'a'; Time 3 vs Time 1, and b) paired test for diet 'b' for Time 3 vs Time 1.

          – DiscoR
          Nov 22 '18 at 16:27













          @DiscoR I've just updated the answer. Take a look. However, the p-value are equal for both a and b. So I can't see the point

          – atsyplenkov
          Nov 22 '18 at 19:30







          @DiscoR I've just updated the answer. Take a look. However, the p-value are equal for both a and b. So I can't see the point

          – atsyplenkov
          Nov 22 '18 at 19:30






          1




          1





          Thanks, this somewhat solves the problem. The point for having two separate p values is that I am doing a paired wilcoxon test where means of one group at time 3 are compared to means of the same group at time 1. And the same for the other group. So this should result in two separate paired tests. Test 1: Means of Bicep at Time 1 on Diet A compared to Mean of Bicep at Time 12 on Diet A. Test 2: Means of Bicep at Time 1 on Diet B compared to Mean of Bicep at Time 12 on Diet B.

          – DiscoR
          Nov 23 '18 at 16:37







          Thanks, this somewhat solves the problem. The point for having two separate p values is that I am doing a paired wilcoxon test where means of one group at time 3 are compared to means of the same group at time 1. And the same for the other group. So this should result in two separate paired tests. Test 1: Means of Bicep at Time 1 on Diet A compared to Mean of Bicep at Time 12 on Diet A. Test 2: Means of Bicep at Time 1 on Diet B compared to Mean of Bicep at Time 12 on Diet B.

          – DiscoR
          Nov 23 '18 at 16:37






















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53398475%2fanimated-violin-boxplots-plots-with-p-values-for-paired-wilcoxon-tests%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          mysqli_query(): Empty query in /home/lucindabrummitt/public_html/blog/wp-includes/wp-db.php on line 1924

          How to change which sound is reproduced for terminal bell?

          Can I use Tabulator js library in my java Spring + Thymeleaf project?