Learn R Programming

coxinterval (version 1.2)

const2lin: Accumulate values from a piecewise constant function of time

Description

A utility function for coxdual that integrates values from a piecewise constant function of time.

Usage

const2lin(const, time = "time", stratum = NULL)

Arguments

const
a matrix whose columns give the (possibly multivariate) piecewise constant 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 const. Defaults to "time".
stratum
integer or character value for the column index or name of the stratifying variable in the matrix const. If stratum is NULL (default), const is presumed unstratified.

Value

const.

See Also

lin2const

Examples

Run this code
fit <- coxdual(Surv(start, stop, status) ~ cluster(id)
               + trans(from, to) + z, data = dualrc, init.coxph = TRUE)
haz <- lin2const(fit$basehaz, stratum = 3)
Haz <- const2lin(haz, stratum = 3)
all(Haz == fit$basehaz)

Run the code above in your browser using DataLab