I have a nomogram that looks like this:
I need to code this out in R as I have a dataset and I need to calculate the points for each record in this dataset.When the points are greater than 79, an outcome of 0 needs to be returned otherwise 0 will be returned.
Part of my dataset looks like this:
I have tried the following code:
set.seed(22)
df <- data.frame(data2$age, data2$outcome, data2$Anion.gap, data2$Lactic.acid,
data2$Blood.calcium,data2$Urea.nitrogen, data2$Renal.failure,
data2$Diastolic.blood.pressure)
ddist <- datadist(df)
oldoption <- options(datadist='ddist')
f <- cph(formula(Surv(data2$age,data2$outcome)~data2$Anion.gap + data2$Lactic.acid+
data2$Blood.calcium+data2$Urea.nitrogen+ data2$Renal.failure+
data2$Diastolic.blood.pressure),data=df,
x=TRUE,y=TRUE,surv=TRUE,time.inc=3)
surv <- Survival(f)
nom <- nomogram(f,
funlabel=c("Total points",
"Linear Predictor",
"risk of in-hospital mortality"), lp=T)
It's my first time plotting nomogram and I got really confused on how to code nomogram into R given this nomogram chart. Thanks a lot for any comments!