why gt summary gives me 2 different p-values

I try to get some tables with tbl_summary but if I don't specify which test I want to use in add_p() it gives me a p value and if I specify that I want to use the 'fisher.test' or the "chisq.test" it gives me other values, which is strange because according to the vignette the default test is chisq.test.

Does anyone know which test can be used or why I get this difference?

Thank you very much.

This is what I get with default test

df %>%
  select(a, b) %>%
  tbl_summary(by= b,
              missing = "always") %>%
  add_p() %>%
  add_overall() %>%
  as_tibble()

This is what I get with "chisq.test"

df %>%
    select(a, b) %>%
    tbl_summary(by= b,
                missing = "always") %>%
    add_p(list(everything() ~ "chisq.test")) %>%
    add_overall() %>%
    as_tibble()

This is what I get with "fisher.test"

df %>%
    select(a, b) %>%
    tbl_summary(by= b,
                missing = "always") %>%
    add_p(list(everything() ~ "fisher.test")) %>%
    add_overall() %>%
    as_tibble() 

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.