splineCox {dynsurv}  R Documentation 
Rearrange the rignt censored survival data in a counting process style.
Model the timevarying coefficient function using Bsplines. The fit is
done by introducing pseudo timedependent covariates and then calling
function coxph
in survival package.
splineCox(formula, data, control = list())
formula 
A formula object, with the response on the left of a '~'
operator, and the terms on the right. The response must be a survival
object as returned by the 
data 
A data.frame in which to interpret the variables named in the

control 
List of control options. 
The control
argument is a list of components:
degree of freedom for the Bsplines, default 5;
interior knots point, default NULL
. If
NULL
, the knots will be automatically choosen;
lower and upper boundaries for the spline
function, default NULL
. If NULL
, the minimun
and maximun finite event time or censoring time will be
specified.
An object of S3 class splineCox
representing the fit.
This function is essentially a wrapper function of coxph
for
the expanded data set. It does not implements the algorithm disscussed in
the reference paper. These authors implemented their algorithm into a
tvcox
package, which is more efficient for larger data set, but may
not be stable compared to coxph
.
Perperoglou, A., le Cessie, S., & van Houwelingen, H. C. (2006). A fast routine for fitting Cox models with time varying effects of the covariates. Computer Methods and Programs in Biomedicine, 81(2), 154–161.
## Not run:
## Attach the veteran data from the survival package
mydata < survival::veteran
mydata$celltype < relevel(mydata$celltype, ref = "large")
myformula < Surv(time, status) ~ karno + celltype
## Fit the timevarying transformation model
fit < splineCox(myformula, mydata, control = list(df = 5))
## Plot the timevarying coefficient function between two time points
plotCoef(subset(coef(fit), Time > 15 & Time < 175), smooth = TRUE)
## End(Not run)