r - Why white bg with Spearman correlation in corrplot? -
the first diagonal background white when spearman cor r
. never happens other cor measures.
library("psych") library("corrplot") m <- mtcars m.cor <- cor(m) p.mat.all <- psych::corr.test(m.cor, adjust = "none", ci = f) alpha <- 0.05 col <- colorramppalette(c("#bb4444", "#ee9988", "#ffffff", "#77aadd", "#4477aa")) lapply(c("r","p","t"), function(id) { # http://stackoverflow.com/a/40531043/54964 x <- p.mat.all[[id]] corrplot( m.cor, p.mat = x, sig.level = alpha, insig = "blank", ) })
i put there explicitly diag = t
should fine without too.
fig. 1 output of minimum example
no warnings.
r: 3.3.1
os: debian 8.5
ticket developer: #74
this bug in software. reported developer.
see related github issue: https://github.com/taiyun/corrplot/issues/74, shortly referring vsimko:
this looks problem in psych::corr.test , not in corrplot
p.mat.all <- psych::corr.test(m.cor, adjust = "none", ci = f) diag(p.mat.all$r) # produces 1 diag(p.mat.all$p) # produces 0 diag(p.mat.all$t) # produces inf
workaround
par(mfcol = c(1, 3)) m <- cor(mtcars) p.mat.all <- psych::corr.test(m, adjust = "none", ci = false) (id in c("r", "p", "t")) { x <- p.mat.all[[id]] diag(x) <- 0 corrplot( m, p.mat = x, sig.level = .05, insig = "blank") }
fig. 1 output
Comments
Post a Comment