本文仅做logistic回归分析构建的列线图部分,其余部分已经很简单,包括DCA曲线 ROC曲线 相关性棒棒糖图,已经有不少教程,而且箱式图等也不难。因此不再进一步做了。
library(tidyr)
library(dplyr)
library(tibble)
library(data.table)
setwd("D:\\BioR\\new\\NAFLD_Bio\\05nomogram")
ex_ma2 <- ex_ma2[ex_ma2$gene %in% genelist,]
rt <- read.csv('rt.csv',row.names = 1)
rt2 <- rt[,c('group2','AXUD1','FOSB','SOCS2','GADD45B')]
##Data is fullly prepared, now let's start plotting nomogram
library("DynNom")
library("regplot")
library('rms')
library('VRPM')
dd <- datadist(rt2)
options(datadist="dd")
fit1 <- lrm(group2 ~AXUD1+FOSB+SOCS2+GADD45B ,data = rt2,x=T,y=T)
nom1 <- nomogram(fit1, fun=plogis,
fun.at=c(0,0.1,0.5,0.9),#这里显示risk的概率,如果想密集可以增加为c(0.001,0.01,0.1,0.25,0.5,0.75,0.9,0.99)
lp=T, # 是否显示线性概率
maxscale = 100,# 最大得分数,可以不加
funlabel="Risk of NAFLD")
plot(nom1)