Home > Teaching > Tutorials > Survival Analysis in R

time.dep.coxph(d.f, col.time, col.delta, col.cov, td.cov, transform=log, method='efron', output.model=TRUE, output.data.frame=FALSE, verbose=TRUE)

This function is used to construct a time-dependent Cox PH model matrix and also run the model. The function is limited to the case where one covariate is being made into a time-dependent covariate. That is, if there is a covariate Zi that is to be transformed into a new time-dependent covariate of the form Zi.new(t) = Zi*transformation(t), where the default transformation is log.


d.f :: A data frame containing the event/censoring times, a column indicating whether the event was observed, and covariates. Each row is an observation. It is okay for more covariates to be in the dataframe than are to be included in the model.

col.time :: The column name or number in d.f that designates the event/censoring times.

col.delta :: The column name or number in d.f that indicates what times were observed.

col.cov :: A vector of the column names or numbers in d.f designating the covariates to be included in the model.

td.cov :: The column name or number in d.f that indicates the covariate to be made time-dependent (the Zi)

transform :: The transformation to be used on time (this must be a function with one argument). The result is multiplied by Zi. The default transformation is log.

method :: The method to be used in the Cox PH model. Options include 'efron' (the default), 'breslow', and 'exact'.

output.model :: Indicates whether the Cox PH model should be output (the default is TRUE).

output.data.frame :: Indicates whether the new time-dependent data frame that was constructed should be output (the default is FALSE).

verbose :: Indicates whether the user should be notified of how far along the function is to completing the data frame (this is useful when the function will take a long time due to a lot of data).