Keywords: Cox model, multi-state model, time-dependent
A common task in time-to-event analysis is the creation of multiple start/stop intervals for each subject, along with the covariate values that apply over that interval. There are a lot of ways to program this incorrectly, so tools and procedures for the task are important. We introduce the function ‘tmerge’ in the ‘survival’ package in R, which is based on the idea of sequential insertion. It aids in the creation of the data sets needed for analysis of time-dependent covariates, multiple outcomes per subject, competing risks and multistate models. The ‘tmerge’ function is very flexible and greatly reduces the effort usually expended to create these data sets. In addition, it is a useful tool for examining data checks related to date ordering. Examples involving several different contexts for use of the function will be discussed.