I am a beginner in R and do not understand why pairwise_t_test() from the rstatix package does not show the t-value and cohen's d.
pairwise_t_test(data = filtered_normdata, BZO_RWgesamt ~ Alter, p.adjust.method = "none")
# A tibble: 36 × 9
.y. group1 group2 n1 n2 p p.signif p.adj p.adj.signif
* <chr> <chr> <chr> <int> <int> <dbl> <chr> <dbl> <chr>
1 BZO_RWge… 11 12 95 90 4.26e- 2 * 4.26e- 2 *
2 BZO_RWge… 11 13 95 90 6.17e- 5 **** 6.17e- 5 ****
3 BZO_RWge… 12 13 90 90 4.85e- 2 * 4.85e- 2 *
4 BZO_RWge… 11 14 95 74 4.85e- 9 **** 4.85e- 9 ****
5 BZO_RWge… 12 14 90 74 8.21e- 5 **** 8.21e- 5 ****
6 BZO_RWge… 13 14 90 74 3.72e- 2 * 3.72e- 2 *
7 BZO_RWge… 11 15 95 68 8.39e-18 **** 8.39e-18 ****
8 BZO_RWge… 12 15 90 68 1.22e-11 **** 1.22e-11 ****
9 BZO_RWge… 13 15 90 68 5 e- 7 **** 5 e- 7 ****
10 BZO_RWge… 14 15 74 68 3.73e- 3 ** 3.73e- 3 **
# ℹ 26 more rows
# ℹ Use `print(n = ...)` to see more rows
I already tried to get the statistic and estimate like this:
BZO_H2_w <- pairwise_t_test(data = filtered_normdata, BZO_RWgesamt ~ Alter, p.adjust.method = "none")
BZO_H2_w$estimate and BZO_H2_w$statistic
but it didn't work. I would be really thankful if someone can help me :)
If it's the function from
rstatixthat you are asking about then it only seems to return the full detail of the tests if you request not to use a pooled standard deviation for the t-tests (pool.sd=FALSE).If you look at the code,
pairwise_t_testcalls the R functionstats::pairwise.t.testwhen you use a pooled SD, but uses a repeated application ofstats::t.testwhenpool.sd=FALSE. It then usesbroom::tidyto collate the statistics into a table.So I don't think there's a good statistical reason for the difference in reporting, it just relies on different base functions, and while the R function
t.testdoes return the t-statistic etc,pairwise.t.testonly returns a matrix of p-values.You can get the detail of the pairwise t-tests with pooled SD if you use
lmto get a linear model (ANOVA) thenemmeansto get the pairwise contrasts. Note the p-values fromemmeansare the same as frompairwise.t.testwith the pooled SD, but it returns the estimate and statistic as well.So, with some toy data: