如果您询问的是rstatix
中的函数,那么它似乎只返回测试的全部细节,前提是您请求不对t检验使用集合标准差(pool.sd=FALSE
).
如果您查看代码,pairwise_t_test
在使用池化SD时调用R函数stats::pairwise.t.test
,但在使用pool.sd=FALSE
时使用重复应用程序stats::t.test
.然后它使用broom::tidy
将统计数据整理到一个表中.
所以我不认为报告的差异有很好的统计原因,它只是依赖于不同的基函数,而R函数t.test
确实返回t统计量等,而pairwise.t.test
只返回p值的矩阵.
如果使用lm
得到线性模型(ANOVA),然后使用emmeans
得到成对对比,则可以得到合并SD的成对t检验的详细信息. 请注意,emmeans
中的p值与pairwise.t.test
中的合并SD相同,但它也返回估计值和统计量.
所以,用一些玩具数据:
> dat <- data.frame(x=rep(1:10,10), y=rnorm(100))
>
> rstatix::pairwise_t_test(dat, y~x, detailed=TRUE)
# A tibble: 45 × 10
.y. group1 group2 n1 n2 p method p.adj p.signif p.adj.signif
* <chr> <chr> <chr> <int> <int> <dbl> <chr> <dbl> <chr> <chr>
1 y 1 2 10 10 0.536 T-test 1 ns ns
2 y 1 3 10 10 0.453 T-test 1 ns ns
3 y 2 3 10 10 0.896 T-test 1 ns ns
4 y 1 4 10 10 0.427 T-test 1 ns ns
5 y 2 4 10 10 0.86 T-test 1 ns ns
6 y 3 4 10 10 0.964 T-test 1 ns ns
7 y 1 5 10 10 0.781 T-test 1 ns ns
8 y 2 5 10 10 0.733 T-test 1 ns ns
9 y 3 5 10 10 0.636 T-test 1 ns ns
10 y 4 5 10 10 0.605 T-test 1 ns ns
# ℹ 35 more rows
# ℹ Use `print(n = ...)` to see more rows
> rstatix::pairwise_t_test(dat, y~x, pool.sd=FALSE, detailed = TRUE)
# A tibble: 45 × 17
estimate estimate1 estimate2 .y. group1 group2 n1 n2 statistic p df conf.low conf.high method alternative p.adj p.adj.signif
* <dbl> <dbl> <dbl> <chr> <chr> <chr> <int> <int> <dbl> <dbl> <dbl> <dbl> <dbl> <chr> <chr> <dbl> <chr>
1 -0.276 -0.318 -0.0417 y 1 2 10 10 -0.725 0.479 15.6 -1.08 0.533 T-test two.sided 1 ns
2 -0.334 -0.318 0.0166 y 1 3 10 10 -0.760 0.457 18.0 -1.26 0.590 T-test two.sided 1 ns
3 -0.354 -0.318 0.0367 y 1 4 10 10 -0.782 0.445 18.0 -1.31 0.598 T-test two.sided 1 ns
4 -0.124 -0.318 -0.194 y 1 5 10 10 -0.306 0.763 17.0 -0.977 0.729 T-test two.sided 1 ns
5 -0.209 -0.318 -0.109 y 1 6 10 10 -0.458 0.653 18.0 -1.17 0.749 T-test two.sided 1 ns
6 -0.0428 -0.318 -0.275 y 1 7 10 10 -0.104 0.918 17.3 -0.909 0.823 T-test two.sided 1 ns
7 0.0437 -0.318 -0.361 y 1 8 10 10 0.0933 0.927 17.9 -0.940 1.03 T-test two.sided 1 ns
8 -0.150 -0.318 -0.167 y 1 9 10 10 -0.320 0.752 17.9 -1.14 0.835 T-test two.sided 1 ns
9 -0.321 -0.318 0.00292 y 1 10 10 10 -0.616 0.546 16.9 -1.42 0.778 T-test two.sided 1 ns
10 -0.0583 -0.0417 0.0166 y 2 3 10 10 -0.158 0.876 16.0 -0.840 0.724 T-test two.sided 1 ns
# ℹ 35 more rows
# ℹ Use `print(n = ...)` to see more rows
> mod1 <- lm(data=dat , y~factor(x))
> emmeans::emmeans(mod1, pairwise ~ x, adjust="none", infer=c(TRUE, TRUE))$contrast
contrast estimate SE df lower.CL upper.CL t.ratio p.value
x1 - x2 -0.2759 0.444 90 -1.158 0.606 -0.622 0.5357
x1 - x3 -0.3343 0.444 90 -1.216 0.547 -0.753 0.4533
x1 - x4 -0.3543 0.444 90 -1.236 0.527 -0.798 0.4268
x1 - x5 -0.1238 0.444 90 -1.006 0.758 -0.279 0.7809
x1 - x6 -0.2086 0.444 90 -1.090 0.673 -0.470 0.6395
x1 - x7 -0.0428 0.444 90 -0.925 0.839 -0.096 0.9234
x1 - x8 0.0437 0.444 90 -0.838 0.925 0.098 0.9218
x1 - x9 -0.1503 0.444 90 -1.032 0.731 -0.339 0.7357
x1 - x10 -0.3206 0.444 90 -1.202 0.561 -0.722 0.4720
x2 - x3 -0.0583 0.444 90 -0.940 0.823 -0.131 0.8957
x2 - x4 -0.0784 0.444 90 -0.960 0.803 -0.177 0.8602
x2 - x5 0.1521 0.444 90 -0.730 1.034 0.343 0.7326
x2 - x6 0.0673 0.444 90 -0.814 0.949 0.152 0.8798
x2 - x7 0.2331 0.444 90 -0.649 1.115 0.525 0.6007
x2 - x8 0.3196 0.444 90 -0.562 1.201 0.720 0.4733
x2 - x9 0.1257 0.444 90 -0.756 1.007 0.283 0.7777
x2 - x10 -0.0446 0.444 90 -0.926 0.837 -0.101 0.9201
x3 - x4 -0.0201 0.444 90 -0.902 0.862 -0.045 0.9640
x3 - x5 0.2105 0.444 90 -0.671 1.092 0.474 0.6365
x3 - x6 0.1257 0.444 90 -0.756 1.007 0.283 0.7777
x3 - x7 0.2915 0.444 90 -0.590 1.173 0.657 0.5130
x3 - x8 0.3779 0.444 90 -0.504 1.260 0.852 0.3967
x3 - x9 0.1840 0.444 90 -0.698 1.066 0.415 0.6794
x3 - x10 0.0137 0.444 90 -0.868 0.895 0.031 0.9754
x4 - x5 0.2305 0.444 90 -0.651 1.112 0.519 0.6047
x4 - x6 0.1457 0.444 90 -0.736 1.027 0.328 0.7434
x4 - x7 0.3116 0.444 90 -0.570 1.193 0.702 0.4845
x4 - x8 0.3980 0.444 90 -0.484 1.280 0.897 0.3722
x4 - x9 0.2041 0.444 90 -0.678 1.086 0.460 0.6468
x4 - x10 0.0338 0.444 90 -0.848 0.915 0.076 0.9395
x5 - x6 -0.0848 0.444 90 -0.967 0.797 -0.191 0.8489
x5 - x7 0.0810 0.444 90 -0.801 0.963 0.183 0.8556
x5 - x8 0.1675 0.444 90 -0.714 1.049 0.377 0.7068
x5 - x9 -0.0265 0.444 90 -0.908 0.855 -0.060 0.9526
x5 - x10 -0.1968 0.444 90 -1.078 0.685 -0.443 0.6586
x6 - x7 0.1658 0.444 90 -0.716 1.048 0.374 0.7096
x6 - x8 0.2523 0.444 90 -0.629 1.134 0.568 0.5712
x6 - x9 0.0583 0.444 90 -0.823 0.940 0.131 0.8957
x6 - x10 -0.1120 0.444 90 -0.994 0.770 -0.252 0.8014
x7 - x8 0.0865 0.444 90 -0.795 0.968 0.195 0.8460
x7 - x9 -0.1075 0.444 90 -0.989 0.774 -0.242 0.8092
x7 - x10 -0.2778 0.444 90 -1.160 0.604 -0.626 0.5330
x8 - x9 -0.1939 0.444 90 -1.076 0.688 -0.437 0.6632
x8 - x10 -0.3642 0.444 90 -1.246 0.517 -0.821 0.4140
x9 - x10 -0.1703 0.444 90 -1.052 0.711 -0.384 0.7021