View source: R/S3_definitions.R
summary.survtab | R Documentation |
Summary method function for survtab
objects; see
[survtab_ag]
. Returns estimates at given time points
or all time points if t
and q
are both NULL
.
## S3 method for class 'survtab'
summary(object, t = NULL, subset = NULL, q = NULL, ...)
object |
a |
t |
a vector of times at which time points (actually intervals that
contain t) to print summary table of survival function estimates by strata;
values not existing in any interval cause rows containing only |
subset |
a logical condition to subset results table by
before printing; use this to limit to a certain stratum. E.g.
|
q |
a named |
... |
unused; required for congruence with other |
Note that this function returns the intervals and NOT the time points corresponding to quantiles / estimates corresponding to time points. If you want precise estimates at time points that are not interval breaks, add the time points as breaks and re-estimate the survival time function. In interval-based estimation, the estimates denote e.g. probability of dying during the interval, so time points within the intervals are not usually considered at all. See e.g. Seppa, Dyba, and Hakulinen (2015).
A data.table
: a slice from object
based on t
, subset
, and q
.
Joonas Miettinen
Seppa K., Dyba T. and Hakulinen T.: Cancer Survival, Reference Module in Biomedical Sciences. Elsevier. 08-Jan-2015. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1016/B978-0-12-801238-3.02745-8")}
Other survtab functions:
Surv()
,
lines.survtab()
,
plot.survtab()
,
print.survtab()
,
survtab()
,
survtab_ag()
library(Epi)
## NOTE: recommended to use factor status variable
x <- Lexis(entry = list(FUT = 0, AGE = dg_age, CAL = get.yrs(dg_date)),
exit = list(CAL = get.yrs(ex_date)),
data = sire[sire$dg_date < sire$ex_date, ],
exit.status = factor(status, levels = 0:2,
labels = c("alive", "canD", "othD")),
merge = TRUE)
## pretend some are male
set.seed(1L)
x$sex <- rbinom(nrow(x), 1, 0.5)
## observed survival
st <- survtab(Surv(time = FUT, event = lex.Xst) ~ sex, data = x,
surv.type = "cif.obs",
breaks = list(FUT = seq(0, 5, 1/12)))
## estimates at full years of follow-up
summary(st, t = 1:5)
## interval estimate closest to 75th percentile, i.e.
## first interval where surv.obs < 0.75 at end
## (just switch 0.75 to 0.5 for median survival, etc.)
summary(st, q = list(surv.obs = 0.75))
## multiple quantiles
summary(st, q = list(surv.obs = c(0.75, 0.90), CIF_canD = 0.20))
## if you want all estimates in a new data.frame, you can also simply do
x <- as.data.frame(st)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.