R:如何阅读列线图来预测所需的变量

R: How to read Nomograms to predict the desired variable

我正在使用 Rstudio。我使用以下代码(从 documentation 的示例代码复制)使用包 rms 中的函数 nomogram 创建了列线图:

library(rms)
n <- 1000    # define sample size
set.seed(17) # so can reproduce the results
age            <- rnorm(n, 50, 10)
blood.pressure <- rnorm(n, 120, 15)
cholesterol    <- rnorm(n, 200, 25)
sex            <- factor(sample(c('female','male'), n,TRUE))


# Specify population model for log odds that Y=1
L <- .4*(sex=='male') + .045*(age-50) +
  (log(cholesterol - 10)-5.2)*(-2*(sex=='female') + 2*(sex=='male'))
# Simulate binary y to have Prob(y=1) = 1/[1+exp(-L)]
y <- ifelse(runif(n) < plogis(L), 1, 0)


ddist <- datadist(age, blood.pressure, cholesterol, sex)
options(datadist='ddist')


f <- lrm(y ~ lsp(age,50)+sex*rcs(cholesterol,4)+blood.pressure)
nom <- nomogram(f, fun=function(x)1/(1+exp(-x)),  # or fun=plogis
    fun.at=c(.001,.01,.05,seq(.1,.9,by=.1),.95,.99,.999),
    funlabel="Risk of Death")
#Instead of fun.at, could have specified fun.lp.at=logit of
#sequence above - faster and slightly more accurate
plot(nom, xfrac=.45)

结果:

此代码生成列线图,但没有连接每个尺度(称为等值线)的线来帮助从图中预测所需的变量 ("Risk of Death")。通常,列线图具有用于预测的等值线 (example from wikipedia)。但是在这里,我如何预测变量值?

编辑:

来自文档:

The nomogram does not have lines representing sums, but it has a reference line for reading scoring points (default range 0--100). Once the reader manually totals the points, the predicted values can be read at the bottom.

我不明白这个。从点的尺度来看,似乎应该在没有等值线的情况下进行预测。但是怎么办?有人可以用这个例子详细说明我如何阅读列线图来预测所需的变量吗?非常感谢!

编辑 2(仅供参考):

在赏金的描述中,我说的是等值线。开始赏金时,我不知道nomogram函数不提供等值线,而是有点数。

根据文档,列线图用于手动获取预测:

在情节的顶部(超过总分)

  • 您为患者的每个变量画一条垂直线(例如年龄=40,胆固醇=220(和性别=男性),blood.pressure=172)
  • 然后将您在分数等级 (40+60+3=103) 上读取的三个值相加以获得总分。
  • 最后,您在总分等级 (103) 上画了一条垂直线,以读取死亡风险 (0.55)。

这些是回归列线图,与经典列线图的工作方式不同。经典诺模图将执行完整计算。对于这些列线图,您从每个预测变量到底部的刻度放一条线并添加您的结果。

在回归模型上使用经典 'isopleth' 列线图的唯一方法是 1 只有两个预测变量或 2 有复杂的多步列线图。