Learn R Programming

mets (version 1.3.11)

resmean_phreg: Restricted Mean for Stratified Kaplan-Meier or Cox Model

Description

Computes the Restricted Mean Survival Time (RMST) for stratified Kaplan-Meier or stratified Cox models with martingale standard errors.

Usage

resmean_phreg(x, times = NULL, covs = NULL, ...)

Value

An object of class "resmean_phreg" containing:

rmst

Matrix of restricted mean survival times.

se.rmst

Standard errors for RMST.

intkmtimes

Restricted mean at specified times.

years.lost

Years lost (if applicable).

Arguments

x

Object of class "phreg".

times

Possible times for which to report restricted mean. If NULL, reports for all event times.

covs

Possible covariates for Cox model adjustment.

...

Additional arguments passed to lower-level functions.

Author

Thomas Scheike

Details

The standard error is computed using linear interpolation between standard errors at jump-times. This allows plotting the restricted mean as a function of time.

Years lost can be computed based on this and decomposed into years lost for different causes using the cif_yearslost function.

Examples

Run this code
data(bmt)
bmt$time <- bmt$time + runif(408) * 0.001
out1 <- phreg(Surv(time, cause != 0) ~ strata(tcell, platelet), data = bmt)

rm1 <- resmean_phreg(out1, times = 10 * (1:6))
summary(rm1)
e1 <- estimate(rm1)
par(mfrow = c(1, 2))
plot(rm1, se = 1)
plot(rm1, years.lost = TRUE, se = 1)

## Comparing populations
rm1 <- resmean_phreg(out1, times = 40)
e1 <- estimate(rm1)
estimate(e1, rbind(c(1, -1, 0, 0)))

Run the code above in your browser using DataLab