搜索
人大经济论坛 附件下载

附件下载

所在主题:
文件名:  Rplot.pdf
资料下载链接地址: https://bbs.pinggu.org/a-2111250.html
附件大小:
R代码:
  1. panel.conf<-function (x, y, corr = NULL, col.regions, digits = 2, cex.cor,
  2. ...)
  3. {
  4. auto <- missing(cex.cor)
  5. usr <- par("usr")
  6. on.exit(par(usr))
  7. par(usr = c(0, 1, 0, 1))
  8. if (!is.null(corr)) {
  9. est <- corr

  10. est <- formatC(est*100, digits = digits, format = "d")

  11. if (auto)
  12. cex.cor <- 0.7/strwidth(est)
  13. text(0.5, 0.6, est, cex = cex.cor)
  14. }
  15. else {
  16. results <- cor.test(x, y, alternative = "two.sided")
  17. est <- results$estimate
  18. est <- formatC(est*100, digits = digits, format = "d")
  19. Signif <- symnum(results$p.value, corr = FALSE, na = FALSE, cutpoints = c(0, 0.001, 0.01, 0.05, 0.1, 1), symbols = c("***", "**", "*", ".", " "))
  20. if (auto)
  21. cex.cor <- 0.7/strwidth(est)
  22. text(0.5, 0.6, est, cex = cex.cor)

  23. text(0.8, 0.8, Signif, cex = cex.cor, col = 2)

  24. }
  25. }
  26. corrgram(mtcars,order=TRUE,lower.panel=panel.shade,upper.panel=panel.conf,text.panel=panel.txt)
复制代码

以上代码运行仅得到图1,如何达到图2的效果呢?(图2源于http://www.talyarkoni.org/blog/2 ... s-are-correlicious/
程序编写的具体问题就是,如何将panel.shade和panel.conf合并成一个函数,或者是否还有新的函数?






    熟悉论坛请点击新手指南
下载说明
1、论坛支持迅雷和网际快车等p2p多线程软件下载,请在上面选择下载通道单击右健下载即可。
2、论坛会定期自动批量更新下载地址,所以请不要浪费时间盗链论坛资源,盗链地址会很快失效。
3、本站为非盈利性质的学术交流网站,鼓励和保护原创作品,拒绝未经版权人许可的上传行为。本站如接到版权人发出的合格侵权通知,将积极的采取必要措施;同时,本站也将在技术手段和能力范围内,履行版权保护的注意义务。
(如有侵权,欢迎举报)
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

GMT+8, 2025-12-30 10:17