简体   繁体   English

R - pairwise_t_test 测试统计在合并标准偏差和非合并标准偏差之间切换时保持不变

[英]R - pairwise_t_test Test Statistics Unchanged When Switching Between Pooled Standard Deviation and non-Pooled Stardard Deviation

While reviewing pairwise t-tests as a post hoc for one way repeated measures ANOVA I noticed an oddity.在回顾成对 t 检验作为单向重复测量方差分析的事后,我注意到一个奇怪的地方。 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.当我合并标准偏差时,rstatix 库中 pair_t_test 的测试统计数据没有改变——事实上,output 都没有改变。

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).但是,在尝试此操作时,我找不到 output 的区别(见下文)。

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根据?pairwise_t_test

Pooling does not generalize to paired tests so pool.sd and paired cannot both be TRUE.池化不能推广到配对测试,因此 pool.sd 和paired 不能都为TRUE。

If pool.sd = FALSE the standard two sample t-test is applied to all possible pairs of groups.如果 pool.sd = FALSE,则标准二样本 t 检验适用于所有可能的组对。 This method calls the t.test(), so extra arguments, such as var.equal are accepted.此方法调用 t.test(),因此接受额外的 arguments,例如 var.equal。

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. ... ) pairwise_t_test(数据,公式,比较 = NULL,ref.group = NULL,p.adjust.method = “holm”,配对 = FALSE,pool.sd =,配对,详细 = FALSE。...)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM