> install.packages("forestplot")
> library(forestplot)
> library(grid)
> library(magrittr)
> csize <- data.frame(mean = c(NA,0.5585,0.6628,0.7794,0.7458,0.7564),lower = c(NA,0.4849,0.5867,0.5856,0.6734,0.6886),upper = c(NA,0.6319,0.7335,0.8123,0.7965,0.8653))
> tabletext <- cbind(c("MODEL","model1","model2","model3","model4","model5"),c("C-statistic(95%CI)","0.558(0.484,0.631)","0.662(0.592,0.733)","0.701(0.581,0.820)","0.728(0.675,0.781)","0.753(0.699,0.808)"))
> forestplot(tabletext,csize,hrzl_lines = gpar(col="black",lty=1,lwd=2),is.summary = c(TRUE,rep(FALSE,5)),txt_gp = fpTxtGp(label=gpar(cex=1)),clip = c(0.3,1),zero = 0.5,lwd.zero = 1,col=fpColors(box=c("royalblue"),lines = "darkblue",summary = "royalblue"),xlab = "C-index",grid = F,vertices=TRUE,boxsize = 0.2,lwd.ci = 1,lty.ci = 2,lwd.xaxis = 2,ci.vertices.height = 0.1,graphwidth = unit(3.5,"inches"))
将lty.ci=2改成1,添加graph.pos=2
> forestplot(tabletext,csize,hrzl_lines = gpar(col="black",lty=1,lwd=2),is.summary = c(TRUE,rep(FALSE,5)),txt_gp = fpTxtGp(label=gpar(cex=1)),clip = c(0.3,1),zero = 0.5,lwd.zero = 1,col=fpColors(box=c("royalblue"),lines = "darkblue",summary = "royalblue"),xlab = "C-index",grid = F,vertices=TRUE,boxsize = 0.2,lwd.ci = 1,lty.ci = 1,lwd.xaxis = 2,ci.vertices.height = 0.1,graphwidth = unit(3.5,"inches"),graph.pos = 2)
想起前段时间参加校园宣讲会人事赠送的两本生信工具书,特地学习工具书中的QQ-plot图
QQ-plot分位数图
检验样本的概率分布是否服从某种理论分布,PP概率图的原理是检验实际累计概率分布于理论累积概率分布是否吻合。
> install.packages("DAAG")
> library(DAAG)
> data("possum")
> attach(possum)
> fpossum <- possum[possum$sex=="f",]
> dens <- density(totlngth)
> x <- scale(fpossum$totlngth)
> n <- length(x)
> plot(qnorm((1:n-0.5)/n),sort(x),col=2,type = 'p',main = "QQplot",xlab = "Theoretical Quantiles",ylab = "Studentized Quantiles")
> abline(a=0,b=1,lty=3)