-
Notifications
You must be signed in to change notification settings - Fork 306
Open
Description
FYI, survival:::summary.survfit()
has recently gained a data.frame
argument (since therneau/survival@4a5c24e available in {survival}
3.7-0 release on 2024-06-05). tidy.survfit()
may probably use that and be simplified once {survival}
3.7-0 is considered old enough.
Note that the standard errors return by survival::survfit()
and survival:::summary.survfit()
are different:
- from
survival::survfit()
:for a survival curve this contains standard error of the cumulative hazard or -log(survival), for a multi-state curve it contains the standard error of prev.
- from
survival:::summary.survfit()
:the standard error of the survival value.
library(survival)
fit <- survfit(Surv(time, status) ~ x, aml)
x <- broom::tidy(fit)
y <- summary(fit, censored = TRUE, data.frame = TRUE)
y <- y[c(1:5, 7, 10:9, 11)]
y$strata <- as.character(y$strata)
# from https://github.com/cran/survival/blob/36b56a5d8014d3a5ed29fb111303955e3e28f13f/R/summary.survfit.R#L187-L190
y$std.err <- y$std.err / y$surv
y[is.na(y$std.err), "std.err"] <- Inf
all.equal(x, y, check.attributes = FALSE)
# [1] TRUE
Metadata
Metadata
Assignees
Labels
No labels