【问题标题】:Adjust nomogram ticks with (splines) transformation, rms package [R]使用(样条)变换调整列线图刻度,rms 包 [R]
【发布时间】:2021-11-13 23:35:33
【问题描述】:

考虑到我的变量槽样条变换,我正在使用 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))

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

提前感谢您的帮助!

【问题讨论】:

  • 我明白你为什么想要这个。 var 列高度倾斜。第 95-%ile 仅为 1.05。所以你的大部分数据在这个列线图上没有参考点。我才刚刚开始研究这个,但它真的让我想知道日志转换可能有用。
  • 当然它可能有用......但是对于医生解释或推断对数值来说有点奇怪。那是因为我在问。谢谢。

标签: r regression rms


【解决方案1】:

我也遇到过这个问题。我的答案是使用另一个包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)

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-04-05
    • 1970-01-01
    • 2015-05-09
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多