Teach you to use R language to build COX regression and draw a nomogram (Nomogram)

Nomogram, also known as Nomogram, is based on regression analysis, uses multiple clinical indicators or biological attributes, and then uses line segments with scores to achieve the purpose of setting: based on multiple The value of the variable predicts the probability of a certain clinical outcome or a certain type of event. Nomogram can be used for multi-index joint diagnosis or prediction of disease incidence or progression.
In recent years, it has been used more and more in high-quality SCI clinical papers. The nomogram converts the regression model into an intuitive view, making the results easier to judge and readable. For example,
Zero-based research
today we use hand-to-hand operations to teach you how to make such a nomogram based on COX regression. First, For the installation of R language 3.6 or above and the installation of RStudio, the installation process will not be explained in detail. Let's use the cancer database that comes with the survival package in R language as an example.
First open RStudio
Zero-based research
and then load the data package.
library(survival)
library(rms)
Zero-based research
and then import data
data(package=“survival”)
bc<-cancer
dc<-datadist(bc)
options(datadist=“dc”)
Zero-based research
establish COX regression equation
f <- cph(Surv( time, status) ~ age + sex + ph.ecog + pat.karno +wt.loss,
x=T, y=T, surv=T, data=cancer, time.inc=36)
Zero-based research
analyze the COX regression equation
summary (f)
Zero-based research
Draw a nomogram
surv <- Survival(f)
nom <- nomogram(f, fun=list(function(x) surv(36, x), function(x) surv(60, x),
function(x) surv(120, x)), lp=F, funlabel=c(“3-year survival”, “5-year survival”, “10-year survival”),
maxscale=10, fun.at=c(0.95, 0.9, 0.85, 0.8, 0.75, 0.7, 0.6, 0.5))
plot(nom)
Zero-based research
内部验证
validate(f, method=“boot”, B=1000, dxy=T)
rcorrcens(Surv(time, status) ~ predict(f), data = dc)

Zero-based research
1-0.344=0.656,即为C-index
一致性检验
f3 <- cph(Surv(time, status) ~ age + sex + ph.ecog + pat.karno +wt.loss, x=T, y=T, surv=T,
data=bc, time.inc=36)
cal3 <- calibrate(f3, cmethod=“KM”, method=“boot”, u=36, m=220, B=1000)
plot(cal3)
f5 <- cph(Surv(time, status) ~age + sex + ph.ecog + pat.karno +wt.loss, x=T, y=T, surv=T,
data=bc, time.inc=60)
cal5 <- calibrate(f5, cmethod=“KM”, method=“boot”, u=60, m=220, B=1000)
plot(cal5)
f10 <- cph(Surv(time, status) ~ age + sex + ph.ecog + pat.karno +wt.loss, x=T, y=T, surv=T,
data=bc, time.inc=120)
cal10 <- calibrate(f10, cmethod=“KM”, method=“boot”, u=120, m=220, B=1000)
plot(cal10)
Zero-based research
Zero-based research
Zero-based research
Zero-based research
Step-by-step verification can be done according to requirements, and external verification will not be explained in detail. Those who are interested can follow my scientific research tutorial.
Move your little hands and pay attention, more wonderful articles are all in the zero-based scientific research
Insert picture description here

Guess you like

Origin blog.csdn.net/dege857/article/details/108627909