Learn R Programming

mets (version 1.3.11)

recurrent_marginal: Marginal mean estimation for recurrent events with a terminal event

Description

Estimates the marginal mean number of recurrent events over time in the presence of a competing terminal event (e.g. death), using the nonparametric estimator of Ghosh and Lin (2000). Two proportional hazards models are fitted internally—one for the recurrent event rate and one for the terminal event—and combined to form the estimator $$\mu(t) = \int_0^t S(u-)\,dR(u),$$ where \(S(u)\) is the marginal survival probability at the baseline covariate level and \(dR(u)\) is the baseline recurrent event rate among survivors. Robust (sandwich) standard errors are computed via the influence-function approach of Ghosh and Lin (2000).

Usage

recurrent_marginal(formula, data, cause = 1, ..., death.code = 2, test = FALSE)

recurrentMarginal(formula, data, ...)

Value

An object of class "recurrent" with the following components:

mu

Estimated marginal mean \(\mu(t)\) at each jump time.

se.mu

Robust standard error of mu.

times

Jump times at which estimates are computed.

St

Marginal survival estimate \(S(t)\) at each jump time.

cumhaz

Two-column matrix of (time, mu), suitable for plotting.

se.cumhaz

Two-column matrix of (time, se.mu).

The object carries three attributes: "logrank" (the test result when

test = TRUE, otherwise NULL), "cause", and

"death.code".

Arguments

formula

A formula with an Event response on the left-hand side, specifying entry time, exit time, and event status. The right-hand side may include cluster() to identify subjects and strata() for a stratified analysis. A cluster() term is required.

data

A data frame containing all variables in formula.

cause

Integer code(s) for the recurrent event of interest. Default is 1.

...

Further arguments passed to phreg.

death.code

Integer code(s) for the terminal event. Default is 2.

test

Logical. If TRUE, a logrank-type test comparing strata is computed and stored as an attribute of the result. Default is FALSE.

Author

Thomas Scheike

Details

Jump times must be unique within each stratum. If ties are present, use tie_breaker to resolve them before calling this function.

References

Cook, R. J. and Lawless, J. F. (1997). Marginal analysis of recurrent events and a terminating event. Statistics in Medicine, 16, 911--924.

Ghosh, D. and Lin, D. Y. (2000). Nonparametric analysis of recurrent events and death. Biometrics, 56, 554--562.

See Also

test_logrankRecurrent, tie_breaker, prob_exceed_recurrent

Examples

Run this code
data(hfactioncpx12)
hf <- hfactioncpx12
hf$x <- as.numeric(hf$treatment)

## Fit nonparametric baseline models for recurrent events and death
xr <- phreg(Surv(entry, time, status == 1) ~ cluster(id), data = hf)
dr <- phreg(Surv(entry, time, status == 2) ~ cluster(id), data = hf)

par(mfrow = c(1, 3))
plot(dr, se = TRUE); title(main = "Death")
plot(xr, se = TRUE); title(main = "Recurrent events")

## Compare naive and robust standard errors for the recurrent event rate
rxr <- robust_phreg(xr, fixbeta = 1)
plot(rxr, se = TRUE, robust = TRUE, add = TRUE, col = 4)

## Marginal mean via formula interface
outN <- recurrent_marginal(Event(entry, time, status) ~ cluster(id),
                           data = hf, cause = 1, death.code = 2)
plot(outN, se = TRUE, col = 2, add = TRUE)
summary(outN, times = 1:5)

## Stratified analysis with logrank test
out <- recurrent_marginal(Event(entry, time, status) ~ strata(treatment) + cluster(id),
                          data = hf, cause = 1, death.code = 2, test = TRUE)
plot(out, se = TRUE, ylab = "Marginal mean", col = 1:2)
attr(out, "logrank")
summary(out, times = 1:5)

## Influence-function (iid) decomposition at a fixed time point
head(iid(outN, time = 3))

Run the code above in your browser using DataLab