harrelfe / rms

Regression Modeling Strategies
https://hbiostat.org/R/rms
Other
170 stars 48 forks source link

Adjust ticks to (splines) transformation #107

Closed jgarces02 closed 2 years ago

jgarces02 commented 2 years ago

Hi, I'm using a Cox regression model considering my variable trough splines transformation. All is working nice until the subsequent nomogram... as expected, the scale of my variable is also transformed but I'd like to add some custom ticks inside the region between values 0 and 2 (I guess is the transformed one). Any idea, if you please?

Here's my code...

data <- source("https://pastebin.com/raw/rGtUSTLz")$value
ddist <- datadist(data)
options(datadist = "ddist") 

fit <- cph(Surv(time, event) ~ rcs(var, 3), data = data, surv = T, x = T, y = T)
surv <- Survival(fit)

plot(nomogram(fit, 
              fun = list(function(x) surv(times = 10, lp = x), 
                         function(x) surv(times = 30, lp = x),
                         function(x) surv(times = 60, lp = x)), 
              funlabel = paste("c", 1:3), lp = T))

... and these are the real and the desired outputs.

image

Thanks in advance for your help!

jgarces02 commented 2 years ago

https://stackoverflow.com/questions/69251397/adjust-nomogram-ticks-with-splines-transformation-rms-package-r