Optimising Analysis Choices for Multivariate Decoding: Creating Pseudotrials Using Trial Averaging and Resampling.
3 blocks of code here have a permanent identifier (oscr:b:…), listed with the matches below: citable for good, with a page of its own. Select a match and press Cite to copy it. What a block identifier is.
The 5 matches
- [1] § Methods › Simulation 2 ↔ analysis scripts/SEREEG_simulations_P300.m, lines 94 to 137 · score 0.88 · peak latency, peak width, location, midbrain, mixed, scalp · block
oscr:b:86BA9B1M0K84C-F· Report a mismatch - [2] § Methods › Simulation 1 ↔ analysis scripts/permutation_testing.m, lines 45 to 103 · score 0.63 · cosmo montecarlo, sign flip permutation, alpha, score, simulations, resampled · block
oscr:b:7YDH3ERBSNSP3-D· Report a mismatch - [3] § Methods › Simulation 1 ↔ analysis scripts/SEREEG_simulations_P300.m, lines 2 to 49 · score 0.59 · libSVM, cosmoMVPA, multivariate, LDA, Bayes, simulate · block
oscr:b:AGXT5TEXBHDNQ-W· Report a mismatch - [4] § Methods › Simulation 2 ↔ analysis scripts/permutation_testing.m, lines 45 to 103 · score 0.59 · cosmo montecarlo, sign flip permutation, alpha, score, simulation · block
oscr:b:7YDH3ERBSNSP3-D· Report a mismatch - [5] § Results › Simulation 2: SEREEGA › Influence of Simulation Type ↔ analysis scripts/SEREEG_simulations_P300.m, lines 2 to 49 · score 0.54 · SEREEGA toolbox, P300, 13 %, ERP, amplitude, SVM · block
oscr:b:AGXT5TEXBHDNQ-W· 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
MATLAB · 204 lines · 8.4 KB · no license · 3 matches
- % Optimising analysis choices for multivariate decoding: creating
- % pseudotrials using trial averaging and resampling.
- % Catriona Scrivener,Tijl Grootswagers, Alexandra Woolgar
- % 2025
- % Simulating EEG data using SEREEGA toolbox and EEGLab
- % Generate a P300-like ERP responses from a deep central source
- % SEREEGA toolbox paper:
- % Krol, L. R., Pawlitzki, J., Lotte, F., Gramann, K., & Zander, T. O. (2018).
- % SEREEGA: Simulating event-related EEG activity. Journal of neuroscience methods, 309, 13-24.
- % add path to SEREEGA folder and subfolders
- addpath(genpath('.../toolboxes/SEREEGA-master'))
- % add path to EEGlab
- addpath('...eeglab2021.1')
- % set path to cosmoMVPA
- addpath(genpath('.../toolboxes/CoSMoMVPA-master'))
- % libSVM
- addpath(genpath('.../toolboxes/libsvm-3.36'))
- % define results directory
- results_path = pwd;
- % Check which classifier to use
- if strcmp(class_type, 'svm')
- my_classifier = @cosmo_classify_libsvm;
- elseif strcmp(class_type, 'lda')
- my_classifier = @cosmo_classify_lda;
- elseif strcmp(class_type, 'naive_bayes')
- my_classifier = @cosmo_classify_naive_bayes;
- end
- % Define simulation parameters
- amp1 = 11; % P300 amplitude condition 1
- amp2 = 10.5; % P300 amplitude condition 2
- snr = 1/3; % signal to noise ratio
- nreps = 90; % here used as the number of trials per condition
- max_count = 30; % count = how many trials per pseudotrial
- max_resamp = 15; % resampling = how many times each trial can be used
- max_ptps = 30; % how many 'participants' to simulate
- nseeds = 50; % number of random trial allocations per ptp+param set
- nchunks = 3; % how many chunks
- nperm = 100; % how many permutation
- class_type = {'svm'}; % which classifier
- % create results variable
- x = NaN(max_count,max_resamp,nseeds,max_ptps);
- perm = NaN(nperm,max_count,max_resamp,nseeds,max_ptps);
- pvals = NaN(max_count,max_resamp,nseeds,max_ptps);
- copy_max_resamp = max_resamp;
- % Simulate a predefined 64-electrode montage using the ICBM-NY pre-generated lead field
- % with 64 channels from the 10-20 system
- % Assumes you have the NY Head leadfield in MATLAB format in the
- % path. This is available at http://www.parralab.org/nyhead/sa_nyhead.mat
- % In the ICBM-NY lead field, default orientations are included,
- % which orient the dipole perpendicular to the cortical surface.
- lf = lf_generate_fromnyhead('montage', 'S64');
- % iterate over different ptps/seeds
- for ptp = 1:max_ptps
- % generate epoch eeg data
- epochs = struct();
- epochs.n = nreps; % the number of epochs to simulate per condition
- epochs.srate = 250; % their sampling rate in Hz
- epochs.length = 600; % length of the epochs (with no baseline)
- % create white noise signals
- noise_white = struct( ...
- 'type', 'noise', ...
- 'color', 'white', ...
- 'amplitude', 5);
- noise_white = utl_check_class(noise_white);
- % generate 25 random noise sources
- % only use white noise
- sources = lf_get_source_spaced(lf, 10, 25);
- comps = utl_create_component(sources, noise_white, lf);
- [comps1, comps2] = deal(comps);
- % create separate noise dataset that we will
- % later add to the signal in varying amounts
- % to adjust the snr
- noiseact = struct('type', 'noise', 'color', 'white', 'amplitude', 1);
- noisecomps = utl_create_component(sources, noiseact, lf);
- noisedata = generate_scalpdata(noisecomps, lf, epochs,'showProgress',0,'useParallelPool',0);
- % generate a P300 ERP
- p3 = [];
- p3.signal{1} = struct();
- p3.signal{1}.peakLatency = 350; % in ms, starting at the start of the epoch
- p3.signal{1}.peakWidth = 350; % in ms
- p3.signal{1}.peakAmplitude = 3; % in microvolt - we will update
- p3.signal{1} = utl_check_class(p3.signal{1}, 'type', 'erp');
- % pick a source in the midbrain
- p3.source = lf_get_source_nearest(lf, [0 -40 -25]);
- p3.orientation = utl_get_orientation_pseudotangential(p3.source,lf);
- p3.orientationDv = [0 0 0];
- p3.orientation = [0.03,-0.16,1];
- % add a broad, weak P300, with condition difference
- p3.signal{1}.peakAmplitude = amp1;
- comps1(end+1) = p3;
- p3.signal{1}.peakAmplitude = amp2;
- comps2(end+1) = p3;
- % project ERPs to the scalp for each condition
- data1 = generate_scalpdata(comps1, lf, epochs,'useParallelPool',0,'showProgress',0);
- data2 = generate_scalpdata(comps2, lf, epochs,'useParallelPool',0,'showProgress',0);
- % create eeglab dataset with added noise
- % first mix the ERP data with noise with an SNR of 1/3, or -6 dB
- data1_snr = utl_mix_data(data1,noisedata,snr);
- data2_snr = utl_mix_data(data2,noisedata,snr);
- EEG1_snr = utl_create_eeglabdataset(data1_snr, epochs, lf, 'marker', 'event1');
- EEG2_snr = utl_create_eeglabdataset(data2_snr, epochs, lf, 'marker', 'event2');
- %__________________________________________________________________________
- % run decoding
- % cosmo wants the data as trial*channel*time
- % reformat and combine data
- allData = [permute(EEG1_snr.data,[3,1,2]);permute(EEG2_snr.data,[3,1,2])];
- % take channel locations and timevector from one dataset
- chanlocs = EEG1_snr.chanlocs; times = EEG1_snr.times;
- % flatten the data over chan and time
- % the data is organised such that it does time 1 over all channels, then
- % time 2 over all channels etc.
- ds = cosmo_flatten(allData,{'chan','time'},...
- {chanlocs,times});
- % add targets to dataset
- ds.sa.targets = [ones([size(EEG1_snr.data,3),1]);...
- repmat(2,[size(EEG1_snr.data,3),1])];
- % first set chunks so that all samples are assumed to be independent
- ds.sa.chunks = [(1:size(EEG1_snr.data,3))';(1:size(EEG2_snr.data,3))'];
- % re-assign chunks pseudo-randomly into blocks
- ds.sa.chunks = cosmo_chunkize(ds,nchunks);
- % iterate over count values - number of samples to select for each average
- for count = 1:max_count
- disp(['c',num2str(count)])
- % count 1 resamp 1 is always the same
- if count == 1; max_resamp =1; else; max_resamp = copy_max_resamp;end
- % iterate over resampling values - maximum number of times each sample in ds is used for averaging
- for resampling = 1:max_resamp
- disp(['r',num2str(resampling)])
- % use seed for pseudo-random sampling
- for seed = 1:nseeds
- % averages samples using count and resampling values
- % use a different seed each time
- ds_avg_rs = cosmo_average_samples(ds,'count',count,'resamplings',resampling,'seed',seed);
- % run classifier and save accuracy
- ma={};
- ma.classifier = my_classifier;
- ma.max_feature_count = 10000;
- ma.partitions = cosmo_nfold_partitioner(ds_avg_rs);
- res_rs = cosmo_crossvalidation_measure(ds_avg_rs,ma);
- x(count,resampling,seed,ptp) = res_rs.samples;
- % to use permutation testing
- if seed == 1
- acc0 = zeros(nperm,1);
- ds0 = ds_avg_rs; ma0 = ma; % copy of datasets
- for k = 1:nperm
- ds0.sa.targets = cosmo_randomize_targets(ds0);
- [~, acc0(k)] = cosmo_crossvalidate(ds0,ma0.classifier,ma0.partitions,ma0);
- end
- p = sum(res_rs.samples<acc0)/nperm;
- perm(:,count,resampling,seed,ptp) = acc0;
- pvals(count,resampling,seed,ptp) = p;
- end
- end % seed
- end % resampling
- end % count
- end % ptp
- % X = count x resampling x seeds x ptp (ptps)
- % mean over resampling seeds
- Y_res(:,:,1) = mean(mean(x,3),4);
- Y_res(:,:,2) = std(mean(x,3),0,4);
- save(fullfile(results_path,['Y_res_nreps' num2str(nreps) '_count' num2str(max_count) '_resamp' num2str(max_resamp) '_ptps' num2str(max_ptps) '_class' class_type '.mat']),'Y_res')
- save(fullfile(results_path,['x_nreps' num2str(nreps) '_count' num2str(max_count) '_resamp' num2str(max_resamp) '_ptps' num2str(max_ptps) '_class' class_type '.mat']),'x')
- save(fullfile(results_path,['perm_nreps' num2str(nreps) '_count' num2str(max_count) '_resamp' num2str(max_resamp) '_ptps' num2str(max_ptps) '_class' class_type '.mat']),'perm')
- save(fullfile(results_path,['pvals_nreps' num2str(nreps) '_count' num2str(max_count) '_resamp' num2str(max_resamp) '_ptps' num2str(max_ptps) '_class' class_type '.mat']),'pvals')
SEREEG_simulations_P300.m, no license · at the source
Overview
- MRC Cognition and Brain Sciences Unit University of Cambridge Cambridge UK
- School of Philosophy, Psychology and Language Sciences University of Edinburgh Edinburgh UK
- The MARCS Institute for Brain, Behaviour and Development Western Sydney University Sydney New South Wales Australia
- School of Computer, Data and Mathematical Sciences Western Sydney University Sydney New South Wales Australia
- Department of Psychology University of Cambridge Cambridge UK
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 robust condition‐specific information in neuroimaging data, 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 before training an MVPA classifier, but the decision about how much averaging to do is arbitrary and the effect of varying this parameter has not been documented. Here, we systematically assessed the influence of trial averaging and resampling on decoding accuracy and subsequent statistical outcome on data simulated using two different toolboxes (CoSMoMVPA and SEREEGA). 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, but was not always necessary. We provide code to allow researchers to optimise these analysis choices for the parameters of their data.
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 5 matches between paragraphs and lines of code.
OSF hjf75
Availability: 1 check, the latest on 27 September 2026: the link answers (HTTP 200)
- 27 September 2026: the link answers (HTTP 200)
4 files
- analysis scripts/
SEREEG_simulations_P300. , MATLAB, 204 lines, 3 matchesm - analysis scripts/
cosmomvpa_simulations.m , MATLAB, 180 lines - analysis scripts/
permutation_testing.m , MATLAB, 186 lines, 2 matches - analysis scripts/
viridis.m , MATLAB, 276 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;
- 4 scripts, each with its path and the digest of its content;
- 5 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
No dataset and no data link were found in the paper.
Data Availability Statement
Analysis scripts can be found 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 2, 28 September 2026
- Publisher: n/a → Wiley
- Authors: added Alexandra Woolgar (0000-0002-8453-7424); removed Alexandra Woolgar
Version 1, 27 September 2026: the first record
Recorded: type, language, journal, volume, issue, pages, dates, 3 authors, 3 keywords, 6 MeSH terms, 3 funders, 20 references.
Cite
This paper
Scrivener, C. L., Grootswagers, T., & Woolgar, A. (2026). Optimising Analysis Choices for Multivariate Decoding: Creating Pseudotrials Using Trial Averaging and Resampling. The European journal of neuroscience, 64(2), e70601. https://
BibTeX
@article{scrivener2026op
author = {Scrivener, Catriona L. and Grootswagers, Tijl and Woolgar, Alexandra},
title = {{Optimising Analysis Choices for Multivariate Decoding: Creating Pseudotrials Using Trial Averaging and Resampling}},
journal = {The European journal of neuroscience},
year = {2026},
month = jul,
volume = {64},
number = {2},
pages = {e70601},
publisher = {Wiley},
issn = {0953-816X},
doi = {10.1111/
url = {https://
pmid = {42473262},
pmcid = {PMC13382189}
}
RIS
TY - JOUR
AU - Scrivener, Catriona L.
AU - Grootswagers, Tijl
AU - Woolgar, Alexandra
TI - Optimising Analysis Choices for Multivariate Decoding: Creating Pseudotrials Using Trial Averaging and Resampling
T2 - The European journal of neuroscience
J2 - Eur J Neurosci
PY - 2026
DA - 2026/
VL - 64
IS - 2
SP - e70601
SN - 0953-816X
PB - Wiley
DO - 10.1111/
UR - https://
LA - en
ER -
CSL-JSON
{
"id": "10.1111/
"type": "article-journal",
"title": "Optimising Analysis Choices for Multivariate Decoding: Creating Pseudotrials Using Trial Averaging and Resampling",
"container-title": "The European journal of neuroscience",
"author": [
{
"family": "Scrivener",
"given": "Catriona L."
},
{
"family": "Grootswagers",
"given": "Tijl"
},
{
"family": "Woolgar",
"given": "Alexandra"
}
],
"container-title-short":
"volume": "64",
"issue": "2",
"page": "e70601",
"DOI": "10.1111/
"PMID": "42473262",
"PMCID": "PMC13382189",
"ISSN": "0953-816X",
"publisher": "Wiley",
"URL": "https://
"language": "en",
"issued": {
"date-parts": [
[
2026,
7,
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.1038/s41598-022-10687-x [code]
- The time-course of feature-based attention effects dissociated from temporal expectation and target-related processes.Journal: Scientific reportsIn common: CoSMoMVPA, 2 references, 2 authors
- [2] doi:10.1371/journal.pcbi.1011760 [code]
- Mapping the dynamics of visual feature coding: Insights into perception and integration.Journal: PLoS computational biologyIn common: CoSMoMVPA, Statistics and Machine Learning Toolbox, 3 references, author Tijl Grootswagers
- [3] doi:10.1162/imag.a.1135 [code]
- Multiple partially overlapping neural modules orchestrate conflict processing.Journal: Imaging neuroscience (Cambridge, Mass.)In common: CoSMoMVPA, Statistics and Machine Learning Toolbox, 3 references, author Tijl Grootswagers
- [4] doi:10.3389/fnins.2022.825746 [code]
- When the Whole Is Less Than the Sum of Its Parts: Maximum Object Category Information and Behavioral Prediction in Multiscale Activation Patterns.Journal: Frontiers in neuroscienceIn common: Statistics and Machine Learning Toolbox, 4 references, author Alexandra Woolgar
- [5] doi:10.1093/scan/nsaf101 [code]
- Neural decoding of competitive decision-making in Rock-Paper-Scissors.Journal: Social cognitive and affective neuroscienceIn common: CoSMoMVPA, Statistics and Machine Learning Toolbox, 2 references, author Tijl Grootswagers
- [6] doi:10.1162/imag.a.1051 [code]
- Mapping object space dimensions: New insights from temporal dynamics.Journal: Imaging neuroscience (Cambridge, Mass.)In common: CoSMoMVPA, 2 references, author Tijl Grootswagers
- [7] doi:10.3389/fnhum.2024.1385624 [code]
- Measuring information alignment in hyperscanning research with representational analyses: moving beyond interbrain synchrony.Journal: Frontiers in human neuroscienceIn common: CoSMoMVPA, Statistics and Machine Learning Toolbox, 1 reference, author Tijl Grootswagers
- [8] doi:10.3389/fnimg.2022.974927 [code]
- Canonical template tracking: Measuring the activation state of specific neural representations.Journal: Frontiers in neuroimagingIn common: 7 references
- [9] doi:10.1016/j.dcn.2022.101094 [code]
- Time-resolved multivariate pattern analysis of infant EEG data: A practical tutorial.Journal: Developmental cognitive neuroscienceIn common: Statistics and Machine Learning Toolbox, 6 references
- [10] doi:10.1093/nc/niaf006
- Visual imagery of familiar people and places in category selective cortex.Journal: Neuroscience of consciousnessIn common: 3 references, author Catriona L. Scrivener
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, 4 scripts, and 5 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:4881d71b29b2530d…
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.1111/ejn.70601)
<!-- oscr-badge:end -->reStructuredText
.. oscr-badge:start
.. image:: https://openscicode.org/badge/doi/10.1111/ejn.70601.svg
:target: https://openscicode.org/badge/doi/10.1111/ejn.70601
:alt: OSCR
.. oscr-badge:endHTML
<!-- oscr-badge:start -->
<a href="https://openscicode.org/badge/doi/10.1111/ejn.70601"><img src="https://openscicode.org/badge/doi/10.1111/ejn.70601.svg" alt="OSCR"></a>
<!-- oscr-badge:end -->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)
Activity: what happens around this paper: new versions of its record, its map's validation, discussions and reproductions. It opens with sign-in.
