Deep learning survival analysis with time-varying covariates: extending PyCox to assess COVID-19 antiviral treatments and long-COVID associations.

Publication date: Oct 01, 2026

To extend the PyCox to accommodate time-varying covariates using counting process data, addressing immortal time bias in survival analysis. We modified PyCox to support counting process data structures for time-varying covariates and applied it to 2 246 913 Medicare beneficiaries aged ≥65 with COVID-19 (January-September 2022; 2 785 807 longitudinal records). We compared traditional Cox regression, original PyCox, and modified PyCox in estimating associations between early antiviral treatment (nirmatrelvir or molnupiravir) and long-COVID. Performance metrics included concordance index (C-index), integrated Brier score (IBS), and integrated negative binomial log-likelihood (IBLL) and time-dependent Area Under the Receiver Operating Characteristic Curve (AUC), Brier score, and permutation importance. Among patients, 19. 5% received nirmatrelvir, 2. 6% received molnupiravir, and 14% developed long-COVID. Traditional Cox and modified PyCox produced concordant hazard ratios (HR) for nirmatrelvir (0. 874 and 0. 878) and molnupiravir (0. 909 and 0. 918); original PyCox estimated stronger associations (HR = 0. 822 and 0. 879). The treatment-effect difference formed a gradient: 3. 5-4. 0 percentage-points for time-varying models, 4. 6 for time-fixed Cox, and 5. 7 for time-fixed PyCox. Discrimination, calibration, and fit were comparable overall; modified PyCox showed higher time-dependent AUCs (0. 536-0. 609) than time-fixed PyCox (0. 481-0. 519) and relied on largely different top predictors. Modified and original PyCox trained in 1 min 14 s and 3 min 18 s, vs 5 min for traditional Cox. Treatment-contrast magnitude and covariate importance varied by models, suggesting temporal covariate structure and modeling approach jointly influence treatment-effect estimates. Extending PyCox to accommodate time-varying covariates improves computational efficiency while maintaining estimation accuracy comparable to standard time-varying methods.

Open Access PDF

Concepts Keywords
Cox regression model
deep learning
immortal time bias
long-COVID
survival analysis
time-varying covariates
treatment effect estimation

Semantics

Type Source Name
disease MESH COVID-19
disease MESH included
disease MESH IBS
drug DRUGBANK Flunarizine
disease MESH long COVID
disease MESH MD1
drug DRUGBANK Ranitidine
disease MESH recurrence
drug DRUGBANK Isoxaflutole

Original Article

(Visited 2 times, 1 visits today)

Leave a Comment

Your email address will not be published. Required fields are marked *