Adjusting for confounders in penalized regression

When teaching introductory linear regression, one of my favorite topics is “adjusted variable plots” or “added variable plots”. The basic idea is this: say you want to relate two sets of predictor variables, $\bf X$ and $\bf Z$, to a single response variable $\bf y$. One standard way to do this is through a multiple linear regression model, given in matrix/vector form by:

Read More

Assigning independent components to canonical brain networks

A lot of the work my group does these days focuses on independent component analysis (ICA). ICA is a blind-source separation algorithm that is a popular way to analyze fMRI data. With ICA, you get a set of spatial independent component (IC) maps and a “mixing matrix” that contains the temporal activity associated with each IC. From that mixing matrix, you can compute functional connectivity (FC) matrices, either static or dynamic. When it comes to displaying FC matrices, we typically want to group the ICs by brain network, which results in a nice block-diagonal structure that aids in visual interpretation. We may also want to summarize FC or the spatial ICs by network.

Read More

How to perform CompCor on HCP fMRI data in R

This is a guest post written by Damon Pham. Damon is a graduate of Indiana University, where he was a Wells Scholar (the highest honor for incoming IU students) and all around extraordinaire. He has been part of my research group for the last several years, where one of his main focuses has been developing software to advance and facilitate research using CIFTI- and surface-format data. He has also been working on methods for outlier detection in fMRI data. (Update: Check out his NeuroImage paper on this here!) In that work we decided to use aCompCor as a preprocessing step before outlier detection. Since we are using CIFTI-format HCP fMRI data, figuring out how to actually do aCompCor was an undertaking. Below, Damon describes why and how he did this. We hope this is useful for other researchers wanting to use CompCor on CIFTI-format data in the HCP and beyond.

Read More

The role of centering in dual regression

Dual regression is maybe the simplest way to obtain subject-specific estimates of ICA-based resting-state networks (RSNs). RSNs are regions of the brain that tend to act in a coordinated manner in the absence of a specific task, such as the three shown below (from a 50-component ICA of the Human Connectome Project).

Read More

How to efficiently prewhiten fMRI timeseries the "right" way

Update 2023: My group has published a paper on spatially varying prewhitening: Parlak et al. “Sources of residual autocorrelation in multiband task fMRI and strategies for effective mitigation.” Frontiers in Neuroscience 16 (2023): 1051424. https://doi.org/10.3389/fnins.2022.1051424. We also developed a computationally efficient spatially variable prewhitening technique, implemented in the BayesfMRI R package (CRAN, Github).

Read More

Tips for submitting to arXiv for the first time

Today I successfully submitted my first paper to arXiv! We’ve submitted this paper to a journal, but it hasn’t been published yet, so we wanted to get a pre-print up before advertising the corresponding software packages. Unfortunately, the process of submitting to arXiv wasn’t painless. Now that I’ve figured out some of the quirks, however, hopefully your first submission can go a little more smoothly than mine did.

Read More

Three ways to use MATLAB from R

Being a statistician working in neuroimaging is a little like living abroad and trying to speak a foreign language. For example, my first language is English, but I spent my first summer as a PhD student doing research at LMU in Munich, Germany. I had taken German in college and could have really basic conversations, but for more demanding situations I would switch to English in a heartbeat, given the option.

Read More

10 reasons to switch to ggplot

Making plots is a necessary and useful task for anyone who works with data. While making the standard plots is a pretty straightforward task in most statistical programming languagues, including R, when it comes to using R’s base graphics to make custom plots (the plots you actually want to make) things can get complicated. As with many of life’s problems, Hadley Wickham comes to the rescue. His R package ggplot2 is based on the principles outlined in Leland Wilkinson’s landmark 1999 book The Grammar of Graphics (hence “gg”). Full disclosure: I haven’t read the book. But I have been using ggplot exclusively for over a year, and I have become a believer in the gg approach to visualization. There are a lot of R users out there who are resistant to switching from base graphics to ggplot, and while there are some legitimate downsides and probably settings where it doesn’t make sense, for most users I believe it’s well worth the time and effort required to get started with ggplot. I mean, the New York Times thinks so! So for all those doubters (or newbies) out there, here goes my best shot at convincing you that switching to ggplot is worth the effort.

Read More