OSCR

Dissociable dynamic effects of expectation during statistical learning.

Code ↔ Paper

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

The 8 matches · 2 of them tie a paragraph to a whole file, not to given lines: weak matches, whose lines are not tinted
  1. [1] § Methods › Data analysis › EEG data preprocessing ↔ EEG_preprocessing.m, lines 53–122 · score 0.89 · eye blink, 200–400 ms, principal components, artefact, singular, Preprocessing
  2. [2] § Methods › Experimental design and statistical analysis › Stimuli and experimental paradigm › Main task ↔ ES_EEG.m, lines 43–102 · score 0.74 · conference room, Trailing categories, castle, cave, forest, barn
  3. [3] § Methods › Data analysis › Decoding analyses ↔ EEG_revision_logfits.m, lines 296–445 · score 0.72 · 123–180 ms, decoding accuracy, logarithmic, 280 ms, 123 ms, fitted
  4. [4] § Methods › Experimental design and statistical analysis › Stimuli and experimental paradigm › Main task ↔ EEG_revision_logfits.m, lines 153–206 · score 0.66 · conference room, castle, cave, forest, barn, beach
  5. [5] § Methods › Data analysis › Decoding analyses ↔ EEG_revision_logfits.m, lines 10–49 · score 0.61 · principal component, SNR, analysed, selection, threshold, PCA
  6. [6] § Methods › Data analysis › Categorisation task analysis ↔ EEG_revision_logfits.m, lines 296–445 · score 0.61 · 280–296 ms, 123–180 ms, 280 ms, log, 123 ms, windows
  7. [7] § Results › Behavioural results › Decoding analyses ↔ ES_EEG_LME.m, the whole file · a weak match · score 0.50 · Post hoc, Cohen, interaction, Cook, Outliers, distance
  8. [8] § Results › Behavioural results › Decoding analyses ↔ ES_EEG_LME.m, the whole file · a weak match · score 0.50 · post hoc, Cohen, interaction, Cook, Outliers, distance

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 · 445 lines · 18 KB · CC0-1.0 · 4 matches

  1. filedir = '/Users/ryszard/Downloads/etad_files';
  2. cd(filedir)
  3. spmdir = '/Users/ryszard/Documents/spm12_mac/';
  4. addpath(spmdir)
  5. spm('Defaults','EEG')
  6. addpath('/Users/ryszard/Downloads/hannah_elife_matlab_scripts/analysis')
  7. %% some settings:
  8. % some trials show strong linear trends (e.g. increasing amplitude over
  9. % time) - this can remove these trends
  10. do_detrend = 0; % detrend single-trial data? 1: yes, 0: no
  11. % here we decide if we do decoding based on single EEG channels, or on
  12. % principal components grouping several channels together
  13. do_pca = 1; % 1: PCA over channels; 0: original channels
  14. % here we decide if we use all available channels/components or if we select
  15. % only a subset for decoding
  16. do_selchan = 1; % 1: select channels/components based on SNR; 0: analyse all channels/components; 2: based on F stat (how strongly each channel/component differentiates between faces, houses and chairs)
  17. % if do_selchan == 1, we can set an SNR threshold (cut off threshold)
  18. snr_db = 8; % SNR threshold for channel selection (dB)
  19. % if do_selchan == 2, we can set a number of most sensitive channels
  20. fstat_nchan = 5; % number of channels selected based on F stat
  21. pps = setdiff(1:31,20) ;
  22. for s= 1:length(pps) % select participants of interest
  23. try
  24. % go to their folders
  25. if pps(s)<10
  26. datadir = strcat('/Users/ryszard/Downloads/etad_files/pp0',num2str(pps(s)));
  27. else
  28. datadir = strcat('/Users/ryszard/Downloads/etad_files/pp',num2str(pps(s)));
  29. end
  30. cd(datadir)
  31. pps(s)
  32. clear accuracy_leading* accuracy_trailing* % clean up variables for saving later
  33. for erp = 2 % 1: leading, 2: trailing
  34. temp = dir('eTad*.mat'); % single-trial EEG files to be loaded
  35. %% load data
  36. D = spm_eeg_load(temp(1).name); % load the file
  37. bdtrls = D.badtrials;
  38. data = D(:,:,:);
  39. data(D.badchannels,:,:) = NaN; % replace bad channels
  40. data(indchantype(D,'Other'),:,:) = NaN; % replace non-EEG channels (ECG, EOG)
  41. % in the EEG files, stimulus labels are:
  42. orig_labels = D.conditions';
  43. unique_labels = sort(D.condlist)';
  44. stim = orig_labels;
  45. % due to merged blocks etc. it is possible that two
  46. % consecutive images are trailing (or leading). let's
  47. % delete them. this is only a problem for s=25, pps(s)=26
  48. double_trailing = [];
  49. for i=2:length(stim)
  50. if length(find(strfind(stim{i},'trailing')))>0 & length(find(strfind(stim{i-1},'trailing')))>0
  51. double_trailing = [double_trailing i];
  52. end
  53. end
  54. double_leading = [];
  55. for i=2:length(stim)
  56. if length(find(strfind(stim{i},'leading')))>0 & length(find(strfind(stim{i-1},'leading')))>0
  57. double_leading = [double_leading i];
  58. end
  59. end
  60. if length(double_trailing)>0 | length(double_leading)>0 %% s=25, pps(s)=26
  61. double_trials = [double_leading double_trailing];
  62. stim(double_trials) = [];
  63. data(:,:,double_trials) = [];
  64. bdtrls = setdiff(bdtrls, double_trials);
  65. bdtrls(find(bdtrls>=min(double_trials))) = bdtrls(find(bdtrls>=min(double_trials))) - length(double_trials);
  66. end
  67. % due to battery issues etc. it is possible that the entire
  68. % recording starts with a trailing image or ends with a leading
  69. % image
  70. if length(find(strfind(stim{1},'trailing')))>0 % if for some reason it still ends with leading
  71. stim(1) = [];
  72. data(:,:,1) = [];
  73. end
  74. if length(find(strfind(stim{end},'leading')))>0 % if for some reason it still ends with leading
  75. stim(end) = [];
  76. data(:,:,end) = [];
  77. end
  78. % now make sure to exclude not just single bad trials but
  79. % entire pairs of leading and trailing images (so e.g. if a
  80. % leading image is bad, it will also mark the consecutive
  81. % trailing image as bad; and vice versa)
  82. bdtrls_leading = bdtrls(find(rem(bdtrls,2)==1)); % bad trials that are leading (i.e. odd)
  83. bdtrls_trailing = bdtrls(find(rem(bdtrls,2)==0)); % bad trials that are trailing (i.e. even)
  84. bdtrls = [bdtrls_leading bdtrls_leading+1 bdtrls_trailing bdtrls_trailing-1]; % exclude matching leading/trailing trials
  85. bdtrls(find(bdtrls<1)) = []; % in case the first trial is trailing and bad, remove it from the list
  86. bdtrls(find(bdtrls>size(data,3))) = []; % in case the last trial is leading and bad, remove it from the list
  87. bdtrls = unique(bdtrls);
  88. data(:,:,bdtrls) = NaN; % get rid of bad trials
  89. if do_detrend==1 % if you detrend, this will simply remove the linear trend
  90. for j=1:size(D,1)
  91. j
  92. to_detrend = squeeze(data(j,:,:));
  93. data(j,:,:)=detrend(to_detrend',1,'omitnan')';
  94. end
  95. end
  96. data(find(isnan(mean(nanmean(data,3),2))),:,:) = []; % remove bad channels
  97. stim(find(isnan(mean(nanmean(data,2),1)))) = [];
  98. data(:,:,find(isnan(mean(nanmean(data,2),1)))) = []; % remove bad trials
  99. if erp == 1 % leading
  100. pick_trials = find(cellfun(@numel, strfind(stim,'leading'))>0);
  101. else % trailing
  102. pick_trials = find(cellfun(@numel, strfind(stim,'trailing'))>0);
  103. end
  104. data = data(:,:,pick_trials);
  105. leading_labels = stim(find(cellfun(@numel, strfind(stim,'leading'))>0));
  106. trailing_labels = stim(find(cellfun(@numel, strfind(stim,'trailing'))>0));
  107. if do_pca == 1 % replace original channels with principal (temporal) components explaining 99% variance
  108. [U,S,V] = svd(reshape(data,[size(data,1) size(data,2)*size(data,3)]),'econ');
  109. no_comp = find(cumsum(diag(S).^2/sum(diag(S).^2))<.99, 1, 'last' ); % find those components that, taken together, explain 99% variance
  110. data = reshape(V(:,1:no_comp)',[no_comp size(data,2) size(data,3)]); % replace original data with principal components
  111. end
  112. if do_selchan == 1 % select channels/components with SNR > threshold
  113. if do_pca == 0
  114. data_erp = nanmean(data,3);
  115. snr_perchannel = 10*log10((rms(data_erp(:,indsample(D,0.05):indsample(D,0.15)),2)./rms(data_erp(:,1:indsample(D,0)),2)).^2);
  116. selcomps = find(snr_perchannel > snr_db);
  117. if length(selcomps) == 0
  118. selcomps = find(snr_perchannel > 3);
  119. end
  120. data = data(selcomps,:,:);
  121. else
  122. snr_perchannel = 10*log10((rms(nanmean(data(:,indsample(D,0.05):indsample(D,0.15),:),3),2)./rms(nanmean(data(:,1:indsample(D,0),:),3),2)).^2);
  123. selcomps = find(snr_perchannel > snr_db);
  124. if length(selcomps) < 2 % workaround for participant 7, trailing analysis
  125. selcomps = find(snr_perchannel > snr_db/2);
  126. end
  127. data = data(selcomps,:,:);
  128. end
  129. end
  130. if do_selchan == 2 % select channels/components based on F statistic (differences between diff types of tones)
  131. if do_pca == 0
  132. data_erp = cat(3,D(:,:,setdiff(indtrial(D,'1'),D.badtrials)),D(:,:,setdiff(indtrial(D,'2'),D.badtrials)),D(:,:,setdiff(indtrial(D,'3'),D.badtrials)));
  133. data_erp([D.badchannels indchantype(D,'Other')],:,:) = [];
  134. stimlabels = [ones(length(setdiff(indtrial(D,'1'),D.badtrials)),1)*1; ones(length(setdiff(indtrial(D,'2'),D.badtrials)),1)*2; ones(length(setdiff(indtrial(D,'3'),D.badtrials)),1)*3];
  135. for c=1:size(data_erp,1)
  136. for t=1:size(data_erp,2)
  137. % run an ANOVA
  138. [p,anovatab]=anova1(squeeze(data_erp(c,t,:)),stimlabels,'off');
  139. fs(c,t)=cell2mat(anovatab(2,5));
  140. end
  141. end
  142. fs=mean(fs,2);
  143. % collect all F values
  144. fs=sortrows([fs,[1:length(fs)]'],'descend');
  145. % select top channels
  146. selcomps = fs(1:fstat_nchan,2);
  147. data = data(selcomps,:,:);
  148. else
  149. error('option not implemented yet')
  150. end
  151. end
  152. clear trndat testdat covdat distance meandistance
  153. legal_pairs = {{'leading_Barn' 'trailing_church'} ... % valid 75%
  154. {'leading_Barn' 'trailing_conference_room'} ... % invalid 25%
  155. {'leading_beach' 'trailing_church'} ... % valid 75%
  156. {'leading_beach' 'trailing_conference_room'} ... % invalid 25%
  157. {'leading_library' 'trailing_conference_room'} ... % valid 75%
  158. {'leading_library' 'trailing_church'} ... % invalid 25%
  159. {'leading_restaurant' 'trailing_conference_room'} ... % valid 75%
  160. {'leading_restaurant' 'trailing_church'} ... % invalid 25%
  161. {'leading_cave' 'trailing_castle'} ... % control 50%
  162. {'leading_cave' 'trailing_forest'}}; % control 50%
  163. %% do decoding
  164. trial_count = [];
  165. for j = 1:length(legal_pairs)
  166. trial_count(j) = length(intersect(find(strcmp(leading_labels,legal_pairs{j}{1})),find(strcmp(trailing_labels,legal_pairs{j}{2}))));
  167. end
  168. subsample_trials = min(trial_count);
  169. subsample_trials = 47; % same for everyone
  170. no_samples(erp) = subsample_trials;
  171. for j = 1:length(legal_pairs)
  172. % temptrials = intersect(find(strcmp(leading_labels,legal_pairs{j}{1})),find(strcmp(trailing_labels,legal_pairs{j}{2})));
  173. % my_chosen_trials{j} = temptrials(1:subsample_trials);
  174. my_chosen_trials{j} = sort(randsample(intersect(find(strcmp(leading_labels,legal_pairs{j}{1})),find(strcmp(trailing_labels,legal_pairs{j}{2}))),subsample_trials));
  175. trndat{j} = data(:,:,my_chosen_trials{j}); % select the remaining trials as "train data" and average per feature and stimulus label across trials
  176. end
  177. strls = NaN(size(data,2),size(data,3));
  178. for k = 1:size(data,2) % per time point (no sliding)
  179. if erp==2 % trailing image analysis
  180. if rem(k,5) == 0
  181. display(strcat(['decoding trailing trials, finished ',num2str(round(100*k/size(data,2))), '%']))
  182. end
  183. % visual category decoding
  184. X = [];
  185. y = [];
  186. for c = 1:8
  187. X = [X; squeeze(trndat{c}(:,k,:))']; % trials x features
  188. y = [y; ones(subsample_trials,1)*length(find(strfind(legal_pairs{c}{2},'church')))]; % binary labels: church vs. conference room
  189. end
  190. testIndices = repmat([1:length(y)/8]',[1 8]);
  191. c = cvpartition("CustomPartition",testIndices(:));
  192. svmModel = fitcsvm(X, y, 'CrossVal', 'on', 'Leaveout', 'on');
  193. accuracy_trailing_visual(k) = mean(svmModel.kfoldPredict == y);
  194. accuracy_trailing_visual_decoderoutput(k,:) = svmModel.kfoldPredict == y;
  195. strl_lab = reshape(y,[subsample_trials 8]);
  196. strl_pred = reshape(svmModel.kfoldPredict,[subsample_trials 8]);
  197. strl_corr = strl_lab == strl_pred;
  198. strl_valid = strl_corr(:,1:2:8)-strl_corr(:,2:2:8);
  199. conds = 1:2:8;
  200. for c=1:length(conds)
  201. strls(k,my_chosen_trials{conds(c)}) = strl_valid(:,c);
  202. end
  203. end
  204. end
  205. end
  206. strls = strls(:,find(~isnan(strls(1,:))));
  207. save decoding_nodetrend_pca_snr8db_svm.mat strls
  208. % end
  209. catch
  210. end
  211. end
  212. %% pool data
  213. strls_all = nan(length(pps),180,188);
  214. for s= 1:length(pps) % select participants of interest
  215. % go to their folders
  216. if pps(s)<10
  217. datadir = strcat('/Users/ryszard/Downloads/etad_files/pp0',num2str(pps(s)));
  218. else
  219. datadir = strcat('/Users/ryszard/Downloads/etad_files/pp',num2str(pps(s)));
  220. end
  221. cd(datadir)
  222. load decoding_nodetrend_pca_snr8db_svm.mat
  223. strls_all(s,:,1:length(strls)) = strls;
  224. end
  225. %% fit trial-by-trial time series
  226. twin1 = [123 180]; % first significant time window (ms)
  227. twin2 = [280 296]; % second time window
  228. % convert ms to samples/indices
  229. tind1 = [min(find(D.time>=twin1(1)/1000)) max(find(D.time<=twin1(2)/1000))];
  230. tind2 = [min(find(D.time>=twin2(1)/1000)) max(find(D.time<=twin2(2)/1000))];
  231. % extract mean decoding accuracy (valid minus invalid) within each time window
  232. tser1 = squeeze(nanmean(strls_all(:,tind1(1):tind1(2),:),2));
  233. tser2 = squeeze(nanmean(strls_all(:,tind2(1):tind2(2),:),2));
  234. % define fit type (e.g. logarithmic)
  235. rng(12345)
  236. ft_model = fittype('A*log(B*x) + C', 'independent', 'x'); % logarithmic
  237. startPoints = [0 1 0]; % starting points for A, B, C
  238. % ft_model = fittype('A*exp(-B*x) + C', 'independent', 'x'); % exponential
  239. % startPoints = [0 .01 0]; % starting points for A, B, C
  240. smoothf = 5; % smooth data over N trials (for fits)
  241. toler = .001; % tolerance of derivative over trials to determine when decoding plateaus
  242. % fit per participant
  243. log_fit1 = tser1*0;
  244. log_fit2 = tser2*0;
  245. for i=1:size(tser1,1)
  246. % early time window
  247. tempfit = fit([1:size(tser1,2)]', smooth(tser1(i,:),smoothf), ft_model, 'StartPoint', startPoints);
  248. log_fit1(i,:) = tempfit(1:size(tser1,2));
  249. d_exp = differentiate(tempfit, 1:size(tser1,2)); % First derivative of the exponential fit
  250. try
  251. plateau_idx_exp1(i) = find(abs(d_exp) < toler, 1); % Tolerance can be adjusted
  252. catch
  253. plateau_idx_exp1(i) = NaN;
  254. end
  255. y = smooth(tser1(i,:),smoothf);
  256. y_fit = tempfit(1:size(tser1,2));
  257. residuals = y - y_fit;
  258. SST = sum((y - mean(y)).^2);
  259. SSE = sum(residuals.^2);
  260. R_squared1(i) = 1 - (SSE / SST);
  261. % late time window
  262. tempfit = fit([1:size(tser2,2)]', smooth(tser2(i,:),smoothf), ft_model, 'StartPoint', startPoints);
  263. log_fit2(i,:) = tempfit(1:size(tser2,2));
  264. d_exp = differentiate(tempfit, 1:size(tser2,2)); % First derivative of the exponential fit
  265. try
  266. plateau_idx_exp2(i) = find(abs(d_exp) < toler, 1); % Tolerance can be adjusted
  267. catch
  268. plateau_idx_exp2(i) = NaN;
  269. end
  270. y = smooth(tser2(i,:),smoothf);
  271. y_fit = tempfit(1:size(tser2,2));
  272. residuals = y - y_fit;
  273. SST = sum((y - mean(y)).^2);
  274. SSE = sum(residuals.^2);
  275. R_squared2(i) = 1 - (SSE / SST);
  276. end
  277. figure;
  278. subplot(2,4,1)
  279. smooth_tser1 = tser1*0;
  280. for i=1:30
  281. smooth_tser1(i,:) = smooth(tser1(i,:),smoothf);
  282. end
  283. shadedErrorBar(1:size(tser1,2),mean(smooth_tser1,1),std(smooth_tser1,[],1)/sqrt(30))
  284. xlabel('trials')
  285. ylabel('rel. decoding acc. (val-inv)')
  286. title('data, early time window')
  287. ylim([-.2 .2])
  288. line([1 size(tser1,2)],[0 0],'linestyle','--','color','k')
  289. subplot(2,4,5)
  290. smooth_tser2 = tser2*0;
  291. for i=1:30
  292. smooth_tser2(i,:) = smooth(tser2(i,:),smoothf);
  293. end
  294. shadedErrorBar(1:size(tser2,2),mean(smooth_tser2,1),std(smooth_tser2,[],1)/sqrt(30))
  295. xlabel('trials')
  296. ylabel('rel. decoding acc. (val-inv)')
  297. title('data, late time window')
  298. ylim([-.2 .2])
  299. line([1 size(tser1,2)],[0 0],'linestyle','--','color','k')
  300. subplot(2,4,2)
  301. hold on
  302. means = squeeze(mean(mean(reshape(tser1,[size(tser1,1) size(tser1,2)/4 4]),2),1));
  303. sems = squeeze(std(mean(reshape(tser1,[size(tser1,1) size(tser1,2)/4 4]),2),[],1))/sqrt(size(tser1,1));
  304. bar(means)
  305. errorbar(means,sems,'color','blue','linestyle','none')
  306. xticks(1:4)
  307. xlabel('bin')
  308. ylabel('rel. decoding acc. (val-inv)')
  309. title('early time window')
  310. ylim([-.06 .06])
  311. line([0 5],[0 0],'linestyle','--','color','k')
  312. subplot(2,4,6)
  313. hold on
  314. means = squeeze(mean(mean(reshape(tser2,[size(tser2,1) size(tser2,2)/4 4]),2),1));
  315. sems = squeeze(std(mean(reshape(tser2,[size(tser2,1) size(tser2,2)/4 4]),2),[],1))/sqrt(size(tser2,1));
  316. bar(means)
  317. errorbar(means,sems,'color','blue','linestyle','none')
  318. xticks(1:4)
  319. xlabel('bin')
  320. ylabel('rel. decoding acc. (val-inv)')
  321. title('late time window')
  322. ylim([-.06 .06])
  323. line([0 5],[0 0],'linestyle','--','color','k')
  324. subplot(2,4,3)
  325. shadedErrorBar(1:size(log_fit1,2),mean(log_fit1,1),std(log_fit1,[],1)/sqrt(30))
  326. xlabel('trials')
  327. ylabel('rel. decoding acc. (val-inv)')
  328. title('fit, early time window')
  329. ylim([-.06 .06])
  330. line([1 size(tser1,2)],[0 0],'linestyle','--','color','k')
  331. subplot(2,4,7)
  332. shadedErrorBar(1:size(log_fit2,2),mean(log_fit2,1),std(log_fit2,[],1)/sqrt(30))
  333. xlabel('trials')
  334. ylabel('rel. decoding acc. (val-inv)')
  335. title('fit, late time window')
  336. ylim([-.06 .06])
  337. line([1 size(tser1,2)],[0 0],'linestyle','--','color','k')
  338. subplot(2,4,4)
  339. hold on
  340. nanm = nanmedian(plateau_idx_exp1/size(tser1,2));
  341. violinplot(plateau_idx_exp1/size(tser1,2))
  342. line([0 2],[nanm nanm],'linestyle','-','color','k')
  343. title('fit, early, plateau')
  344. ylabel('trials')
  345. ylim([0 1])
  346. prctile(plateau_idx_exp1/size(tser1,2),[1 50 99])
  347. subplot(2,4,8)
  348. hold on
  349. nanm = nanmedian(plateau_idx_exp2/size(tser1,2));
  350. violinplot(plateau_idx_exp2/size(tser1,2))
  351. line([0 2],[nanm nanm],'linestyle','-','color','k')
  352. title('fit, late, plateau')
  353. ylabel('trials')
  354. ylim([0 1])
  355. prctile(plateau_idx_exp2/size(tser1,2),[1 50 99])

EEG_revision_logfits.m at commit 30ef15b, under CC0-1.0 · at the source

Overview

  1. Department of Education and Psychology, Freie Universität Berlin, Berlin, Germany
  2. Berlin School of Mind and Brain, Berlin, Germany
  3. Faculty of Psychology and Neuroscience, Maastricht University, Maastricht, Netherlands
  4. Neural Circuits and Cognition Lab, European Neuroscience Institute Göttingen—A Joint Initiative of the University Medical Center Göttingen and the Max Planck Institute for Multidisciplinary Sciences, Göttingen, Germany
  5. Perception and Plasticity Group, German Primate Center, Leibniz Institute for Primate Research, Göttingen, Germany
  6. Cognitive Neurobiology, Research Center One Health Ruhr, University Alliance Ruhr, Faculty of Biology and Biotechnology, Ruhr-University Bochum, Bochum, Germany
Journal: eLife, volume 13, article RP103689
Dates: published online 3 March 2026
Type: Research article · Language: English
License: CC BY
Identifiers: DOI 10.7554/elife.103689 · PMID 41773829 · PMCID PMC12956278 · OpenAlex W4405526645
Open access: gold, a free copy (OpenAlex)
Status: code verified
Categories: EEG (modality), human (organism)
Methods: Spectral & time-frequency, Preprocessing, Connectivity, Statistics, Smoothing, state filtering, decompositions, Machine learning, Evoked potentials, fMRI & imaging, Physiology & signal measures
Keywords: Human
MeSH: Brain*, Learning*, Electroencephalography, Female, Humans, Outcome Expectations (* major topic)
Topic: Neural dynamics and brain function (Cognitive Neuroscience, Neuroscience), according to OpenAlex
Funding: Deutsche Forschungsgemeinschaft (SCHW1683/2-1, AU423/2-1); European Research Council (101001270)
Citations: cited by 3 papers (Europe PMC); 55 references in the paper
Research resources: for Matlab RRID:SCR_001622, RRID:SCR_007037

Abstract

The brain is thought to optimise behaviour by generating predictions based on learned statistical regularities. Predictive processing seemingly explains expectation suppression (ES), the attenuation of neural activity in response to expected stimuli. However, the mechanisms behind ES are unclear, with conflicting evidence for alternative models. Sharpening models propose that expectations suppress neurons away from the expected stimulus, increasing the signal-to-noise ratio and boosting decoding for expected stimuli. In contrast, dampening models posit that expectations suppress neurons that are tuned to the expected stimuli, reducing overall response magnitude and decoding accuracy. The opposing process theory (OPT) suggests that both processes occur at different time points, namely that initial sharpening is followed by later dampening of the neural representations of the expected stimulus. Here we test this theory and shed light on the dynamics of expectation effects, both at single-trial level and over time. Thirty-one participants completed a statistical learning task in which a ‘leading’ image from one category predicted a ‘trailing’ image from a different category. Multivariate EEG analyses decoded stimulus information related to the trailing category. Within-trial, expectation increased decoding accuracy at early latencies and decreased it at later latencies, in line with OPT. However, across trials, stimulus expectation decreased decoding accuracy in initial trials and increased it in later trials. We theorise that these dissociable dynamics of expectation effects within and across trials support hierarchical learning mechanisms. While within-trial results support the OPT, across-trial results suggest that sharpening and dampening effects emerge at distinct stages of associative learning.

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 8 matches between paragraphs and lines of code.

hannahmcderm/expectation_eeg_elife

License: CC0-1.0
State: the link answers, verified on 30 September 2026
Evidence: files inventoried
Commit: 30ef15b93064484a312423ef1062860a89e26e1c, 3 March 2026
Languages: MATLAB (6)
Size: 10 files, 6 scripts
Software Heritage: not archived
Found in: the references
Holds: README, license file
Not found: CITATION.cff, environment file, tests, continuous integration, documentation
Availability: 1 check, the latest on 30 September 2026: the link answers
  • 30 September 2026: the link answers
8 files

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;
  • 6 scripts, each with its path and the digest of its content;
  • 8 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

Datasets cited

Data availability

Scripts and stimuli are available at https://github.com/hannahmcderm/Expectation_EEG_eLife (copy archived at McDermott, 2025) data is available at https://osf.io/x7ydf.

The following dataset was generated:

McDermott H. 2025. ExpectationSuppression_EEG_eLife. Open Science Framework. x7ydf

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 1, 30 September 2026: the first record

Recorded: type, language, journal, volume, pages, dates, 4 authors, 1 keyword, 6 MeSH terms, 2 funders, 54 references, 2 RRIDs.

Cite

This paper

McDermott, H. H., de Martino, F., Schwiedrzik, C. M., & Auksztulewicz, R. (2026). Dissociable dynamic effects of expectation during statistical learning. eLife, 13, RP103689. https://doi.org/10.7554/elife.103689

BibTeX

@article{mcdermott2026dissociable,
author = {McDermott, Hannah H and de Martino, Federico and Schwiedrzik, Caspar M and Auksztulewicz, Ryszard},
title = {{Dissociable dynamic effects of expectation during statistical learning}},
journal = {eLife},
year = {2026},
month = mar,
volume = {13},
pages = {RP103689},
publisher = {eLife Sciences Publications, Ltd},
issn = {2050-084X},
doi = {10.7554/elife.103689},
url = {https://doi.org/10.7554/elife.103689},
pmid = {41773829},
pmcid = {PMC12956278}
}

RIS

TY - JOUR
AU - McDermott, Hannah H
AU - de Martino, Federico
AU - Schwiedrzik, Caspar M
AU - Auksztulewicz, Ryszard
TI - Dissociable dynamic effects of expectation during statistical learning
T2 - eLife
J2 - Elife
PY - 2026
DA - 2026/03/03
VL - 13
SP - RP103689
SN - 2050-084X
PB - eLife Sciences Publications, Ltd
DO - 10.7554/elife.103689
UR - https://doi.org/10.7554/elife.103689
LA - en
ER -

CSL-JSON

{
"id": "10.7554/elife.103689",
"type": "article-journal",
"title": "Dissociable dynamic effects of expectation during statistical learning",
"container-title": "eLife",
"author": [
{
"family": "McDermott",
"given": "Hannah H"
},
{
"family": "de Martino",
"given": "Federico"
},
{
"family": "Schwiedrzik",
"given": "Caspar M"
},
{
"family": "Auksztulewicz",
"given": "Ryszard"
}
],
"container-title-short": "Elife",
"volume": "13",
"page": "RP103689",
"DOI": "10.7554/elife.103689",
"PMID": "41773829",
"PMCID": "PMC12956278",
"ISSN": "2050-084X",
"publisher": "eLife Sciences Publications, Ltd",
"URL": "https://doi.org/10.7554/elife.103689",
"language": "en",
"issued": {
"date-parts": [
[
2026,
3,
3
]
]
}
}

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/s41467-026-73540-z [code]
Predictive acoustical processing in human cortical layers.
Journal: Nature communications
In common: SPM, Image Processing Toolbox, Statistics and Machine Learning Toolbox, 2 references, 2 authors
[2] doi:10.1523/jneurosci.0154-26.2026 [code]
Faster but less precise: expectation enhances response speed while reducing sensory fidelity.
Journal: The Journal of neuroscience : the official journal of the Society for Neuroscience
In common: shadedErrorBar, Image Processing Toolbox, Statistics and Machine Learning Toolbox, EEG, 7 references
[3] doi:10.1038/s41467-026-75662-w [code]
Distinct Roles of Deep and Superficial Cortical Layers in Tone Prediction, Comparison, and Adaptation in Human Auditory Cortices.
Journal: Nature communications
In common: Psychtoolbox, Statistics and Machine Learning Toolbox, 3 references, author Federico De Martino
[4] doi:10.1371/journal.pone.0357956 [code]
Early electrophysiological responses reflect precision-weighted prediction errors to face features.
Journal: PloS one
In common: EEG, 7 references
[5] doi:10.1016/j.isci.2026.117074 [code]
The effects of action-based predictions in early visual cortex.
Journal: iScience
In common: 6 references
[6] doi:10.1038/s41467-026-72935-2 [code]
Spindle neurons in human cortex possess distinctive firing properties and transcriptomic signatures.
Journal: Nature communications
In common: Violinplot-Matlab, shadedErrorBar, Curve Fitting Toolbox, 2 other tools
[7] doi:10.1002/glia.70141 [code]
Conservation of Neuron-Astrocyte Correlated Activity in Developing Sensory Pathways.
Journal: Glia
In common: shadedErrorBar, Psychtoolbox, Curve Fitting Toolbox, 2 other tools
[8] doi:10.1038/s41467-026-75490-y [code]
Topographically organized dorsal raphe activity modulates forebrain sensory-motor representations and contributes to defensive behaviors.
Journal: Nature communications
In common: Violinplot-Matlab, shadedErrorBar, Curve Fitting Toolbox, 2 other tools
[9] doi:10.1038/s41467-026-75359-0 [code]
Neural mechanisms of time-forward predictions for naturalistic auditory tone sequences.
Journal: Nature communications
In common: shadedErrorBar, Psychtoolbox, SPM, 1 other tool, EEG, 1 reference
[10] doi:10.1038/s41467-026-71151-2 [code]
Common and distinct neural correlates of social interaction processing and theory of mind in narratives.
Journal: Nature communications
In common: Violinplot-Matlab, Psychtoolbox, SPM, 2 other tools

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.

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