rift_survival_difference() and rift_survival_ratio() compare the
Kaplan-Meier survival probability, or the cumulative incidence, at a time
point between the levels of a stratifying variable, each level against the
first, with a confidence interval. They are the estimators behind the
"survdiff", "cumincdiff", "survratio" and "cumincratio" rows of
tbl_rift(), exported so they can be called on their own or wrapped in a
custom method of add_difference() or a stat_fns function of
tbl_custom_summary(). The survival package must be installed.
The per-level estimates and their limits are those of
summary(survival::survfit(), times = time, extend = TRUE): Greenwood
standard errors and, by default, log-transformed limits. With competing
events (a factor status in Surv()), the curves are Aalen-Johansen
cumulative incidences of state. The limits of a difference come from the
MOVER method of Zou and Donner (2008), which recovers the interval of a
difference from the two levels' own intervals and so keeps their
asymmetry: for the difference d = e_i - e_1 with limits (l, u) around
each estimate e, the lower limit is
d - sqrt((e_i - l_i)^2 + (u_1 - e_1)^2) and the upper limit is
d + sqrt((u_i - e_i)^2 + (e_1 - l_1)^2). approach = "squareadd"
instead adds the squared standard errors (Altman and Andersen, 1999), the
Z-test difference cardx computes. Ratios always use MOVER on the log
scale. The standard error, statistic and p-value are derived from the
limits.
Arguments
- x
(
formulaorsurvfit)
A formulaSurv(time, event) ~ groupevaluated indata, or a fittedsurvival::survfit()object stratified by one variable. Asurvfitobject keeps its own confidence level.- data
(
data.frame)
The data frame the formula refers to.- time
(
scalar numeric)
The time point.- estimand
(
string)"survival"(the default) or"cuminc", the cumulative incidence1 - survival. Only"cuminc"is available with competing events.- approach
(
string)
For differences,"mover"(the default) or"squareadd".- conf.level
(
scalar numeric)
Confidence level. Default is0.95.- state
(
string)
With competing events, the state whose cumulative incidence is compared. Default is the first state after censoring, with a message.- ...
Not used. Accepted so that the functions can be wrapped in custom methods that receive more arguments.
Value
A data frame with one row per level other than the first: level,
reference (the first level), estimate, std.error (on the log scale
for a ratio), statistic, p.value, conf.low, conf.high and
method.
References
Zou GY, Donner A. Construction of confidence limits about effect measures: a general approach. Stat Med 2008;27:1693-702.
Altman DG, Andersen PK. Calculating the number needed to treat for trials where the outcome is time to an event. BMJ 1999;319:1492-5.
Stopsack KH. rifttable: Results tables to bridge the rift between epidemiologists and their data. R package, https://stopsack.github.io/rifttable/.
See also
Other results tables:
rift_rate(),
rift_risk,
tbl_rift(),
tbl_rift_design
Examples
library(survival)
# Example 1 ----------------------------------
# the difference in 12-month survival, Drug B against Drug A
rift_survival_difference(Surv(ttdeath, death) ~ trt, trial, time = 12)
#> level reference estimate std.error statistic p.value conf.low
#> 1 Drug B Drug A 0.0962406 0.05221127 1.843292 0.06528644 -0.008266038
#> conf.high method
#> 1 0.1963984 Survival difference (MOVER)
# Example 2 ----------------------------------
# the ratio of the 12-month risk of death, from a survfit object
fit <- survfit(Surv(ttdeath, death) ~ grade, trial)
rift_survival_ratio(fit, time = 12, estimand = "cuminc")
#> level reference estimate std.error statistic p.value conf.low conf.high
#> 1 II I 0.560241 0.5107325 -1.13442611 0.2566159 0.1873319 1.387025
#> 2 III I 1.033333 0.4579234 0.07160548 0.9429159 0.4118896 2.479425
#> method
#> 1 Cumulative incidence ratio (MOVER)
#> 2 Cumulative incidence ratio (MOVER)