Learn R Programming

coxinterval (version 1.2)

lin2const: Slopes from values of a piecewise linear function of time

Description

A utility function for coxdual that gives the slope corresponding to values from a piecewise linear function of time.

Usage

lin2const(lin, time = "time", stratum = NULL)

Arguments

lin
a matrix whose columns give the (possibly multivariate) piecewise linear function values, time points and strata.
time
an integer or character value indicating the column index or name of the time variable in the matrix lin. Defaults to "time".
stratum
integer or character value for the column index or name of the stratifying variable in the matrix lin. If stratum is NULL (default), lin is presumed unstratified.

Value

A matrix of the same dimension as lin.

Details

This is a utility function for coxdual.

See Also

const2lin

Examples

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

Run the code above in your browser using DataLab