Systematic fMRI signal differences across cohorts alter lifespan trajectories of functional brain networks.
The 2 matches
- [1] § Methods › Data harmonization ↔ R/R/combat.R, lines 12–70 · score 0.52 · batch factor, ComBat, variance, harmonization, covariates, model
- [2] § Methods › Data harmonization ↔ R/R/covbat.R, lines 11–80 · score 0.51 · CovBat, ComBat, variance, harmonization, covariates, model
Paper
Loaded from Europe PMC by your browser, not stored by OSCR: doi.org · Europe PMC
The paper is loaded when this pane is shown.
The authors' code
R · 220 lines · 8.4 KB · no license · 1 match
- # Author: Jean-Philippe Fortin, [email hidden]
- # This is a modification of the ComBat function code from the sva package that
- # can be found at https://bioconductor.org/packages/release/bioc/html/sva.html
- # The original and present code is under the Artistic License 2.0.
- # If using this code, make sure you agree and accept this license.
- # Code optimization improved by Richard Beare
- # Modified by Andrew Chen for covbat.R
- # Added functionality to use only training data as input and to have
- # residualized observations as output
- #' Combatting batch effects when combining batches of gene expression microarray
- #' data
- #'
- #' \code{combat} is a modified version of the ComBat code written by
- #' Jean-Philippe Fortin available at
- #' \url{https://github.com/Jfortin1/ComBatHarmonization/}. The function
- #' harmonizes the mean and variance of observations across sites under an
- #' empirical Bayes framework. \code{combat} additionally includes options
- #' to output residualized observations, estimate coefficients using a training
- #' subset, and regress out unwanted confounders.
- #'
- #' @param dat A \emph{p x n} matrix (or object coercible by \link[base]{as.matrix}
- #' to a numeric matrix) of observations where \emph{p} is the number of
- #' features and \emph{n} is the number of subjects.
- #' @param batch Factor (or object coercible by \link[base]{as.factor} to a
- #' factor) designating batch IDs.
- #' @param mod An optional design matrix to preserve, usually output of
- #' \link[stats]{model.matrix}.
- #' @param nuisance.mod An optional design matrix to regress out, usually output
- #' of \link[stats]{model.matrix} without intercept.
- #' @param train Optional logical vector specifying subset of observations used
- #' to estimate coefficients.
- #' @param resid Whether to leave intercept and covariates regressed out.
- #' @param eb If \code{TRUE}, uses ComBat model with empirical Bayes.
- #' @param parametric If \code{TRUE}, uses parametric updates.
- #' @param mean.only If \code{TRUE}, ComBat step does not harmonize variance.
- #' @param verbose Whether additional details are printed to console.
- #'
- #' @return
- #' @export
- #'
- #' @examples
- #'
- #' @seealso Modification to ComBat to regress out unwanted confounders
- #' proposed by Wachinger et al. (2020), \url{https://arxiv.org/abs/2002.05049}
- combat <- function(dat, batch, mod = NULL, nuisance.mod = NULL,
- train = NULL, resid = FALSE, eb = TRUE,
- parametric = TRUE, mean.only = FALSE, verbose = FALSE)
- {
- dat <- as.matrix(dat)
- .checkConstantRows <- function(dat){
- sds <- rowSds(dat)
- ns <- sum(sds==0)
- if (ns>0){
- message <- paste0(ns, " rows (features) were found to be constant across samples. Please remove these rows before running ComBat.")
- stop(message)
- }
- }
- .checkConstantRows(dat)
- if (eb){
- if (verbose) cat("[combat] Performing ComBat with empirical Bayes\n")
- } else {
- if (verbose) cat("[combat] Performing ComBat without empirical Bayes (L/S model)\n")
- }
- # make batch a factor and make a set of indicators for batch
- batch <- as.factor(batch)
- batchmod <- model.matrix(~-1+batch)
- if (verbose) cat("[combat] Found",nlevels(batch),'batches\n')
- # add nuisance mod to mod, if specified
- if (!is.null(nuisance.mod)) {
- mod <- cbind(mod, nuisance.mod)
- }
- # A few other characteristics on the batches
- n.batch <- nlevels(batch)
- batches <- lapply(levels(batch), function(x)which(batch==x))
- n.batches <- sapply(batches, length)
- n.array <- sum(n.batches)
- #combine batch variable and covariates
- design <- cbind(batchmod,mod)
- # check for intercept in covariates, and drop if present
- check <- apply(design, 2, function(x) all(x == 1))
- design <- as.matrix(design[,!check])
- # Number of covariates or covariate levels
- if (verbose) cat("[combat] Adjusting for",ncol(design)-ncol(batchmod),'covariate(s) or covariate level(s)\n')
- # Check if the design is confounded
- if(qr(design)$rank<ncol(design)){
- if(ncol(design)==(n.batch+1)){
- stop("[combat] The covariate is confounded with batch. Remove the covariate and rerun ComBat.")
- }
- if(ncol(design)>(n.batch+1)){
- if((qr(design[,-c(1:n.batch)])$rank<ncol(design[,-c(1:n.batch)]))){
- stop('The covariates are confounded. Please remove one or more of the covariates so the design is not confounded.')
- } else {
- stop("At least one covariate is confounded with batch. Please remove confounded covariates and rerun ComBat.")
- }
- }
- }
- ## Standardize Data across features
- if (verbose) cat('[combat] Standardizing Data across features\n')
- # Estimate coefficients using training set if specified, otherwise use full data
- if (!is.null(train)) {
- design_tr <- design[train,]
- B.hat1 <- solve(crossprod(design_tr))
- B.hat1 <- tcrossprod(B.hat1, design_tr)
- B.hat <- tcrossprod(B.hat1, dat[,train])
- } else {
- B.hat1 <- solve(crossprod(design))
- B.hat1 <- tcrossprod(B.hat1, design)
- B.hat <- tcrossprod(B.hat1, dat)
- }
- # Standardization Model
- grand.mean <- crossprod(n.batches/n.array, B.hat[1:n.batch,])
- var.pooled <- ((dat-t(design%*%B.hat))^2)%*%rep(1/n.array,n.array)
- stand.mean <- crossprod(grand.mean, t(rep(1,n.array)))
- if(!is.null(design)){
- tmp <- design;tmp[,c(1:n.batch)] <- 0
- stand.mean <- stand.mean+t(tmp%*%B.hat)
- }
- s.data <- (dat-stand.mean)/(tcrossprod(sqrt(var.pooled), rep(1,n.array)))
- ## Get regression batch effect parameters
- if (eb){
- if (verbose) cat("[combat] Fitting L/S model and finding priors\n")
- } else {
- if (verbose) cat("[combat] Fitting L/S model\n")
- }
- batch.design <- design[,1:n.batch]
- gamma.hat <- tcrossprod(solve(crossprod(batch.design, batch.design)), batch.design)
- gamma.hat <- tcrossprod(gamma.hat, s.data)
- delta.hat <- NULL
- for (i in batches){
- delta.hat <- rbind(delta.hat,rowVars(s.data[,i], na.rm=TRUE)) # fixed error
- }
- # Empirical Bayes correction:
- gamma.star <- delta.star <- NULL
- gamma.bar <- t2 <- a.prior <- b.prior <- NULL
- if (eb){
- ##Find Priors
- #gamma.bar <- apply(gamma.hat, 1, mean)
- #t2 <- apply(gamma.hat, 1, var)
- gamma.bar <- rowMeans(gamma.hat)
- t2 <- rowVars(gamma.hat)
- a.prior <- apriorMat(delta.hat)
- b.prior <- bpriorMat(delta.hat)
- ##Find EB batch adjustments
- if (parametric){
- if (verbose) cat("[combat] Finding parametric adjustments\n")
- for (i in 1:n.batch){
- temp <- it.sol(s.data[,batches[[i]]],gamma.hat[i,],delta.hat[i,],gamma.bar[i],t2[i],a.prior[i],b.prior[i])
- gamma.star <- rbind(gamma.star,temp[1,])
- delta.star <- rbind(delta.star,temp[2,])
- }
- } else {
- if (verbose) cat("[combat] Finding non-parametric adjustments\n")
- for (i in 1:n.batch){
- temp <- int.eprior(as.matrix(s.data[, batches[[i]]]),gamma.hat[i,], delta.hat[i,])
- gamma.star <- rbind(gamma.star,temp[1,])
- delta.star <- rbind(delta.star,temp[2,])
- }
- }
- }
- if (mean.only) {
- delta.star <- array(1, dim = dim(delta.star))
- }
- ### Normalize the Data ###
- if (verbose) cat("[combat] Adjusting the Data\n")
- bayesdata <- s.data
- j <- 1
- for (i in batches){
- if (eb){
- bayesdata[,i] <- (bayesdata[,i]-t(batch.design[i,]%*%gamma.star))/tcrossprod(sqrt(delta.star[j,]), rep(1,n.batches[j]))
- } else {
- bayesdata[,i] <- (bayesdata[,i]-t(batch.design[i,]%*%gamma.hat))/tcrossprod(sqrt(delta.hat[j,]), rep(1,n.batches[j]))
- }
- j <- j+1
- }
- # Reintroduce wanted covariates
- all.mean <- crossprod(grand.mean, t(rep(1,n.array)))
- if (!is.null(nuisance.mod)) {
- tmp <- design;tmp[,c(1:n.batch)] <- 0
- tmp[,(n.batch+dim(mod)[2]-dim(nuisance.mod)[2]):(dim(design)[2])] <- 0
- wanted.mean <- all.mean+t(tmp%*%B.hat)
- }
- if (!is.null(nuisance.mod)) {
- bayesdata <- (bayesdata*(tcrossprod(sqrt(var.pooled), rep(1,n.array)))) +
- wanted.mean
- } else if (resid == FALSE) {
- bayesdata <- (bayesdata*(tcrossprod(sqrt(var.pooled), rep(1,n.array)))) +
- stand.mean
- } else {
- bayesdata <- bayesdata*(tcrossprod(sqrt(var.pooled), rep(1,n.array)))
- }
- return(list(dat.combat=bayesdata,
- s.data=s.data,
- gamma.hat=gamma.hat, delta.hat=delta.hat,
- gamma.star=gamma.star, delta.star=delta.star,
- gamma.bar=gamma.bar, t2=t2, a.prior=a.prior, b.prior=b.prior,
- batch=batch, mod=mod,
- stand.mean=stand.mean, stand.sd=sqrt(var.pooled)[,1],
- B.hat = B.hat))
- }
combat.R at commit cacf370, no license · at the source
Overview
- Center for Vital Longevity, School of Behavioral and Brain Sciences, The University of Texas at Dallas, Dallas, TX, United States
- Department of Psychiatry, The University of Texas Southwestern Medical Center, Dallas, TX, United States
Abstract
Large-scale lifespan neuroimaging studies increasingly integrate data across distinct cohorts to characterize trajectories of brain development and aging. However, systematic differences in acquisition protocols and hardware across cohorts can alter signal characteristics in ways that bias downstream analyses. Here, we examine three cohorts from the Human Connectome Project (HCP), spanning development (HCP-D), young adulthood (HCP-YA) and aging (HCP-A), to illustrate this issue and evaluate existing strategies to mitigate it. HCP has set standards for open, deeply phenotyped, high-resolution human neuroimaging, which are frequently used as high-quality reference datasets in tool validation, replication studies, and cross-cohort meta-analyses. However, neuroimaging acquisitions have differed across HCP cohorts because of changes in scanner hardware and acquisition sequences across study phases. Because of HCP’s widespread usage, even modest protocol differences between cohorts—and their downstream effects—can have outsized impacts on the field of neuroscience research. Our analysis reveals that the HCP-YA cohort exhibits systematically weaker temporal signal-to-noise ratio (tSNR) relative to HCP-D/
Reproduced under the paper's license (CC BY), from the paper cited above.
Repositories
Its files are read in the Code ↔ Paper reader above, with 2 matches between paragraphs and lines of code.
andy1764/CovBat_Harmonization
cacf370af1ffc87485f50733f797b236c4f251a7, 13 March 2023Availability: 1 check, the latest on 27 September 2026: the link answers
- 27 September 2026: the link answers
8 files
- Python/
R-test.R , R, 34 lines - Python/
combat_brent.py , Python, 229 lines - Python/
covbat.py , Python, 349 lines - Python/
test.py , Python, 43 lines - R/
R/ , R, 220 lines, 1 matchcombat.R - R/
R/ , R, 252 lines, 1 matchcovbat.R - R/
R/ , R, 308 linesutils.R - README.md, Text, 52 lines
mychan24/system-segregation-and-graph-tools
e7c30345b8ebf29e3a9ab44593d95e41cd0b16ed, 15 October 2024Availability: 1 check, the latest on 27 September 2026: the link answers
- 27 September 2026: the link answers
19 files
- MATLAB/
export/ , MATLAB, 208 linescolormap_roi.m - MATLAB/
export/ , MATLAB, 240 linescolormap_roi_meta.m - MATLAB/
fsLR2roizmat.m , MATLAB, 98 lines - MATLAB/
fsLR2roizmat_ciftidat_ci , MATLAB, 62 linesftinode.m - MATLAB/
fsLR2roizmat_ciftidat_gi , MATLAB, 81 linesftinode.m - MATLAB/
map_to_gii.m , MATLAB, 44 lines - MATLAB/
mat2cytoscape.m , MATLAB, 42 lines - MATLAB/
segregation.m , MATLAB, 71 lines - MATLAB/
segregation_by_type_eqco , MATLAB, 155 linesnt.m - MATLAB/
segregation_by_type_prco , MATLAB, 164 linesnt.m - R/
segregation.R , R, 63 lines - R/
segregation_by_type_eqco , R, 100 linesnt.R - R/
segregation_by_type_prco , R, 105 linesnt.R - R/
segregation_individual_s , R, 55 linesystems.R - test/
b_other_example.m , MATLAB, 27 lines - test/
testR.R , R, 63 lines - test/
test_segtype_proc.R , R, 42 lines - LICENSE, License, 21 lines
- README.md, Text, 20 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:
- 2 repositories of the authors' code, each at its verified commit, with its license and how the link was found in the paper;
- 24 scripts, each with its path and the digest of its content;
- 2 matches 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
Datasets cited
- humanconnectome.org/
study/ , at Human Connectome Project; found in the referenceshcp-lifespan-aging - humanconnectome.org/
study/ , at Human Connectome Project; found in the referenceshcp-young-adult - openneuro:ds004856, at OpenNeuro; found in “Data and Code Availability”
Data and Code Availability
HCP-YA S1200 release data (downloaded March 2023) are available via the Human Connectome Project website (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, 27 September 2026: the first record
Recorded: type, language, journal, volume, pages, dates, 3 authors, 5 keywords, 16 MeSH terms, 2 funders, 60 references.
Cite
This paper
Chan, M. Y., Han, L., & Wig, G. S. (2026). Systematic fMRI signal differences across cohorts alter lifespan trajectories of functional brain networks. Imaging neuroscience (Cambridge, Mass.), 4, IMAG.a.1338. https://
BibTeX
@article{chan2026systema
author = {Chan, Micaela Y and Han, Liang and Wig, Gagan S},
title = {{Systematic fMRI signal differences across cohorts alter lifespan trajectories of functional brain networks}},
journal = {Imaging neuroscience (Cambridge, Mass.)},
year = {2026},
month = aug,
volume = {4},
pages = {IMAG.a.1338},
publisher = {MIT Press},
issn = {2837-6056},
doi = {10.1162/
url = {https://
pmid = {42643755},
pmcid = {PMC13504956}
}
RIS
TY - JOUR
AU - Chan, Micaela Y
AU - Han, Liang
AU - Wig, Gagan S
TI - Systematic fMRI signal differences across cohorts alter lifespan trajectories of functional brain networks
T2 - Imaging neuroscience (Cambridge, Mass.)
J2 - Imaging Neurosci (Camb)
PY - 2026
DA - 2026/
VL - 4
SP - IMAG.a.1338
SN - 2837-6056
PB - MIT Press
DO - 10.1162/
UR - https://
LA - en
ER -
CSL-JSON
{
"id": "10.1162/
"type": "article-journal",
"title": "Systematic fMRI signal differences across cohorts alter lifespan trajectories of functional brain networks",
"container-title": "Imaging neuroscience (Cambridge, Mass.)",
"author": [
{
"family": "Chan",
"given": "Micaela Y"
},
{
"family": "Han",
"given": "Liang"
},
{
"family": "Wig",
"given": "Gagan S"
}
],
"container-title-short":
"volume": "4",
"page": "IMAG.a.1338",
"DOI": "10.1162/
"PMID": "42643755",
"PMCID": "PMC13504956",
"ISSN": "2837-6056",
"publisher": "MIT Press",
"URL": "https://
"language": "en",
"issued": {
"date-parts": [
[
2026,
8,
24
]
]
}
}
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.1371/journal.pbio.3003856 [code]
- Aging and metabolism contribute separately to brain-body health.Journal: PLoS biologyIn common: GIfTI library for MATLAB, scikit-learn, pandas, 1 other tool, humanconnectome.org/study/hcp-lifespan-aging, 9 references
- [2] doi:10.1162/imag.a.1285 [code]
- Individualized mapping of functional brain networks in older adulthood.Journal: Imaging neuroscience (Cambridge, Mass.)In common: cifti-matlab, GIfTI library for MATLAB, fMRI, systems, 8 references
- [3] doi:10.21203/rs.3.rs-9326213/v1 [code]
- Multi-task fMRI outperforms resting-state fMRI for revealing task-invariant organization of the human brainJournal: Research Square (preprint)In common: GIfTI library for MATLAB, scikit-learn, pandas, 1 other tool, humanconnectome.org/study/hcp-young-adult, fMRI, 6 references
- [4] doi:10.64898/2026.03.09.710558 [code]
- Multi-task fMRI outperforms resting-state fMRI for revealing task-invariant organization of the human brainJournal: bioRxiv (preprint)In common: GIfTI library for MATLAB, scikit-learn, pandas, 1 other tool, humanconnectome.org/study/hcp-young-adult, fMRI, 6 references
- [5] doi:10.1038/s41586-026-10454-2 [code]
- White matter micro- and macrostructure brain charts for the human lifespan.Journal: NatureIn common: pandas, NumPy, humanconnectome.org/study/hcp-lifespan-aging, OpenNeuro ds004856, 1 other dataset, 1 reference
- [6] doi:10.1016/j.neuron.2026.04.011 [code]
- Precision fMRI reveals densely interdigitated network patches with conserved motifs in the lateral prefrontal cortex.Journal: NeuronIn common: GIfTI library for MATLAB, scikit-learn, NumPy, fMRI, systems, 7 references
- [7] doi:10.1186/s40337-026-01671-1 [code]
- Aberrant large- and mesoscale network segregation and integration in bulimia nervosa.Journal: Journal of eating disordersIn common: cifti-matlab, GIfTI library for MATLAB, fMRI, 6 references
- [8] doi:10.1038/s42003-026-10282-0 [code]
- Genetic risk of Alzheimer's disease is associated with loss of brain network segregation in midlife.Journal: Communications biologyIn common: 9 references
- [9] doi:10.1093/oons/kvag006 [code]
- Social disconnection in the brain: loneliness and age across networks using graph theory.Journal: Oxford open neuroscienceIn common: pandas, NumPy, fMRI, 8 references
- [10] doi:10.1038/s41467-026-73072-6 [code]
- Mapping the spatiotemporal continuum of structural connectivity development across the human connectome in youth.Journal: Nature communicationsIn common: cifti-matlab, pandas, NumPy, 7 references
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: 2 repositories of the authors' code, each at its verified commit and with its license, 24 scripts, and 2 matches 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:ff02cf9fd8ac62d3…
Add the badge to its README
The badge links the code to this page. Copy one of these into the README of the paper's code: only you decide where it goes, and nothing is changed for you.
Markdown
[, paste the snippet at the top, then “Commit changes…” and, to review it first, “Create a new branch and start a pull request”. You open the pull request; OSCR asks for no permission.
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: questions and error reports about this paper and its code, from signed-in readers and its authors. It opens with sign-in.
Reproductions: reports from readers who ran the authors' code: what they reproduced, with which environment, commit and data. It opens with sign-in.
Activity: what happens around this paper: new versions of its record, its map's validation, discussions and reproductions. It opens with sign-in.
