相关性分析

作者: 落寞的橙子 | 来源:发表于2020-12-28 10:46 被阅读0次

参考
方法一

suppressMessages(library(PerformanceAnalytics))
chart.Correlation(rt,histogram = TRUE,pch=19,method="pearson")

方法二

suppressMessages(library(corrplot))
library(corrgram)
M <- round(cor(rt),4)
# 原生配色
col2 <- colorRampPalette(c("#67001F", "#B2182B", "#D6604D", "#F4A582",
                           "#FDDBC7", "#FFFFFF", "#D1E5F0", "#92C5DE",
                           "#4393C3", "#2166AC", "#053061"))
corrplot(M,
         tl.col = 'black',
         tl.pos = "ld",
         tl.cex = 1.1,
         cl.pos = "b", 
         method = "circle", 
         order = 'AOE', 
         col = rev(col2(200)),
         mar = c(0,0,0,0),
         type = "lower",
         diag = FALSE,
         addCoef.col = "grey20",
         cl.cex=1,
         p.mat = cor.mtest(t(M), conf.level = 0.95)$p
)

相关文章

网友评论

    本文标题:相关性分析

    本文链接:https://www.haomeiwen.com/subject/kyyznktx.html