Capturing Heterogeneous Time-Variation in Covariate Effects in Non-Proportional Hazard Regression Models.
The 1 match
- [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
- # ==============================================================================
- # Capturing heterogeneous time-variation in covariate effects in non-proportional hazard regression models
- # Niklas Hagemann, Thomas Kneib and Kathrin Moellenhoff
- #
- # Code for the case study
- # ==============================================================================
- # Packages =====================================================================
- library(dplyr) # package for data manipulation
- library(pammtools) # package for PEM data transformation
- library(mgcv) # package for fitting GAMs
- library(survival) # package for handling survival datasets
- library(pec) # package for IBS
- # Dataset 1 ====================================================================
- data1 <- read.delim("difg_tcga_gdc_clinical_data.tsv", stringsAsFactors = TRUE)
- data1 <- data1 %>% dplyr::filter(! is.na(Overall.Survival..Months.), ! is.na(Overall.Survival.Status))
- data1$event <- as.numeric(data1$Overall.Survival.Status =="1:DECEASED")
- data1$time <- data1$Overall.Survival..Months.
- names(data1)[c(4)] <- c("Age")
- data1 <- data1 %>% filter(Sample.Type == "Primary solid Tumor")
- data1 <- data1 %>% select(Patient.ID, Age, Fraction.Genome.Altered, Primary.Diagnosis, Sex, event, time)
- # Dataset 2 ====================================================================
- data2 <- read.delim("gbm_tcga_gdc_clinical_data.tsv", stringsAsFactors = TRUE)
- data2 <- data2 %>% dplyr::filter(! is.na(Overall.Survival..Months.), ! is.na(Overall.Survival.Status))
- data2$event <- as.numeric(data2$Overall.Survival.Status =="1:DECEASED")
- data2$time <- data2$Overall.Survival..Months.
- names(data2)[c(4)] <- c("Age")
- data2 <- data2 %>% filter(Sample.Type == "Primary solid Tumor")
- data2 <- data2 %>% select(Patient.ID, Age, Fraction.Genome.Altered, Primary.Diagnosis, Sex, event, time)
- data <- bind_rows(data1, data2)
- # Remove patients with missing values and survival times <0 ====================
- data <- data %>% filter(time >= 0)
- data <- data %>% na.omit()
- # Set survival time to half a day for patients who died on their admission date
- data$time[data$time == 0] <- 1/60
- # Add end of study after 8 years ===============================================
- data$event[data$time >96] <- 0
- data$time[data$time >96] <- 96
- # Transform data for PAMM ======================================================
- data_ped <- data %>% as_ped(Surv(time = time, event = event)~., cut = unique(data$time), id = "id")
- # Fit models ===================================================================
- set.seed(123456)
- model_fs <- pamm(formula = ped_status ~
- s(tend,bs = "ps", k = 12, m = c(3, 1)) +
- s(tend, Primary.Diagnosis, bs = "fs", xt = list(bs = "ps"), k = 12, m = c(3, 1), by = Fraction.Genome.Altered) +
- Age +
- Primary.Diagnosis +
- Sex,
- data = data_ped,
- family = poisson(),
- offset = offset,
- method = "REML")
- set.seed(123456)
- model_add <- pamm(formula = ped_status ~
- s(tend, bs = "ps", k = 12, m = c(3, 1)) +
- s(tend, bs = "ps", k = 12, m = c(3, 1), by = Fraction.Genome.Altered) +
- s(Fraction.Genome.Altered, Primary.Diagnosis, bs = "re") +
- Age +
- Primary.Diagnosis +
- Sex,
- data = data_ped,
- family = poisson(),
- offset = offset,
- method = "REML")
- set.seed(123456)
- model_re <- pamm(formula = ped_status ~
- s(tend,bs = "ps", k = 12, m = c(3, 1)) +
- s(Fraction.Genome.Altered, Primary.Diagnosis, bs = "re") +
- Age +
- Primary.Diagnosis +
- Sex,
- data = data_ped,
- family = poisson(),
- offset = offset,
- method = "REML")
- set.seed(123456)
- model_ps <- pamm(formula = ped_status ~
- s(tend, bs = "ps", k = 12, m = c(3, 1)) +
- s(tend, bs = "ps", k = 12, m = c(3, 1), by = Fraction.Genome.Altered) +
- Age +
- Primary.Diagnosis +
- Sex,
- data = data_ped,
- family = poisson(),
- offset = offset,
- method = "REML")
- set.seed(123456)
- model_linear <- pamm(formula = ped_status ~
- s(tend, bs = "ps", k = 12, m = c(3, 1)) +
- Fraction.Genome.Altered +
- Age +
- Primary.Diagnosis +
- Sex,
- data = data_ped,
- family = poisson(),
- offset = offset,
- method = "REML")
- # Calculate fit measures =======================================================
- pec_fs = pec(model_fs,
- Surv(time, event) ~ 1,
- data = data,
- times = sort(unique(data$time)),
- start = min(unique(data$time)),
- exact = FALSE,
- verbose = FALSE)
- pec_add = pec(model_add,
- Surv(time, event) ~ 1,
- data = data,
- times = sort(unique(data$time)),
- start = min(unique(data$time)),
- exact = FALSE,
- verbose = FALSE)
- pec_ps = pec(model_ps,
- Surv(time, event) ~ 1,
- data = data,
- times = sort(unique(data$time)),
- start = min(unique(data$time)),
- exact = FALSE,
- verbose = FALSE)
- pec_re = pec(model_re,
- Surv(time, event) ~ 1,
- data = data,
- times = sort(unique(data$time)),
- start = min(unique(data$time)),
- exact = FALSE,
- verbose = FALSE)
- pec_lin = pec(model_linear,
- Surv(time, event) ~ 1,
- data = data,
- times = sort(unique(data$time)),
- start = min(unique(data$time)),
- exact = FALSE,
- verbose = FALSE)
- fit_measures <- cbind(c("FS", "ADD", "RE", "PS", "LIN"),
- round(c(logLik(model_fs), logLik(model_add), logLik(model_re), logLik(model_ps), logLik(model_linear)), 2),
- round(c(
- pec::crps(pec_fs)[2,1],
- pec::crps(pec_add)[2,1],
- pec::crps(pec_re)[2,1],
- pec::crps(pec_ps)[2,1],
- pec::crps(pec_lin)[2,1]), 4),
- round(c(AIC(model_fs), AIC(model_add), AIC(model_re), AIC(model_ps), AIC(model_linear)), 2)
- )
- print(fit_measures)
CaseStudy.R at commit cf61eac, no license · at the source
Overview
- Department of Biostatistics, Harvard T.H. Chan School of Public Health, Harvard University, Boston, USA
- Institute of Medical Statistics and Computational Biology, Faculty of Medicine, University of Cologne, Göttingen, Germany
- Chair of Statistics and Campus Institute Data Science, Georg August University Göttingen, Cologne, Germany
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
cf61eaccce784f10ef8502b20efcf295cf8cdb61, 28 July 2025Availability: 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
- CaseStudy.R, R, 174 lines, 1 match
- Simulation.R, R, 259 lines
- pec_bug_fix.R, R, 35 lines
- README.md, Text, 2 lines
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://
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://
BibTeX
@article{hagemann2026cap
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/
url = {https://
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/
VL - 68
IS - 5
SP - e70179
SN - 0323-3847
PB - Wiley
DO - 10.1002/
UR - https://
LA - en
ER -
CSL-JSON
{
"id": "10.1002/
"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":
"volume": "68",
"issue": "5",
"page": "e70179",
"DOI": "10.1002/
"PMID": "42764422",
"PMCID": "PMC13590908",
"ISSN": "0323-3847",
"publisher": "Wiley",
"URL": "https://
"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 methodologyIn 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 diseaseIn 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 medicineIn 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 medicineIn 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: GenesIn 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 reportsIn 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 psychiatryIn 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 AmericaIn 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 oncologyIn 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.
Claim this paper
Correct its record
Say what each link of this record is, remove the ones that are not the paper's, add the ones that are missing. The correction becomes a new version of the record, in its Versions section.
Validate its tracing map
You validate the map as this page shows it: 1 repository of the authors' code, each at its verified commit and with its license, 3 scripts, and 1 match between paragraphs and code (see the Code and Map sections). It then receives a DOI on Zenodo, with you (your ORCID iD) and OSCR as its creators; the code itself is not deposited.
The map's fingerprint: sha256:31f8da69126ada31…
Add the badge to the code's README
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 -->
[](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:endHTML
<!-- 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.
