linapprox {coxinterval}R Documentation

Linear approximation

Description

Perform linear interpolation or extrapolation

Usage

linapprox(xyin, xout)

Arguments

xyin

a matrix whose rows give the coordinate pairs of the points to be interpolated or extrapolated.

xout

a vector of numeric values at which interpolation or extrapolation should take place.

Value

A vector of interpolated or extrapolated values.

See Also

approx const2lin lin2const

Examples

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

[Package coxinterval version 1.2 Index]