OSCR

Capturing Heterogeneous Time-Variation in Covariate Effects in Non-Proportional Hazard Regression Models.

Code ↔ Paper

1 match between paragraphs of the paper and lines of its authors' code, computed by the harvester (lexical-v1). Click a colored paragraph or line to see its counterpart.

The 1 match
  1. [1] § Brain Tumor Case Study ↔ CaseStudy.R, lines 41 to 119 · score 0.58 · admission, day, died, fraction, age, genome · Report a mismatch

Paper

Loaded from Europe PMC by your browser; OSCR does not store it: doi.org · Europe PMC

The paper is loaded when this pane is shown.

The authors' code

R · 174 lines · 6.8 KB · no license · 1 match

  1. # ==============================================================================
  2. # Capturing heterogeneous time-variation in covariate effects in non-proportional hazard regression models
  3. # Niklas Hagemann, Thomas Kneib and Kathrin Moellenhoff
  4. #
  5. # Code for the case study
  6. # ==============================================================================
  7. # Packages =====================================================================
  8. library(dplyr) # package for data manipulation
  9. library(pammtools) # package for PEM data transformation
  10. library(mgcv) # package for fitting GAMs
  11. library(survival) # package for handling survival datasets
  12. library(pec) # package for IBS
  13. # Dataset 1 ====================================================================
  14. data1 <- read.delim("difg_tcga_gdc_clinical_data.tsv", stringsAsFactors = TRUE)
  15. data1 <- data1 %>% dplyr::filter(! is.na(Overall.Survival..Months.), ! is.na(Overall.Survival.Status))
  16. data1$event <- as.numeric(data1$Overall.Survival.Status =="1:DECEASED")
  17. data1$time <- data1$Overall.Survival..Months.
  18. names(data1)[c(4)] <- c("Age")
  19. data1 <- data1 %>% filter(Sample.Type == "Primary solid Tumor")
  20. data1 <- data1 %>% select(Patient.ID, Age, Fraction.Genome.Altered, Primary.Diagnosis, Sex, event, time)
  21. # Dataset 2 ====================================================================
  22. data2 <- read.delim("gbm_tcga_gdc_clinical_data.tsv", stringsAsFactors = TRUE)
  23. data2 <- data2 %>% dplyr::filter(! is.na(Overall.Survival..Months.), ! is.na(Overall.Survival.Status))
  24. data2$event <- as.numeric(data2$Overall.Survival.Status =="1:DECEASED")
  25. data2$time <- data2$Overall.Survival..Months.
  26. names(data2)[c(4)] <- c("Age")
  27. data2 <- data2 %>% filter(Sample.Type == "Primary solid Tumor")
  28. data2 <- data2 %>% select(Patient.ID, Age, Fraction.Genome.Altered, Primary.Diagnosis, Sex, event, time)
  29. data <- bind_rows(data1, data2)
  30. # Remove patients with missing values and survival times <0 ====================
  31. data <- data %>% filter(time >= 0)
  32. data <- data %>% na.omit()
  33. # Set survival time to half a day for patients who died on their admission date
  34. data$time[data$time == 0] <- 1/60
  35. # Add end of study after 8 years ===============================================
  36. data$event[data$time >96] <- 0
  37. data$time[data$time >96] <- 96
  38. # Transform data for PAMM ======================================================
  39. data_ped <- data %>% as_ped(Surv(time = time, event = event)~., cut = unique(data$time), id = "id")
  40. # Fit models ===================================================================
  41. set.seed(123456)
  42. model_fs <- pamm(formula = ped_status ~
  43. s(tend,bs = "ps", k = 12, m = c(3, 1)) +
  44. s(tend, Primary.Diagnosis, bs = "fs", xt = list(bs = "ps"), k = 12, m = c(3, 1), by = Fraction.Genome.Altered) +
  45. Age +
  46. Primary.Diagnosis +
  47. Sex,
  48. data = data_ped,
  49. family = poisson(),
  50. offset = offset,
  51. method = "REML")
  52. set.seed(123456)
  53. model_add <- pamm(formula = ped_status ~
  54. s(tend, bs = "ps", k = 12, m = c(3, 1)) +
  55. s(tend, bs = "ps", k = 12, m = c(3, 1), by = Fraction.Genome.Altered) +
  56. s(Fraction.Genome.Altered, Primary.Diagnosis, bs = "re") +
  57. Age +
  58. Primary.Diagnosis +
  59. Sex,
  60. data = data_ped,
  61. family = poisson(),
  62. offset = offset,
  63. method = "REML")
  64. set.seed(123456)
  65. model_re <- pamm(formula = ped_status ~
  66. s(tend,bs = "ps", k = 12, m = c(3, 1)) +
  67. s(Fraction.Genome.Altered, Primary.Diagnosis, bs = "re") +
  68. Age +
  69. Primary.Diagnosis +
  70. Sex,
  71. data = data_ped,
  72. family = poisson(),
  73. offset = offset,
  74. method = "REML")
  75. set.seed(123456)
  76. model_ps <- pamm(formula = ped_status ~
  77. s(tend, bs = "ps", k = 12, m = c(3, 1)) +
  78. s(tend, bs = "ps", k = 12, m = c(3, 1), by = Fraction.Genome.Altered) +
  79. Age +
  80. Primary.Diagnosis +
  81. Sex,
  82. data = data_ped,
  83. family = poisson(),
  84. offset = offset,
  85. method = "REML")
  86. set.seed(123456)
  87. model_linear <- pamm(formula = ped_status ~
  88. s(tend, bs = "ps", k = 12, m = c(3, 1)) +
  89. Fraction.Genome.Altered +
  90. Age +
  91. Primary.Diagnosis +
  92. Sex,
  93. data = data_ped,
  94. family = poisson(),
  95. offset = offset,
  96. method = "REML")
  97. # Calculate fit measures =======================================================
  98. pec_fs = pec(model_fs,
  99. Surv(time, event) ~ 1,
  100. data = data,
  101. times = sort(unique(data$time)),
  102. start = min(unique(data$time)),
  103. exact = FALSE,
  104. verbose = FALSE)
  105. pec_add = pec(model_add,
  106. Surv(time, event) ~ 1,
  107. data = data,
  108. times = sort(unique(data$time)),
  109. start = min(unique(data$time)),
  110. exact = FALSE,
  111. verbose = FALSE)
  112. pec_ps = pec(model_ps,
  113. Surv(time, event) ~ 1,
  114. data = data,
  115. times = sort(unique(data$time)),
  116. start = min(unique(data$time)),
  117. exact = FALSE,
  118. verbose = FALSE)
  119. pec_re = pec(model_re,
  120. Surv(time, event) ~ 1,
  121. data = data,
  122. times = sort(unique(data$time)),
  123. start = min(unique(data$time)),
  124. exact = FALSE,
  125. verbose = FALSE)
  126. pec_lin = pec(model_linear,
  127. Surv(time, event) ~ 1,
  128. data = data,
  129. times = sort(unique(data$time)),
  130. start = min(unique(data$time)),
  131. exact = FALSE,
  132. verbose = FALSE)
  133. fit_measures <- cbind(c("FS", "ADD", "RE", "PS", "LIN"),
  134. round(c(logLik(model_fs), logLik(model_add), logLik(model_re), logLik(model_ps), logLik(model_linear)), 2),
  135. round(c(
  136. pec::crps(pec_fs)[2,1],
  137. pec::crps(pec_add)[2,1],
  138. pec::crps(pec_re)[2,1],
  139. pec::crps(pec_ps)[2,1],
  140. pec::crps(pec_lin)[2,1]), 4),
  141. round(c(AIC(model_fs), AIC(model_add), AIC(model_re), AIC(model_ps), AIC(model_linear)), 2)
  142. )
  143. print(fit_measures)

CaseStudy.R at commit cf61eac, no license · at the source

Overview

  1. Department of Biostatistics, Harvard T.H. Chan School of Public Health, Harvard University, Boston, USA
  2. Institute of Medical Statistics and Computational Biology, Faculty of Medicine, University of Cologne, Göttingen, Germany
  3. Chair of Statistics and Campus Institute Data Science, Georg August University Göttingen, Cologne, Germany
Institutions: Harvard University (United States); University of Cologne (Germany); Campus-Institut Data Science (CIDAS) (Germany); University of Göttingen (Germany)
Journal: Biometrical journal. Biometrische Zeitschrift, volume 68, issue 5, article e70179
Dates: received 10 December 2025; accepted 30 July 2026; published online 20 September 2026; in print October 2026
Type: Research article · Language: English
License: CC BY
Identifiers: DOI 10.1002/bimj.70179 · PMID 42764422 · PMCID PMC13590908 · OpenAlex W4406786254
Open access: hybrid, a free copy (OpenAlex)
Status: code verified (how the code is found and verified)
Categories: human (organism), clinical / translational (subfield)
Methods: Statistics
Keywords: effect heterogeneity, factor smooth interactions, functional random coefficients, functional random effects, hazard regression, non‐proportional hazards, piecewise exponential model, penalized splines, random wiggly curves, time‐varying effects
MeSH: Biometry*, Models, Statistical*, Humans, Proportional Hazards Models, Regression Analysis, Survival Analysis, Time Factors (* major topic)
Topic: Risk and Safety Analysis (Statistics, Probability and Uncertainty, Decision Sciences), according to OpenAlex
Funding: Deutsche Forschungsgemeinschaft (RTG 2624, 427806116)
Citations: not cited yet (Europe PMC); 45 references in the paper

Abstract

A central focus in survival analysis is examining how covariates affect survival time. These covariate effects are often found to be either time‐varying, heterogeneous—such as being specific to patients, treatments, or subgroups—or exhibit both characteristics simultaneously. While the standard model, the Cox proportional hazards model, allows neither time‐varying nor heterogeneous effects, several extensions to the Cox model as well as alternative modeling frameworks have been introduced. However, no unified framework for incorporating heterogeneously time‐varying effects of covariates has been proposed. Such effects occur when a covariate affects survival not only in a heterogeneous and time‐varying manner, but when the time‐variation is also heterogeneous. We propose to model such effects by introducing heterogeneously time‐varying coefficients to piecewise exponential additive mixed models. We deploy functional random effects, also known as factor smooths, to model such coefficients as the interaction effect of heterogeneity and time‐variation. Our approach allows for non‐linear time‐effects due to being based on penalized splines and uses an efficient random effects basis to model the heterogeneity. Using a penalized basis prevents overfitting in case of absence of such effects. In addition, the penalization mostly solves the problem of choosing the number of intervals which is usually present in unregularized piecewise exponential approaches. We demonstrate the superiority of our approach in comparison to competitors by means of a simulation study. Finally, the practical application and relevance are outlined by presenting a brain tumor case study.

Reproduced under the paper's license (CC BY), from the paper cited above.

Repository

Its files are read in the Code ↔ Paper reader above, with 1 match between paragraphs and lines of code.

Niklas191/heterogeneous_time-variation

License: none: the authors keep all their rights
State: the link answers, verified on 31 October 2026
Evidence: files inventoried
Commit: cf61eaccce784f10ef8502b20efcf295cf8cdb61, 28 July 2025
Languages: R (3)
Size: 5 files, 3 scripts
Software Heritage: not archived
Found in: “Data Availability Statement”
Holds: README
Not found: license file, CITATION.cff, environment file, tests, continuous integration, documentation
Tools: mgcv (2 files), survival (2 files), tidyverse (2 files)
Availability: 2 checks, the latest on 31 October 2026: the link answers
  • 31 October 2026: the link answers
  • 1 October 2026: the link answers
4 files

The paper's code and data availability statement is in the Data section.

Tracing map

Proposed by the machine: these links were found in the paper and verified at the source, without human review. The map will receive a Zenodo DOI once one of the paper's authors has validated it with their ORCID.

What the map holds:

  • 1 repository of the authors' code, each at its verified commit, with its license and how the link was found in the paper;
  • 3 scripts, each with its path and the digest of its content;
  • 1 match between paragraphs of the paper and lines of the code (method lexical-v1);
  • neither the text of the paper nor the code itself.

Its JSON (tracing-map.json) is deposited on Zenodo with its DOI once the map is validated.

Data

No dataset and no data link were found in the paper.

Data Availability Statement

The R code and data necessary to reproduce the reported results, figures, and tables are available in the Supporting Information. All R functions are also available at https://github.com/Niklas191/heterogeneous_time‐variation (https://github.com/Niklas191/heterogeneous_time-variation). The current version of the case study data set is publicly available at the cBioPortal database with IDs gbm_tcga_gdc (https://www.cbioportal.org/study/clinicalData?id=gbm_tcga_gdc) and difg_tcga_gdc (https://www.cbioportal.org/study/clinicalData?id=difg_tcga_gdc).

Reproduced under the paper's license (CC BY), from the paper cited above.

Versions

The history of this record: each version stored by the harvester or made by a correction of its authors or of the maintainers of its code, and what changed in its facts. The texts of the paper (its abstract, its availability statements) are not part of it; versions that changed only those are not listed.

Version 1, 1 October 2026: the first record

Recorded: type, language, journal, volume, issue, pages, dates, 3 authors, 10 keywords, 7 MeSH terms, 1 funder, 17 references.

Cite

This paper

Hagemann, N., Kneib, T., & Möllenhoff, K. (2026). Capturing Heterogeneous Time-Variation in Covariate Effects in Non-Proportional Hazard Regression Models. Biometrical journal. Biometrische Zeitschrift, 68(5), e70179. https://doi.org/10.1002/bimj.70179

BibTeX

@article{hagemann2026capturing,
author = {Hagemann, Niklas and Kneib, Thomas and Möllenhoff, Kathrin},
title = {{Capturing Heterogeneous Time-Variation in Covariate Effects in Non-Proportional Hazard Regression Models}},
journal = {Biometrical journal. Biometrische Zeitschrift},
year = {2026},
month = oct,
volume = {68},
number = {5},
pages = {e70179},
publisher = {Wiley},
issn = {0323-3847},
doi = {10.1002/bimj.70179},
url = {https://doi.org/10.1002/bimj.70179},
pmid = {42764422},
pmcid = {PMC13590908}
}

RIS

TY - JOUR
AU - Hagemann, Niklas
AU - Kneib, Thomas
AU - Möllenhoff, Kathrin
TI - Capturing Heterogeneous Time-Variation in Covariate Effects in Non-Proportional Hazard Regression Models
T2 - Biometrical journal. Biometrische Zeitschrift
J2 - Biom J
PY - 2026
DA - 2026/10/01
VL - 68
IS - 5
SP - e70179
SN - 0323-3847
PB - Wiley
DO - 10.1002/bimj.70179
UR - https://doi.org/10.1002/bimj.70179
LA - en
ER -

CSL-JSON

{
"id": "10.1002/bimj.70179",
"type": "article-journal",
"title": "Capturing Heterogeneous Time-Variation in Covariate Effects in Non-Proportional Hazard Regression Models",
"container-title": "Biometrical journal. Biometrische Zeitschrift",
"author": [
{
"family": "Hagemann",
"given": "Niklas"
},
{
"family": "Kneib",
"given": "Thomas"
},
{
"family": "Möllenhoff",
"given": "Kathrin"
}
],
"container-title-short": "Biom J",
"volume": "68",
"issue": "5",
"page": "e70179",
"DOI": "10.1002/bimj.70179",
"PMID": "42764422",
"PMCID": "PMC13590908",
"ISSN": "0323-3847",
"publisher": "Wiley",
"URL": "https://doi.org/10.1002/bimj.70179",
"language": "en",
"issued": {
"date-parts": [
[
2026,
10,
1
]
]
}
}

The tracing map gets a citation of its own once an author has validated it and it has a DOI.

Similar papers

The papers with a page that share the most with this one: the tools found in their code, their categories, datasets, cited references and authors, the rarest counting most.

[1] doi:10.1186/s12874-026-03050-5 [code]
A comprehensive simulation study evaluating the predictive performance of Cox proportional hazards model and machine learning methods for time-to-event data.
Journal: BMC medical research methodology
In common: survival, tidyverse, 2 references
[2] doi:10.1038/s41531-025-01033-9 [code]
Physical activity and network attack tolerance preserve motor function in Parkinson's disease: A pilot study.
Journal: NPJ Parkinson's disease
In common: author Niklas Hagemann
[3] doi:10.1186/s12967-025-06402-9 [code]
Construction of enhanced MRI-based radiomics models using machine learning algorithms for non-invasive prediction of IL7R expression in high-grade gliomas and its prognostic value in clinical practice.
Journal: Journal of translational medicine
In common: mgcv, survival, tidyverse, clinical / translational
[4] doi:10.1038/s43856-023-00276-y [code]
Multimodal deep learning to predict prognosis in adult and pediatric brain tumors.
Journal: Communications medicine
In common: survival, clinical / translational, 2 references
[5] doi:10.3390/genes16050473 [code]
Enhancing Prognostic Signatures in Glioblastoma with Feature Selection and Regularised Cox Regression.
Journal: Genes
In common: survival, tidyverse, clinical / translational, 1 reference
[6] doi:10.1093/bioinformatics/btag592 [code]
Network-based stratification of allele-specific expression reveals patient subgroups in Huntington's disease.
Journal: Bioinformatics (Oxford, England)
In common: mgcv, survival, tidyverse
[7] doi:10.1038/s41598-025-18184-7 [code]
Benchmarking the utility of dry-electrode electroencephalography for clinical trials.
Journal: Scientific reports
In common: mgcv, survival, tidyverse
[8] doi:10.1038/s41398-025-03392-6 [code]
Computational modelling and neural correlates of reinforcement learning following three-week escitalopram: a double-blind, placebo-controlled semi-randomised study.
Journal: Translational psychiatry
In common: mgcv, survival, tidyverse
[9] doi:10.1073/pnas.2215192120 [code]
Elevated dementia risk, cognitive decline, and hippocampal atrophy in multisite chronic pain.
Journal: Proceedings of the National Academy of Sciences of the United States of America
In common: mgcv, survival, tidyverse
[10] doi:10.1038/s41698-025-00909-6 [code]
Diagnostic and prognostic potential of cell-free RNAs in cerebrospinal fluid and plasma for brain tumors.
Journal: NPJ precision oncology
In common: survival, tidyverse, clinical / translational, 1 reference

Contribute

The authors of this paper can claim it, correct its record and validate its tracing map, and the maintainers of its code (its owner, or a public member of its organization) correct what it says of their repository; anyone signed in can ask for its removal. Every request goes to OSCR's own machine, which answers it; your account page follows them.

Sign in with ORCID to claim this paper as one of its authors, correct its record or validate its tracing map: when the paper's metadata lists your ORCID iD, you are recognized at once. Maintainers of its code: sign in with GitHub, then claim the repository on your account page.

Add the badge to the code's README

OSCR: the badge of this paper

If you are an author or a maintainer of this paper's code, you can add this badge. It says what OSCR knows of the paper (its code, its validated tracing map) and links the code to this page. Paste one of these snippets under the README's title. Keep the two marks around it, so that the badge can be replaced in place and is never added twice. OSCR changes nothing in your repository.

Markdown
<!-- oscr-badge:start -->
[![OSCR](https://openscicode.org/badge/doi/10.1002/bimj.70179.svg)](https://openscicode.org/badge/doi/10.1002/bimj.70179)
<!-- oscr-badge:end -->
reStructuredText
.. oscr-badge:start

.. image:: https://openscicode.org/badge/doi/10.1002/bimj.70179.svg
   :target: https://openscicode.org/badge/doi/10.1002/bimj.70179
   :alt: OSCR

.. oscr-badge:end
HTML
<!-- oscr-badge:start -->
<a href="https://openscicode.org/badge/doi/10.1002/bimj.70179"><img src="https://openscicode.org/badge/doi/10.1002/bimj.70179.svg" alt="OSCR"></a>
<!-- oscr-badge:end -->

On GitHub, open the README, choose Edit (the pencil), paste the snippet under the title, then "Commit changes".

If you choose to, you can have the badge kept up to date for you, with oscr badge --write from the command line or with the GitHub Action in your repository's workflows. Every other form and option (a card, AsciiDoc, LaTeX, shields.io) is on the badge page.

Request its removal

To ask OSCR to remove this record, the copies of its authors' scripts or its tracing map, use the removal request page: signed in, you say who you are, what to remove and why, then review and confirm the request. Published rules decide every request (how).

Discussion, reproductions, activity

Discussion: code errors and mismatches between the code and the paper about this paper and its code, from readers and its authors, beside the paper and its tracing map.

Report a mismatch between the code and the paper · Report a code error (signed in)

Reproductions: reports from readers who ran the authors' code and did not get the paper's result, what they ran, with which environment, commit and data.

Report a reproduction failure (signed in)

Versions of its code: the releases of its code tied to a version of this paper (the preprint, the accepted manuscript, the version of record…), each with the tracing map versioned with it.

Activity: what happens around this paper: new versions of its record, its map's validation, discussions and reproductions. It opens with sign-in.