Optimising Analysis Choices for Multivariate Decoding: Creating Pseudotrials Using Trial Averaging and Resampling.
The 5 matches
- [1] § Methods › Simulation 2 ↔ analysis scripts/SEREEG_simulations_P300.m, lines 94–137 · score 0.88 · peak latency, peak width, location, midbrain, mixed, scalp
- [2] § Methods › Simulation 1 ↔ analysis scripts/permutation_testing.m, lines 45–103 · score 0.63 · cosmo montecarlo, sign flip permutation, alpha, score, simulations, resampled
- [3] § Methods › Simulation 1 ↔ analysis scripts/SEREEG_simulations_P300.m, lines 2–49 · score 0.59 · libSVM, cosmoMVPA, multivariate, LDA, Bayes, simulate
- [4] § Methods › Simulation 2 ↔ analysis scripts/permutation_testing.m, lines 45–103 · score 0.59 · cosmo montecarlo, sign flip permutation, alpha, score, simulation
- [5] § Results › Simulation 2: SEREEGA › Influence of Simulation Type ↔ analysis scripts/SEREEG_simulations_P300.m, lines 2–49 · score 0.54 · SEREEGA toolbox, P300, 13 %, ERP, amplitude, SVM
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
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.1167/jov.26.8.2 [code]
- Disentangling objects' contextual associations from perceptual and conceptual attributes using time-resolved neural decoding.Journal: Journal of visionIn common: CoSMoMVPA, Statistics and Machine Learning Toolbox, 3 references
- [2] doi:10.1162/imag.a.1332 [code]
- Decision processes underlying effort avoidance and their relationship with metacognition.Journal: Imaging neuroscience (Cambridge, Mass.)In common: CoSMoMVPA, Statistics and Machine Learning Toolbox, 3 references
- [3] doi:10.1371/journal.pone.0347992 [code]
- Rotation-tolerant representations elucidate the time-course of high-level object processing.Journal: PloS oneIn common: CoSMoMVPA, Statistics and Machine Learning Toolbox, 2 references
- [4] doi:10.1167/jov.26.8.4 [code]
- The neural processes of illusory occlusion in object recognition.Journal: Journal of visionIn common: 1 reference, author Tijl Grootswagers
- [5] doi:10.1038/s41467-026-73153-6 [code]
- Latent neural architecture organising shared aesthetic evaluations of visual artworks.Journal: Nature communicationsIn common: CoSMoMVPA, Statistics and Machine Learning Toolbox, 1 reference
- [6] doi:10.1007/s00429-026-03111-x [code]
- Direction selectivity in naturalistic action observation: distributed representations across the action observation network.Journal: Brain structure & functionIn common: CoSMoMVPA, Statistics and Machine Learning Toolbox, 1 reference
- [7] doi:10.1038/s41598-026-46149-x [code]
- Dynamic neural representations of scene beauty are relatively unaffected by stimulus timing and task.Journal: Scientific reportsIn common: CoSMoMVPA, Statistics and Machine Learning Toolbox, 1 reference
- [8] doi:10.1162/imag.a.1203 [code]
- Motor cortical areas facilitate schema-mediated integration of new motor information into memory.Journal: Imaging neuroscience (Cambridge, Mass.)In common: CoSMoMVPA, Statistics and Machine Learning Toolbox, 1 reference
- [9] doi:10.1371/journal.pbio.3003779 [code]
- Past and present goals are represented concurrently during visual search.Journal: PLoS biologyIn common: 3 references
- [10] doi:10.1016/j.bbih.2026.101299 [code]
- Multimodal approach to identify neuropsychophysiological
subgroups in myalgic encephalomyelitis/ chronic fatigue syndrome and their relevance for rehabilitation: protocol for a mechanistic cross-sectional and longitudinal study. Journal: Brain, behavior, & immunity - healthIn common: CoSMoMVPA, Statistics and Machine Learning Toolbox, clinical / translational
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:ea8522098059f754…
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
[.
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.
