Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Show exact p value in comparisons #137

Open
Hemantcnaik opened this issue May 14, 2024 · 3 comments
Open

Show exact p value in comparisons #137

Hemantcnaik opened this issue May 14, 2024 · 3 comments

Comments

@Hemantcnaik
Copy link

Hemantcnaik commented May 14, 2024

In example with below

ggplot(diamonds, aes(x = cut, y = carat)) +
  geom_boxplot(aes(fill = color)) +
  geom_signif(comparisons = list(
    c("Fair", "Good"),
    c("Very Good", "Ideal")
  )) +
  facet_wrap(~color) +
  ylim(NA, 6.3)

P value mentioned in D section p <2.22e-16 I want show exact values instead of this value

Thank you

@IndrajeetPatil
Copy link
Collaborator

Are you sure you want to such small value?
Because the exact value is going to be smaller than 0.0000000000000002220000000000000081787.

@Hemantcnaik
Copy link
Author

Hemantcnaik commented May 14, 2024

p < 2.2e-16 as the p value would indicate a significant result, meaning that the actual p value is even smaller than 2.2e-16 i just want exact value show in figures. In papers which I checked I am not getting anyone representing like this so want to represent exact values

@IndrajeetPatil
Copy link
Collaborator

It's basically printing what the Wilcox test produces, but, yes, we can probably try to show the exact p-value if available:

library(ggplot2)
m <- wilcox.test(carat ~ cut, data = dplyr::filter(diamonds, color == "D", cut %in% c("Very Good", "Ideal")))

m
#> 
#>  Wilcoxon rank sum test with continuity correction
#> 
#> data:  carat by cut
#> W = 2554244, p-value < 2.2e-16
#> alternative hypothesis: true location shift is not equal to 0

m$p.value
#> [1] 2.122043e-25
broom::tidy(m)   
#> # A tibble: 1 × 4
#>   statistic  p.value method                                          alternative
#>       <dbl>    <dbl> <chr>                                           <chr>      
#> 1   2554244 2.12e-25 Wilcoxon rank sum test with continuity correct… two.sided

Created on 2024-05-14 with reprex v2.1.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants