简体   繁体   English

Corrplot意义

[英]Corrplot significance

I don't know where I should put like method=”spearman” in the codes of corrplot to see the significance of the sperman correlation 我不知道应该在method=”spearman”的代码中将method=”spearman”放在什么位置,以了解sperman相关的重要性

cor.mtest <- function(mat, conf.level = 0.95){
mat <- as.matrix(mat)
n <- ncol(mat)
p.mat <- lowCI.mat <- uppCI.mat <- matrix(NA, n, n)
diag(p.mat) <- 0
diag(lowCI.mat) <- diag(uppCI.mat) <- 1
for(i in 1:(n-1)){
for(j in (i+1):n){
tmp <- cor.test(mat[,i], mat[,j], conf.level = conf.level)
p.mat[i,j] <- p.mat[j,i] <- tmp$p.value
lowCI.mat[i,j] <- lowCI.mat[j,i] <- tmp$conf.int[1]
uppCI.mat[i,j] <- uppCI.mat[j,i] <- tmp$conf.int[2]
}
}
return(list(p.mat, lowCI.mat, uppCI.mat))
}
res1 <- cor.mtest(mtcars,0.95)

The argument method=”spearman” has to be passed to the cor.test function: 必须将参数method=”spearman”传递给cor.test函数:

cor.test(mat[,i], mat[,j], conf.level = conf.level, method = ”spearman”)

See the help page of ?cor.test for further details. 有关更多详细信息,请参见?cor.test的帮助页面。

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

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