Optimising analysis choices for multivariate decoding: creating pseudotrials using trial averaging and resampling

Catriona L. Scrivener, Tijl Grootswagers, Alexandra WoolgarbioRxiv 2023

Abstract

Multivariate pattern analysis (MVPA) is a popular technique that can distinguish between condition-specific patterns of activation. Applied to neuroimaging data, MVPA decoding for inference uses above-chance decoding to identify statistically reliable condition-specific information which may be missed by univariate methods. However, several analysis choices influence decoding results, and the combined effects of these choices have not been fully evaluated. In particular, an increasingly popular approach is to average data from several trials together to create "pseudotrials" before training an MVPA classifier, but the decision about how much averaging to do is often arbitrary. Here we systematically assessed the influence of trial averaging and resampling on decoding accuracy and subsequent statistical outcomes on simulated data. Although the optimal parameters varied with the classifier and cross-validation approach used, we found that modest trial averaging using up to 5-10% of the total number of trials per condition improved decoding accuracy and associated t-statistics. In addition, a small amount of resampling could improve t-statistics and classification performance. We provide code to allow researchers to optimise these analysis choices for the parameters of their data.

Introduction

In cognitive neuroscience, MVPA (or "decoding") is a powerful tool used to determine if brain activity patterns can distinguish between different experimental conditions, such as viewing faces versus houses. Because individual neuroimaging trials are inherently noisy, researchers frequently employ "pseudotrials"—averaging several raw trials together to create cleaner data points before feeding them into a machine-learning classifier.

Despite its widespread use, there is currently no standard for how many trials should be averaged. This "voodoo" parameter choice is rarely justified and can significantly impact whether a result is deemed statistically significant. Furthermore, the interaction between trial averaging, resampling (sampling with replacement), and different types of classifiers (like SVM or LDA) has not been rigorously mapped out until now.

Methods

The authors used the CoSMoMVPA toolbox to generate simulated neuroimaging datasets where the "ground truth" (the actual difference between conditions) was known. This allowed for precise control over variables that are typically confounded in real brain data. They systematically varied:

  • Number of trials per pseudotrial: How many raw trials are averaged together.
  • Resampling value: How many times each raw trial is used across different pseudotrials (sampling with replacement).
  • Classifiers: Three popular models were tested: Linear Support Vector Machine (SVM), Linear Discriminant Analysis (LDA), and Gaussian Naive Bayes (NB).
  • Cross-validation: They compared "chunking" (fixed folds) vs. "leave-one-pseudotrial-out" (where the number of folds changes based on the degree of averaging).

To ensure robustness, they ran 100 iterations of the pseudotrial creation for every simulated "subject" and averaged the results.

Decoding performance as a function of trial averaging across different class distances and classifiers.

Key Results and Insights

The "Sweet Spot" for Averaging

Averaging is a double-edged sword: it reduces noise (increasing accuracy) but also reduces the number of data points available to the classifier and can increase inter-subject variance. Across most conditions, the study found that averaging 5-10% of the total trials per condition provided the optimal balance. For a study with 90 trials, this equates to averaging roughly 5 to 9 trials per pseudotrial.

Safety and False Positives

Importantly, trial averaging did not create artificial effects. On null data (where class distance = 0), decoding remained at the 50% chance level regardless of the averaging parameters. This confirms that the method improves sensitivity without sacrificing specificity.

Classifier Personalities and Resampling

The impact of these choices depends heavily on the chosen classifier. Naive Bayes (NB) proved to be the most sensitive; it requires many samples and performs poorly if data is over-averaged. Conversely, SVM is more robust because it focuses on "support vectors" near the decision boundary, making it less sensitive to the noise reduction benefits of heavy averaging.

Heatmaps showing the interaction between trial averaging and resampling on decoding metrics for a class distance of 0.1.

As shown in the heatmaps above, using a modest resampling value (e.g., using each trial twice) helped stabilize results, especially for the Naive Bayes classifier, by effectively increasing the number of training samples available to the model.

Discussion and Future Work

While these simulations provide a strong baseline, the authors acknowledge certain limitations. The study primarily focused on decoding accuracy and t-scores using Gaussian noise. Real-world brain data, particularly from EEG or MEG, contains complex temporal and spatial correlations that may interact with averaging in unique ways.

The authors emphasize that "one size does not fit all." To support the community, they have provided their simulation code on the Open Science Framework (OSF). This allows researchers to plug in their own trial counts and expected effect sizes to determine the optimal analysis pipeline for their specific experimental design.

Summary updated

BibTeX
@misc{scrivener2023optimising,
  author = {Catriona L. Scrivener and Tijl Grootswagers and Alexandra Woolgar},
  title = {{Optimising analysis choices for multivariate decoding: creating pseudotrials using trial averaging and resampling}},
  year = {2023},
  doi = {10.1101/2023.10.04.560678},
  howpublished = {bioRxiv},
}
Figure