两组之间的Mann-Whitney检验比较 [英] comparison Mann-Whitney test between groups
本文介绍了两组之间的Mann-Whitney检验比较的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在我的数据集中,我有以下列:
In my dataset I have columns:
group 将var
$ b $分组b var 是范围变量
group which is grouping var
var which is range variable
我只需要比较1-2和1-3组。
如何使用 wilcox.test
进行操作?
这是数据。
I need to compare only the groups 1-2 and 1-3.
how to do it using wilcox.test
?
Here the data.
mydat=structure(list(group = c(1L, 1L, 1L, 1L, 2L, 2L, 2L, 2L, 3L,
3L, 3L, 3L), var = c(23L, 24L, 24L, 23L, 23L, 24L, 24L, 23L,
23L, 24L, 24L, 23L)), .Names = c("group", "var"), class = "data.frame", row.names = c(NA,
-12L))
推荐答案
您可以按 group
然后按<$ 拆分
您的data.frame c $ c>对您想要的组配对使用测试。
You can split
your data.frame by group
and then lapply
the test to the group pairs you want.
lst <- split(mydat, mydat$group)
lapply(lst[-1], function(DF) wilcox.test(DF$var, lst[[1]]$var, exact = FALSE))
这篇关于两组之间的Mann-Whitney检验比较的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文