使用(样条)变换调整列线图刻度,均方根包 [R]

Adjust nomogram ticks with (splines) transformation, rms package [R]

考虑到可变槽样条变换,我正在使用 Cox 回归模型。一切都很好,直到随后的诺模图......正如预期的那样,我的变量的比例也被转换但我想在值 0 和 2 之间的区域内添加一些自定义刻度(我猜是转换后的)。有什么想法吗?

这是我的代码...

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))

...这些是真实的和期望的输出。

在此先感谢您的帮助!

我也遇到过这个问题。我的答案是使用另一个包 regplot。或者,如果您知道要绘制的刻度线处的点值是多少,则可以提供这些值而不是使用 regplot 的输出。基本上,您需要修改从列线图函数输出并提供用于绘制列线图的刻度线和点。

此方法还提供了一种通过编辑列线图输出来删除点/刻度线的方法。

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)
nom1 <- 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)

library(regplot)
# call regplot with points = TRUE to get output 
regplot(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), points = TRUE)
# look at the points supplied through regplot and take those. 
nom1_edit <- nom1
# now we edit the ticks supplied for var and their corresponding point value
nom1_edit[[1]][1] <- list(c(0, 0.06, 0.15, 0.3, 2,4,6,8,10,12,14,16))
nom1_edit[[1]][2] <- list(c(0, 10, 21, 32, 42.41191, 50.63878, 58.86565, 
                       67.09252, 75.31939, 83.54626, 91.77313, 100.00000))

nom1_edit$var$points <- c(0, 10, 21, 32, 42.41191, 50.63878, 58.86565, 
                       67.09252, 75.31939, 83.54626, 91.77313, 100.00000)
# plot the edited nomogram with new points
plot(nom1_edit)