summary.survtab: Summarize a survtab Object

View source: R/S3_definitions.R

summary.survtabR Documentation

Summarize a survtab Object

Description

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.

Usage

## S3 method for class 'survtab'
summary(object, t = NULL, subset = NULL, q = NULL, ...)

Arguments

object

a survtab object

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 NAs to be returned.

subset

a logical condition to subset results table by before printing; use this to limit to a certain stratum. E.g. subset = sex == "male"

q

a named list of quantiles to include in returned data set, where names must match to estimates in object; returns intervals where the quantiles are reached first; e.g. list(surv.obs = 0.5) finds the interval where surv.obs is 0.45 and 0.55 at the beginning and end of the interval, respectively; returns rows with NA values for quantiles not reached in estimates (e.g. if q = list(surv.obs = 0.5) but lowest estimate is 0.6); see Examples.

...

unused; required for congruence with other summary methods

Details

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).

Value

A 'data.table': a slice from 'object' based on 't', 'subset', and 'q'.

Author(s)

Joonas Miettinen

References

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")}

See Also

Other survtab functions: Surv(), lines.survtab(), plot.survtab(), print.survtab(), survtab_ag(), survtab()

Examples


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)

WetRobot/popEpi documentation built on Aug. 29, 2023, 3:53 a.m.