abhivij
abhivij

Reputation: 107

cut off points for p-value in wilcox_test

I'm using wilcox_test to perform stats on a grouped bar plot. https://rpkgs.datanovia.com/rstatix/reference/wilcox_test.html

What are the cutoff points for determining the asterisks in p.adj.signif ?

Tried checking here (https://github.com/kassambara/rstatix/blob/master/R/wilcox_test.R), but couldn't really spot the code that does this.

A similar function compare_means have symbols meaning the following

ns: p > 0.05

*: p <= 0.05

**: p <= 0.01

***: p <= 0.001

****: p <= 0.0001

Does the same apply to wilcox_test ? Could you please provide the source ?

Upvotes: 0

Views: 252

Answers (1)

user18309711
user18309711

Reputation:

In short: ?rstatix:::add_significance

There's probably a more efficient way to find out, but this worked for me:

  • inspect the wrapper function wilcox_test:
library(rstatix)
wilcox_test

The output

function (data, formula, comparisons = NULL, ref.group = NULL, 
          ## ...
          test.func <- pairwise_two_sample_test
          ## ...
}

shows that at some point work is delegated to an underlying function pairwise_two_sample_test. What's this function?:

?pairwise_two_sample_test

No documentation for 'pairwise_two_sample_test' in specified packages and libraries:
you could try '??pairwise_two_sample_test'

Oops. No documentation found.

  • Enter the triple colon to expose a package's hidden functions:
rstatix:::pairwise_two_sample_test

output:

function (data, formula, method = "t.test", ref.group = NULL, 
    detailed = FALSE, ...) 
{
## ...
    res <- compare_pairs(data, formula, comparisons, method, 
        detailed = detailed, ...) %>% adjust_pvalue(method = p.adjust.method) %>% 
        add_significance() %>% p_round(digits = 3)
## ...
}

^^^ that add_significance part sounds promising.

  • inspect hidden function add_significance (again: use triple colon)
rstatix:::add_significance

ta-daa!

function (data, p.col = NULL, output.col = NULL,
          cutpoints = c(0, 1e-04, 0.001, 0.01, 0.05, 1),
          symbols = c("****", "***", "**", "*", "ns")) 
{
## ...
}

Upvotes: 4

Related Questions