lin2const {coxinterval}R Documentation

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.

Details

This is a utility function for coxdual.

Value

A matrix of the same dimension as lin.

See Also

const2lin

Examples

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)

[Package coxinterval version 1.2 Index]