Step function from cumulative increments over time

Share:

Description

A utility function for that returns a step function given cumulative increments over time.

Usage

1
step2stepfun(step, time = "time", stratum = NULL)

Arguments

step

a matrix whose columns give the (possibly multivariate) step function values, corresponding time points and strata.

time

an integer or character value indicating the column index or name of the time variable in the matrix step. Defaults to "time".

stratum

integer or character value for the column index or name of the stratifying variable in the matrix step. If stratum is NULL (default), step is presumed unstratified.

Value

A function that returns cumulative increments for given times. If stratified, a list of such functions given in the same order as the strata.

See Also

jump2step step2jump

Examples

1
2
3
4
5
6
fit <- coxdual(Surv(start, stop, status) ~ cluster(id)
               + trans(from, to) + z, data = dualrc, init.coxph = TRUE)
head(fit$coxph$basehaz)
Hazfun <- step2stepfun(fit$coxph$basehaz, stratum = 3)
Haz01 <- with(fit$coxph, split(basehaz[, 1:2], basehaz[, 3]))[[1]]
all(Hazfun[[1]](Haz01$time) == Haz01$hazard)