Learn R Programming

coxinterval (version 1.2)

linapprox: 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

See Also

approx const2lin lin2const

Examples

Run this code
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)))

Run the code above in your browser using DataLab