OSCR

Optimising Analysis Choices for Multivariate Decoding: Creating Pseudotrials Using Trial Averaging and Resampling.

Code ↔ Paper

5 matches between paragraphs of the paper and lines of its authors' code, computed by the harvester (lexical-v1). Click a colored paragraph or line to see its counterpart.

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. [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. [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. [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. [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. [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

  1. % Optimising analysis choices for multivariate decoding: creating
  2. % pseudotrials using trial averaging and resampling.
  3. % Catriona Scrivener,Tijl Grootswagers, Alexandra Woolgar
  4. % 2025
  5. % Simulating EEG data using SEREEGA toolbox and EEGLab
  6. % Generate a P300-like ERP responses from a deep central source
  7. % SEREEGA toolbox paper:
  8. % Krol, L. R., Pawlitzki, J., Lotte, F., Gramann, K., & Zander, T. O. (2018).
  9. % SEREEGA: Simulating event-related EEG activity. Journal of neuroscience methods, 309, 13-24.
  10. % add path to SEREEGA folder and subfolders
  11. addpath(genpath('.../toolboxes/SEREEGA-master'))
  12. % add path to EEGlab
  13. addpath('...eeglab2021.1')
  14. % set path to cosmoMVPA
  15. addpath(genpath('.../toolboxes/CoSMoMVPA-master'))
  16. % libSVM
  17. addpath(genpath('.../toolboxes/libsvm-3.36'))
  18. % define results directory
  19. results_path = pwd;
  20. % Check which classifier to use
  21. if strcmp(class_type, 'svm')
  22. my_classifier = @cosmo_classify_libsvm;
  23. elseif strcmp(class_type, 'lda')
  24. my_classifier = @cosmo_classify_lda;
  25. elseif strcmp(class_type, 'naive_bayes')
  26. my_classifier = @cosmo_classify_naive_bayes;
  27. end
  28. % Define simulation parameters
  29. amp1 = 11; % P300 amplitude condition 1
  30. amp2 = 10.5; % P300 amplitude condition 2
  31. snr = 1/3; % signal to noise ratio
  32. nreps = 90; % here used as the number of trials per condition
  33. max_count = 30; % count = how many trials per pseudotrial
  34. max_resamp = 15; % resampling = how many times each trial can be used
  35. max_ptps = 30; % how many 'participants' to simulate
  36. nseeds = 50; % number of random trial allocations per ptp+param set
  37. nchunks = 3; % how many chunks
  38. nperm = 100; % how many permutation
  39. class_type = {'svm'}; % which classifier
  40. % create results variable
  41. x = NaN(max_count,max_resamp,nseeds,max_ptps);
  42. perm = NaN(nperm,max_count,max_resamp,nseeds,max_ptps);
  43. pvals = NaN(max_count,max_resamp,nseeds,max_ptps);
  44. copy_max_resamp = max_resamp;
  45. % Simulate a predefined 64-electrode montage using the ICBM-NY pre-generated lead field
  46. % with 64 channels from the 10-20 system
  47. % Assumes you have the NY Head leadfield in MATLAB format in the
  48. % path. This is available at http://www.parralab.org/nyhead/sa_nyhead.mat
  49. % In the ICBM-NY lead field, default orientations are included,
  50. % which orient the dipole perpendicular to the cortical surface.
  51. lf = lf_generate_fromnyhead('montage', 'S64');
  52. % iterate over different ptps/seeds
  53. for ptp = 1:max_ptps
  54. % generate epoch eeg data
  55. epochs = struct();
  56. epochs.n = nreps; % the number of epochs to simulate per condition
  57. epochs.srate = 250; % their sampling rate in Hz
  58. epochs.length = 600; % length of the epochs (with no baseline)
  59. % create white noise signals
  60. noise_white = struct( ...
  61. 'type', 'noise', ...
  62. 'color', 'white', ...
  63. 'amplitude', 5);
  64. noise_white = utl_check_class(noise_white);
  65. % generate 25 random noise sources
  66. % only use white noise
  67. sources = lf_get_source_spaced(lf, 10, 25);
  68. comps = utl_create_component(sources, noise_white, lf);
  69. [comps1, comps2] = deal(comps);
  70. % create separate noise dataset that we will
  71. % later add to the signal in varying amounts
  72. % to adjust the snr
  73. noiseact = struct('type', 'noise', 'color', 'white', 'amplitude', 1);
  74. noisecomps = utl_create_component(sources, noiseact, lf);
  75. noisedata = generate_scalpdata(noisecomps, lf, epochs,'showProgress',0,'useParallelPool',0);
  76. % generate a P300 ERP
  77. p3 = [];
  78. p3.signal{1} = struct();
  79. p3.signal{1}.peakLatency = 350; % in ms, starting at the start of the epoch
  80. p3.signal{1}.peakWidth = 350; % in ms
  81. p3.signal{1}.peakAmplitude = 3; % in microvolt - we will update
  82. p3.signal{1} = utl_check_class(p3.signal{1}, 'type', 'erp');
  83. % pick a source in the midbrain
  84. p3.source = lf_get_source_nearest(lf, [0 -40 -25]);
  85. p3.orientation = utl_get_orientation_pseudotangential(p3.source,lf);
  86. p3.orientationDv = [0 0 0];
  87. p3.orientation = [0.03,-0.16,1];
  88. % add a broad, weak P300, with condition difference
  89. p3.signal{1}.peakAmplitude = amp1;
  90. comps1(end+1) = p3;
  91. p3.signal{1}.peakAmplitude = amp2;
  92. comps2(end+1) = p3;
  93. % project ERPs to the scalp for each condition
  94. data1 = generate_scalpdata(comps1, lf, epochs,'useParallelPool',0,'showProgress',0);
  95. data2 = generate_scalpdata(comps2, lf, epochs,'useParallelPool',0,'showProgress',0);
  96. % create eeglab dataset with added noise
  97. % first mix the ERP data with noise with an SNR of 1/3, or -6 dB
  98. data1_snr = utl_mix_data(data1,noisedata,snr);
  99. data2_snr = utl_mix_data(data2,noisedata,snr);
  100. EEG1_snr = utl_create_eeglabdataset(data1_snr, epochs, lf, 'marker', 'event1');
  101. EEG2_snr = utl_create_eeglabdataset(data2_snr, epochs, lf, 'marker', 'event2');
  102. %__________________________________________________________________________
  103. % run decoding
  104. % cosmo wants the data as trial*channel*time
  105. % reformat and combine data
  106. allData = [permute(EEG1_snr.data,[3,1,2]);permute(EEG2_snr.data,[3,1,2])];
  107. % take channel locations and timevector from one dataset
  108. chanlocs = EEG1_snr.chanlocs; times = EEG1_snr.times;
  109. % flatten the data over chan and time
  110. % the data is organised such that it does time 1 over all channels, then
  111. % time 2 over all channels etc.
  112. ds = cosmo_flatten(allData,{'chan','time'},...
  113. {chanlocs,times});
  114. % add targets to dataset
  115. ds.sa.targets = [ones([size(EEG1_snr.data,3),1]);...
  116. repmat(2,[size(EEG1_snr.data,3),1])];
  117. % first set chunks so that all samples are assumed to be independent
  118. ds.sa.chunks = [(1:size(EEG1_snr.data,3))';(1:size(EEG2_snr.data,3))'];
  119. % re-assign chunks pseudo-randomly into blocks
  120. ds.sa.chunks = cosmo_chunkize(ds,nchunks);
  121. % iterate over count values - number of samples to select for each average
  122. for count = 1:max_count
  123. disp(['c',num2str(count)])
  124. % count 1 resamp 1 is always the same
  125. if count == 1; max_resamp =1; else; max_resamp = copy_max_resamp;end
  126. % iterate over resampling values - maximum number of times each sample in ds is used for averaging
  127. for resampling = 1:max_resamp
  128. disp(['r',num2str(resampling)])
  129. % use seed for pseudo-random sampling
  130. for seed = 1:nseeds
  131. % averages samples using count and resampling values
  132. % use a different seed each time
  133. ds_avg_rs = cosmo_average_samples(ds,'count',count,'resamplings',resampling,'seed',seed);
  134. % run classifier and save accuracy
  135. ma={};
  136. ma.classifier = my_classifier;
  137. ma.max_feature_count = 10000;
  138. ma.partitions = cosmo_nfold_partitioner(ds_avg_rs);
  139. res_rs = cosmo_crossvalidation_measure(ds_avg_rs,ma);
  140. x(count,resampling,seed,ptp) = res_rs.samples;
  141. % to use permutation testing
  142. if seed == 1
  143. acc0 = zeros(nperm,1);
  144. ds0 = ds_avg_rs; ma0 = ma; % copy of datasets
  145. for k = 1:nperm
  146. ds0.sa.targets = cosmo_randomize_targets(ds0);
  147. [~, acc0(k)] = cosmo_crossvalidate(ds0,ma0.classifier,ma0.partitions,ma0);
  148. end
  149. p = sum(res_rs.samples<acc0)/nperm;
  150. perm(:,count,resampling,seed,ptp) = acc0;
  151. pvals(count,resampling,seed,ptp) = p;
  152. end
  153. end % seed
  154. end % resampling
  155. end % count
  156. end % ptp
  157. % X = count x resampling x seeds x ptp (ptps)
  158. % mean over resampling seeds
  159. Y_res(:,:,1) = mean(mean(x,3),4);
  160. Y_res(:,:,2) = std(mean(x,3),0,4);
  161. 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')
  162. 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')
  163. 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')
  164. 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

  1. MRC Cognition and Brain Sciences Unit University of Cambridge Cambridge UK
  2. School of Philosophy, Psychology and Language Sciences University of Edinburgh Edinburgh UK
  3. The MARCS Institute for Brain, Behaviour and Development Western Sydney University Sydney New South Wales Australia
  4. School of Computer, Data and Mathematical Sciences Western Sydney University Sydney New South Wales Australia
  5. Department of Psychology University of Cambridge Cambridge UK
Institutions: MRC Cognition and Brain Sciences Unit (United Kingdom); University of Cambridge (United Kingdom); University of Edinburgh (United Kingdom); Western Sydney University (Australia)
Journal: The European journal of neuroscience, volume 64, issue 2, article e70601
Dates: received 18 March 2025; accepted 13 June 2026; published online 19 July 2026; in print July 2026
Type: Research article · Language: English
License: CC BY
Identifiers: DOI 10.1111/ejn.70601 · PMID 42473262 · PMCID PMC13382189 · OpenAlex W4387460001
Open access: hybrid, a free copy (OpenAlex)
Status: code verified (how the code is found and verified)
Categories: human (organism), clinical / translational (subfield)
Methods: Connectivity, Statistics, Machine learning, Evoked potentials
Keywords: decoding, multivariate pattern analysis, pseudotrials
MeSH: Brain*, Image Processing, Computer-Assisted*, Classification Algorithms, Humans, Magnetic Resonance Imaging, Multivariate Analysis (* major topic)
Topic: Neural Networks and Applications (Artificial Intelligence, Computer Science), according to OpenAlex
Funding: Australian Research Council (DE230100380, DP170101840); Biotechnology and Biological Sciences Research Council (BBSRC) (BB/V003887/1); Medical Research Council (MC_UU_00030/15)
Citations: cited by 1 paper (Europe PMC); 21 references in the paper

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

License: none: the authors keep all their rights
State: the link answers, verified on 27 September 2026
Evidence: files inventoried
Languages: MATLAB (4)
Size: 9 files, 4 scripts
Software Heritage: not checked
Found in: “Data Availability Statement”
Not found: README, license file, CITATION.cff, environment file, tests, continuous integration, documentation
Availability: 1 check, the latest on 27 September 2026: the link answers (HTTP 200)
  • 27 September 2026: the link answers (HTTP 200)
4 files
At the source: osf.io/hjf75/

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://osf.io/hjf75/.

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://doi.org/10.1111/ejn.70601

BibTeX

@article{scrivener2026optimising,
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/ejn.70601},
url = {https://doi.org/10.1111/ejn.70601},
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/07/01
VL - 64
IS - 2
SP - e70601
SN - 0953-816X
PB - Wiley
DO - 10.1111/ejn.70601
UR - https://doi.org/10.1111/ejn.70601
LA - en
ER -

CSL-JSON

{
"id": "10.1111/ejn.70601",
"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": "Eur J Neurosci",
"volume": "64",
"issue": "2",
"page": "e70601",
"DOI": "10.1111/ejn.70601",
"PMID": "42473262",
"PMCID": "PMC13382189",
"ISSN": "0953-816X",
"publisher": "Wiley",
"URL": "https://doi.org/10.1111/ejn.70601",
"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 reports
In 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 biology
In 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 neuroscience
In 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 neuroscience
In 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 neuroscience
In 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 neuroimaging
In 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 neuroscience
In 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 consciousness
In 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.

Add the badge to the code's README

OSCR: the badge of this paper

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 -->
[![OSCR](https://openscicode.org/badge/doi/10.1111/ejn.70601.svg)](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:end
HTML
<!-- 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.