Cox models with time-dependent coefficients and covariates are widely used in
survival analysis. In high-dimensional settings, sparse regularization
techniques are employed for variable selection, but existing methods for
time-dependent Cox models lack flexibility in enforcing specific sparsity
patterns (i.e., covariate structures). We propose a flexible framework for
variable selection in time-dependent Cox models, accommodating complex
selection rules. Our method can adapt to arbitrary grouping structures,
including interaction selection, temporal, spatial, tree, and directed acyclic
graph structures. It achieves accurate estimation with low false alarm rates.
We develop the sox package, implementing a network flow algorithm for
efficiently solving models with complex covariate structures. sox offers a
user-friendly interface for specifying grouping structures and delivers fast
computation. Through examples, including a case study on identifying predictors
of time to all-cause death in atrial fibrillation patients, we demonstrate the
practical application of our method with specific selection rules.