While reviewing pairwise t-tests as a post hoc for one way repeated measures ANOVA I noticed an oddity. The test statistic for pair_t_test in the rstatix library does not change when I pool the standard deviation -- in fact none of the output changes.
My understanding is that the whole point of pooling the standard deviation is to more accurately estimate the test statistic. However, while trying this out I can't find a difference in the output (see below).
Is my understanding incorrect? What effect should a pooled standard deviation have on multiple pairwise comparisons (sphericity notwithstanding)?
I used the following data setup:
library(rstatix)
library(tidyverse)
selfesteem.test <- selfesteem %>%
gather(key = "time", value = "score", t1, t2, t3) %>%
convert_as_factor(id, time)
With pooled standard deviation in the following code:
selfesteem.test %>%
pairwise_t_test(
score ~ time,
paired = TRUE,
p.adjust.method = "bonferroni",
pool.sd = TRUE
)
Resulting in:
# A tibble: 3 x 10
.y. group1 group2 n1 n2 statistic df p p.adj p.adj.signif
* <chr> <chr> <chr> <int> <int> <dbl> <dbl> <dbl> <dbl> <chr>
1 score t1 t2 10 10 -4.97 9 0.000772 0.002 **
2 score t1 t3 10 10 -13.2 9 0.000000334 0.000001 ****
3 score t2 t3 10 10 -4.87 9 0.000886 0.003 **
The following code:
selfesteem.test %>%
pairwise_t_test(
score ~ time,
paired = TRUE,
p.adjust.method = "bonferroni",
pool.sd = FALSE
)
Results in the same:
# A tibble: 3 x 10
.y. group1 group2 n1 n2 statistic df p p.adj p.adj.signif
* <chr> <chr> <chr> <int> <int> <dbl> <dbl> <dbl> <dbl> <chr>
1 score t1 t2 10 10 -4.97 9 0.000772 0.002 **
2 score t1 t3 10 10 -13.2 9 0.000000334 0.000001 ****
3 score t2 t3 10 10 -4.87 9 0.000886 0.003 **
According to ?pairwise_t_test
Pooling does not generalize to paired tests so pool.sd and paired cannot both be TRUE.
If pool.sd = FALSE the standard two sample t-test is applied to all possible pairs of groups. This method calls the t.test(), so extra arguments, such as var.equal are accepted.
Also, the Usage does show the negation (!
)
pairwise_t_test( data, formula, comparisons = NULL, ref.group = NULL, p.adjust.method = "holm", paired = FALSE, pool.sd = !paired, detailed = FALSE, ... )