0

I have a nomogram that looks like this: enter image description here

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: enter image description here

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!

Lalalaland
  • 11
  • 4
  • It looks like you're new to SO; welcome to the community! If you want great answers quickly, it's best to make your question reproducible. This includes sample data like the output from `dput(head(dataObject)))` and any libraries you are using. Check it out: [making R reproducible questions](https://stackoverflow.com/q/5963269). – Kat Apr 05 '22 at 16:12

0 Answers0