1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
|
ACPMATRIXcor <- cor(ACPMATRIX, method = c("pearson"), use = "complete.obs")
ACPMATRIXcor
p.ACPMATRIXcor <- rcorr(ACPMATRIX)
p.ACPMATRIXcor
cor.mtest <- function(ACPMATRIX, ...) {
mat <- as.matrix(ACPMATRIX)
n <- ncol(mat)
p.mat<- matrix(NA, n, n)
diag(p.mat) <- 0
for (i in 1:(n - 1)) {
for (j in (i + 1):n) {
tmp <- cor.test(mat[, i], mat[, j], ...)
p.mat[i, j] <- p.mat[j, i] <- tmp$p.value
}
}
colnames(p.mat) <- rownames(p.mat) <- colnames(mat)
p.mat
}
p.mat <- cor.mtest(ACPMATRIX)
head(p.mat[,1:12])
p.mat
corrplot(ACPMATRIXcor, type="upper", order="hclust", method="color", addCoef.col = "black",
tl.col="black", tl.cex = 0.5, tl.srt=45, is.corr=FALSE,
p.mat = p.mat, sig.level = 0.06, insig = "blank",
title = "table des corrélations p-value 6%")
library(psych)
pairs.panels (ACPMATRIX, method = ("pearson"), hist.col = "#00AFBB", density = TRUE, ellipses = TRUE) |
Partager