我想在 x 轴下的生存或累积发病率图中显示处于危险中的数字

发布于 2024-11-29 07:00:49 字数 158 浏览 1 评论 0原文

在 x 轴标记下,我想注释与这些 x 值相对应的 y 值。这张图可以很好地解释: 示例

Under the x-axis marks, I'd like to annotate the y-values corresponding to those x-values. Best explained by this graph:
Example

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

并安 2024-12-06 07:00:49

如果 Frank Harrell 是这里的贡献者,我会等待他发帖,但由于他不是,这里是对他伟大的“rms”包中 help(survplot) 中第一个示例的细微修改:

require(rms)
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')
S <- Surv(dt,e)

# When age is in the model by itself and we predict at the mean age,
# approximate confidence intervals are ok

survplot(f, age=mean(age), conf.int=.95, 
               n.risk=TRUE, adj.n.risk=.75, y.n.risk=-0.15,
               xlab="")
title(main="Simulated Survival Plot Demonstrating Annotation of N-at-risk")
mtext("Follow-up Years", side=1, line=2)

在此处输入图像描述

If Frank Harrell were a contributor here I would wait for him to post but since he's not, here's a minor modification from the first example in help(survplot) in his great "rms" package:

require(rms)
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')
S <- Surv(dt,e)

# When age is in the model by itself and we predict at the mean age,
# approximate confidence intervals are ok

survplot(f, age=mean(age), conf.int=.95, 
               n.risk=TRUE, adj.n.risk=.75, y.n.risk=-0.15,
               xlab="")
title(main="Simulated Survival Plot Demonstrating Annotation of N-at-risk")
mtext("Follow-up Years", side=1, line=2)

enter image description here

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文