当前位置: 首页>>代码示例 >>用法及示例精选 >>正文


R aggregate.survfit 平均生存曲线


R语言 aggregate.survfit 位于 survival 包(package)。

说明

对于包含多条曲线的 survfit 对象,在分组上创建平均曲线。

用法

## S3 method for class 'survfit'
aggregate(x, by = NULL, FUN = mean, ...)

参数

x

具有数据维度的 survfit 对象。

by

分组元素的可选列表或向量,每个元素长为 dim(x)['data']

FUN

计算感兴趣的汇总统计量的函数。

...

FUN 的可选进一步参数。

细节

其主要用途是对从建模函数创建的多个生存曲线取平均值。即生存的边际估计。它主要用于对 Cox 模型的多个预测曲线进行平均。

较低维度的 survfit 对象。

例子

cfit <- coxph(Surv(futime, death) ~ sex + age*hgb, data=mgus2)
# marginal effect of sex, after adjusting for the others
dummy <- rbind(mgus2, mgus2)
dummy$sex <- rep(c("F", "M"), each=nrow(mgus2)) # population data set
dummy <- na.omit(dummy)   # don't count missing hgb in our "population
csurv <- survfit(cfit, newdata=dummy)
dim(csurv)  # 2 * 1384 survival curves
csurv2 <- aggregate(csurv, dummy$sex)

也可以看看

survfit

相关用法


注:本文由纯净天空筛选整理自R-devel大神的英文原创作品 Average survival curves。非经特殊声明,原始代码版权归原作者所有,本译文未经允许或授权,请勿转载或复制。