gpt4 book ai didi

r - 使用 Spearman Rho 系数比较排名

转载 作者:行者123 更新时间:2023-12-02 15:49:56 26 4
gpt4 key购买 nike

我想将方法​​2、3、4的排名结果与方法1进行比较。在这方面,我想使用Spearman Rho系数。我还想知道方法2、3、4的结果与方法1是否有显着关系。那么该怎么做呢?

database<-structure(list( 
Method1 = c(1L, 10L, 7L, 8L, 9L, 6L, 5L, 3L, 4L, 2L), Method2 = c(1L,
8L, 6L, 7L, 10L, 9L, 4L, 2L, 5L, 3L), Method3 = c(1L,
10L, 7L, 8L, 9L, 6L, 4L, 2L, 3L, 5L), Method4 = c(1L,
9L, 6L, 7L, 10L, 8L, 5L, 3L, 2L, 4L)), class = "data.frame", row.names = c(NA,
10L))

> database
Method1 Method2 Method3 Method4
1 1 1 1 1
2 10 8 10 9
3 7 6 7 6
4 8 7 8 7
5 9 10 9 10
6 6 9 6 8
7 5 4 4 5
8 3 2 2 3
9 4 5 3 2
10 2 3 5 4

最佳答案

也许您想要这样的东西,使用“spearman”方法提取cor.test的估计值:

library(dplyr)
database %>%
summarise_each(funs(cor.test(., database$Method1, method = "spearman")$estimate))

输出:

  Method1   Method2   Method3   Method4
1 1 0.8787879 0.9272727 0.9030303

对于 p 值:

library(dplyr)
database %>%
summarise_each(funs(cor.test(., database$Method1, method = "spearman")$p.value))

输出:

  Method1     Method2      Method3     Method4
1 0 0.001977059 0.0001301624 0.000880225

关于r - 使用 Spearman Rho 系数比较排名,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/72848824/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com