R - pairwise_t_test 在合并标准差和非合并标准差之间切换时测试统计量不变
R - pairwise_t_test Test Statistics Unchanged When Switching Between Pooled Standard Deviation and non-Pooled Stardard Deviation
在将成对 t 检验作为 post hoc 检查单向重复测量方差分析时,我注意到了一个奇怪的地方。当我汇集标准差时,rstatix 库中 pair_t_test 的测试统计量不会改变——实际上 none 的输出发生变化。
我的理解是,汇集标准差的全部意义在于更准确地估计检验统计量。但是,在尝试这一点时,我无法在输出中找到差异(见下文)。
我的理解有误吗?合并标准偏差对多重成对比较(尽管有球形度)应该有什么影响?
我使用了以下数据设置:
library(rstatix)
library(tidyverse)
selfesteem.test <- selfesteem %>%
gather(key = "time", value = "score", t1, t2, t3) %>%
convert_as_factor(id, time)
在以下代码中使用合并标准差:
selfesteem.test %>%
pairwise_t_test(
score ~ time,
paired = TRUE,
p.adjust.method = "bonferroni",
pool.sd = TRUE
)
导致:
# 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 **
以下代码:
selfesteem.test %>%
pairwise_t_test(
score ~ time,
paired = TRUE,
p.adjust.method = "bonferroni",
pool.sd = FALSE
)
结果相同:
# 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 **
根据?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.
此外,用法确实显示了否定 (!
)
pairwise_t_test(
data,
formula,
comparisons = NULL,
ref.group = NULL,
p.adjust.method = "holm",
paired = FALSE,
pool.sd = !paired,
detailed = FALSE,
...
)
在将成对 t 检验作为 post hoc 检查单向重复测量方差分析时,我注意到了一个奇怪的地方。当我汇集标准差时,rstatix 库中 pair_t_test 的测试统计量不会改变——实际上 none 的输出发生变化。
我的理解是,汇集标准差的全部意义在于更准确地估计检验统计量。但是,在尝试这一点时,我无法在输出中找到差异(见下文)。
我的理解有误吗?合并标准偏差对多重成对比较(尽管有球形度)应该有什么影响?
我使用了以下数据设置:
library(rstatix)
library(tidyverse)
selfesteem.test <- selfesteem %>%
gather(key = "time", value = "score", t1, t2, t3) %>%
convert_as_factor(id, time)
在以下代码中使用合并标准差:
selfesteem.test %>%
pairwise_t_test(
score ~ time,
paired = TRUE,
p.adjust.method = "bonferroni",
pool.sd = TRUE
)
导致:
# 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 **
以下代码:
selfesteem.test %>%
pairwise_t_test(
score ~ time,
paired = TRUE,
p.adjust.method = "bonferroni",
pool.sd = FALSE
)
结果相同:
# 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 **
根据?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.
此外,用法确实显示了否定 (!
)
pairwise_t_test( data, formula, comparisons = NULL, ref.group = NULL, p.adjust.method = "holm", paired = FALSE, pool.sd = !paired, detailed = FALSE, ... )