Skip to contents

Integrates the Kaplan-Meier survival curve from zero to the prespecified horizon tau. The standard error uses Greenwood's plug-in variance for the restricted mean; the optional Wald limits are clipped to the mathematical range zero to tau. These limits can perform poorly in small or heavily censored samples and are not a substitute for a study-specific analysis. Events exactly at tau contribute no area after the event. Events at time zero are incorporated immediately.

Usage

epi_rmst(.data, time, event, tau, conf_level = 0.95)

Arguments

.data

An ungrouped data frame with one row per individual.

time

Non-negative observed follow-up time.

event

Binary event indicator, 1 for the event, 0 for censoring.

tau

Positive restriction horizon, no greater than maximum follow-up.

conf_level

Confidence level strictly between zero and one.

Value

A one-row tibble containing the horizon, RMST, Greenwood standard error, clipped Wald confidence limits, sample size, and the number at risk and events before the horizon.

Details

Independent individuals and non-informative censoring are assumed. tau cannot exceed the maximum observed follow-up, but merely meeting this rule does not ensure adequate tail support: inspect the number at risk and choose the horizon before comparing groups. If no event occurs before tau, the Greenwood standard error is zero, which does not imply certainty under heavy censoring. There is no left truncation, competing-risk adjustment, weighting, covariate adjustment, clustering or comparison between groups.

Examples

d <- data.frame(t = c(1, 2, 3, 4, 5, 6), e = c(1, 0, 1, 0, 1, 0))
epi_rmst(d, t, e, tau = 5)
#> # A tibble: 1 × 9
#>     tau estimate std_error conf_low conf_high     n n_risk events_before_tau
#>   <dbl>    <dbl>     <dbl>    <dbl>     <dbl> <int>  <int>             <dbl>
#> 1     5     3.92     0.643     2.66         5     6      2                 2
#> # ℹ 1 more variable: conf_level <dbl>