"rms" 中的 survplot() :风险数量由整个组显示,而不是针对每条曲线

survplot() in "rms" : number of risk is shown by the whole group, not for each curve

我正在使用 survplot{rms} 绘制生存曲线。但是,当我使用 n.risk = TRUE 绘制风险数 table 时,R 给了我整个数据集的数字,而不是每条曲线的数字,我不明白为什么。

# initialize survival commands in R

survive <- Surv(dat$dx_lastcontact_death_months, dat$event)

library(rms)

ff <- cph(survive ~ radiation, data = dat,x = T, y = T)

survplot(ff,radiation,conf.int = 0.95,
         lty = c(1,1,1), col = c("red","blue","yellow"), xlab = "", ylab = "",
         xlim = c(0,60), time.inc = 12, label.curves = F, n.risk = T)

例如,在时间=0时,风险数应该是7442 3210 3042,现在图中显示13694,三组之和。谁能帮我弄清楚哪里出了问题?谢谢?

@WeihuangWong 可能是正确的。当我使用 survplot 中的第一个示例时,我得到的输出与您得到的输出相同,但是在分类变量周围添加一个 strat() 函数会产生预期的输出格式。我也添加了 surv=T.

n <- 1000
set.seed(731)
age <- 50 + 12*rnorm(n)
label(age) <- "Age"
sex <- factor(sample(c('male','female'), n, TRUE))
cens <- 15*runif(n)
h <- .02*exp(.04*(age-50)+.8*(sex=='female'))
dt <- -log(runif(n))/h
label(dt) <- 'Follow-up Time'
e <- ifelse(dt <= cens,1,0)
dt <- pmin(dt, cens)
units(dt) <- "Year"
dd <- datadist(age, sex)
options(datadist='dd')

f <- cph(Surv(dt,e) ~ strat(sex), x=T,y=T, surv=T)
survplot(f, sex, label.curves = F, n.risk = T)