展现回归分析的OR、HR值可以用森林图,而如果想直观预测实例化对象的生存概率,则可以使用诺莫图
安装补充包
Logistic回归
1 2 3 4 5 6 7 8
| dd=datadist(df) options(datadist="dd") lrmf <- paste0("factor(dcf_status)~", paste(colnames(df)[1:10], collapse = '+')) lrmf f <- lrm(formula(lrmf) , data = df) nom <- nomogram(f, fun=plogis, lp=F, funlabel="Risk") options(repr.plot.width=10, repr.plot.height=6) plot(nom, xfrac=.2)
|
Cox回归
1 2 3 4 5 6 7 8 9 10 11 12 13 14
| dd=datadist(df) options(datadist="dd") coxmf <- paste0("Surv(dcf_time/365, dcf_status==0)~", paste(colnames(df)[1:10], collapse = '+')) coxmf f2 <- psm(formula(coxmf), data=df, dist='lognormal') med <- Quantile(f2) surv <- Survival(f2) nom <- nomogram(f2, fun=function(x) med(lp=x),funlabel="Median Survival Time") options(repr.plot.width=12, repr.plot.height=6) plot(nom,xfrac=.2) nom <- nomogram(f2, fun=list(function(x) surv(10, x)), funlabel=c("10-year Survival Probability")) options(repr.plot.width=10, repr.plot.height=6) plot(nom, xfrac=.2)
|