0

Do you happen to know how to add a column with p-value when comparing means using tab_stat_mean_ds_n() from the expss package? The tab_significance_options() offer a lot of modifications but I can't find anything to add just extra column with p-values.

Thanks

1 Answers1

0

I am an author of the expss package. Sorry, but currently there is no such functionality as adding column with p-value. There are a lot of cases when column significant differs from many other columns. See simple example below. I don't know how to add columns with p-value in a sensible way in the such circumstances. If you can provide nice table examples with multiple p-value columns I will consider to add such option in the future version of the package.

library(expss)
data(mtcars)

mtcars = apply_labels(mtcars,
                      mpg = "Miles/(US) gallon",
                      cyl = "Number of cylinders"
)

mtcars %>% 
    tab_cells(mpg) %>% 
    tab_cols(cyl) %>% 
    tab_stat_mean_sd_n() %>% 
    tab_pivot() %>% 
    significance_means()

# |                   |              | Number of cylinders |        |      |
# |                   |              |                   4 |      6 |    8 |
# |                   |              |                   A |      B |    C |
# | ----------------- | ------------ | ------------------- | ------ | ---- |
# | Miles/(US) gallon |         Mean |            26.7 B C | 19.7 C | 15.1 |
# |                   |    Std. dev. |             4.5     |  1.5   |  2.6 |
# |                   | Unw. valid N |            11.0     |  7.0   | 14.0 |
Gregory Demin
  • 4,596
  • 2
  • 20
  • 20
  • Thank you for reply! I was actually thinking of the most simple solution. If there are multiple categories (e.g. Number of Cylinders), the p-value would be from the F-test, and if there are just two categories, from the t-test. Following your example, there could be additional column (to the right) with p-value. I know that given example shows the significant differences between groups (e.g. multiple testing), but my request is to show overall test result. – Przemek Jura Dec 21 '20 at 20:05