OSCR

Resting-State Theta and Alpha Oscillations in Amputation and Phantom Limb Pain: A Pre-Registered High-Density EEG Study.

Code ↔ Paper

11 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 11 matches · 3 of them tie a paragraph to a whole file, not to given lines: weak matches, whose lines are not tinted
  1. [1] § Methods › Data Preprocessing ↔ preprocessing.m, lines 115–158 · score 0.70 · CleanLine, ZapLine Plus, noise, Preprocessing
  2. [2] § Methods › Data Analysis and Statistical Comparisons › RQ1 – Theta Power ↔ main_analysis.m, lines 188–268 · score 0.60 · log transformed, theta band, frequency band, Sex, Age, PLP
  3. [3] § Results › Research Question 2: Peak Alpha Frequency (PAF) ↔ main_analysis.m, lines 71–177 · score 0.58 · linear model, right tailed, AmpNoPLP, AmpPLP, unadjusted, bootstrapped
  4. [4] § Methods › Data Analysis and Statistical Comparisons › RQ1 – Theta Power ↔ exploratory_analysis.m, lines 1–19 · score 0.56 · DISCOVER EEG, FieldTrip toolbox
  5. [5] § Methods › Data Analysis and Statistical Comparisons › RQ1 – Theta Power ↔ main_analysis.m, lines 1–19 · score 0.56 · DISCOVER EEG, FieldTrip toolbox
  6. [6] § Results › Research Question 1: Theta Power ↔ Supporting functions/RunModelDiagnostics.m, the whole file · a weak match · score 0.54 · Model diagnostics, random intercepts, marginal, R2, PLP
  7. [7] § Results › Research Question 2: Peak Alpha Frequency (PAF) ↔ Supporting functions/RunModelDiagnostics.m, the whole file · a weak match · score 0.54 · Model diagnostics, random intercepts, marginal, R2, PLP
  8. [8] § Methods › Data Preprocessing ↔ preprocessing.m, lines 285–347 · score 0.53 · discontinuities, rejected, overlap, epochs, segments, preprocessed
  9. [9] § Methods › Data Analysis and Statistical Comparisons › Exploratory Analyses ↔ exploratory_analysis.m, lines 64–100 · score 0.53 · 1–100 Hz, alpha band, spectrum, CBPT, Exploratory, power
  10. [10] § Results › Research Question 1: Theta Power ↔ main_analysis.m, lines 71–177 · score 0.51 · right tailed, AmpNoPLP, AmpPLP, theta power, raincloud, linear
  11. [11] § Results › Research Question 2: Peak Alpha Frequency (PAF) ↔ Supporting functions/GetStats.m, the whole file · a weak match · score 0.50 · bootstrapped CIs, coefficients, AmpNoPLP, AmpPLP, mixed, Sex

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 · 588 lines · 19 KB · CC-BY-4.0 · 4 matches

  1. %% Comparison of EEG features AmpPLP, AmpNoPLP and IC
  2. clear;
  3. % Packages, toolboxes and supporting functions
  4. restoredefaultpath
  5. addpath('./Supporting functions/')
  6. % Required supporting packages:
  7. % discover-eeg-master
  8. % eeglab2025.0.0 (or later, then adjust eeglab_path and params.json)
  9. % Fieldtrip toolbox
  10. % BCT/2019_03_03_BCT (or later, then just then adjust params.json)
  11. discover_path = './Supporting functions/discover-eeg-master/';
  12. eeglab_path = './Supporting functions/eeglab2025.0.0/';
  13. ft_path = './Supporting functions/FieldTrip Toolbox/';
  14. addpath(genpath(discover_path))
  15. addpath(eeglab_path)
  16. addpath(ft_path)
  17. ft_defaults % initiate Fieldtrip
  18. %%
  19. % Path to params.json file
  20. params_path = 'params.json';
  21. params = define_params(params_path);
  22. % Path to STUDY file
  23. study_path = params.PreprocessedDataPath;
  24. STUDY = pop_loadstudy('filename', 'Investigating Neuro-Ocillatory Correlates of Phantom Limb Pain with Resting State High-Density EEG-clean.study', 'filepath', study_path);
  25. % Destination of figures and results
  26. figures_path = append(study_path, '/analysis/figures');
  27. results_path = append(study_path, '/analysis/results');
  28. if ~isdir(figures_path)
  29. mkdir(figures_path)
  30. end
  31. if ~isdir(results_path)
  32. mkdir(results_path)
  33. end
  34. % Colors for plotting
  35. colors = lines(4);
  36. cAmpPLP = colors(3,:);
  37. cAmpNoPLP = colors(1,:);
  38. cIC = colors(2,:);
  39. cPooled = colors(4,:);
  40. % Regression formulas
  41. lmFormula = ' ~ Amp + Pain + Age + Sex';
  42. lmeFormula = ' ~ Amp + Pain + Age + Sex + (1|Subject)';
  43. %% Analysis settings
  44. % Whether to randomize subjects (for blinding while preparing the data analysis)
  45. randomizeSubjects = false;
  46. % Task = {'EYESOPEN', 'EYESCLOSED'}
  47. task = 'EYESCLOSED';
  48. % Number of bootstraps
  49. nBoot = 5000;
  50. %% Get features for each recording
  51. % Average feature over repeated measures
  52. avgFeature = false;
  53. % {'APF', 'Power', 'Connectivity', 'Graph'}
  54. features = {'Power', 'APF'};
  55. bidsIDToSkip = {};
  56. features_tbl = GetStudyFeatures(STUDY, task, randomizeSubjects,...
  57. features, avgFeature, bidsIDToSkip);
  58. %% Theta power
  59. % Compute average theta power across channels and theta band frequencies
  60. allPow = features_tbl.Power;
  61. cfg.channel = 'all';
  62. cfg.parameter = 'powspctrm';
  63. cfg.foilim = params.FreqBand.theta;
  64. cfg.keepindividual = 'yes'; % here individual = trial
  65. grandavg = ft_freqgrandaverage(cfg,allPow{:}); % extract the theta band
  66. avgThetaPow = squeeze(mean(mean(grandavg.powspctrm,3),2)); % avg across channels and freqs
  67. % Create new table with log(AvgThetaPow) as variable
  68. tbl = features_tbl;
  69. tbl.Max = []; tbl.Cog = []; tbl.Power = []; % remove redundant rows
  70. for i = 1:height(tbl)
  71. tbl.AvgThetaPow(i) = log(avgThetaPow(i));
  72. end
  73. % Fit model and get stats
  74. fprintf('\n---- Main results ----')
  75. main_stats = GetStats(tbl, ['AvgThetaPow', lmeFormula], nBoot, true);
  76. save(fullfile(results_path,'main_stats_theta'),'main_stats');
  77. % Sensitivity analysis - Linear model of per-subject averages
  78. % Iterate over table and create average power per subject
  79. uniqueSubjects = unique(tbl.Subject);
  80. tbl2 = tbl;
  81. tbl2(:,:) = [];
  82. for i = 1:length(uniqueSubjects)
  83. subjectRows = tbl.Subject == uniqueSubjects(i);
  84. rows = find(subjectRows);
  85. tbl2 = [tbl2; tbl(rows(1),:)];
  86. tbl2.AvgThetaPow(i) = mean(tbl.AvgThetaPow(rows));
  87. end
  88. % Fit model and get stats
  89. fprintf('\n---- Sensitivity analysis ----')
  90. sens_stats = GetStats(tbl2, ['AvgThetaPow', lmFormula], nBoot, true);
  91. save(fullfile(results_path,'sens_stats_theta'),'sens_stats');
  92. % Unadjusted t-test AmpPLP vs AmpNoPLP
  93. iAmpPLP = find(tbl2.Pain == "1");
  94. iAmpNoPLP = find(tbl2.Amp=="1" & tbl2.Pain=="0");
  95. iIC = find(tbl2.Amp=="0");
  96. [~,p1,ci1,~] = ttest2(tbl2.AvgThetaPow(iAmpPLP),tbl2.AvgThetaPow(iAmpNoPLP), 'Tail', 'right');
  97. [~,p2,ci2,~] = ttest2(tbl2.AvgThetaPow(iAmpNoPLP),tbl2.AvgThetaPow(iIC), 'Tail', 'both');
  98. fprintf('\nUnadjusted t-test AmpPLP vs AmpNoPLP: p = %.4f, CI = [%.3f, %.3f] (right-tailed) \n', p1, ci1(1), ci1(2));
  99. fprintf( 'Unadjusted t-test AmpNoPLP vs IC: p = %.4f, CI = [%.3f, %.3f] (two-tailed) \n', p2, ci2(1), ci2(2));
  100. % Raincloud plots per measurement
  101. theta_PLP_meas = tbl.AvgThetaPow(tbl.Pain == "1");
  102. theta_AmpNoPLP_meas = tbl.AvgThetaPow((tbl.Amp == "1") & (tbl.Pain == "0"));
  103. theta_IC_meas = tbl.AvgThetaPow(tbl.Amp == "0");
  104. f = figure('Units','centimeters','Position', [10 10 24 7]);
  105. rm_raincloud({theta_PLP_meas,theta_AmpNoPLP_meas,theta_IC_meas},[cAmpPLP;cAmpNoPLP;cIC]);
  106. xlabel('logPower');
  107. xlim([-5.2, 1.6])
  108. ylim([-0.4, 0.7])
  109. title('Average theta power per trial')
  110. yticks([])
  111. ax = gca;
  112. ax.FontSize = 12;
  113. % fake legend
  114. h(1) = scatter(nan,nan,10,cAmpPLP,'filled');
  115. h(2) = scatter(nan,nan,10,cAmpNoPLP,'filled');
  116. h(3) = scatter(nan,nan,10,cIC,'filled');
  117. legend(h,'AmpPLP','AmpNoPLP', 'IC');
  118. if randomizeSubjects
  119. ha = annotation('textbox',[.2 .5 .6 .1],'string','Dummy results');
  120. ha.HorizontalAlignment = 'center';
  121. ha.BackgroundColor = [0.9 0.5 1]; % make the box opaque with some color
  122. ha.FaceAlpha = 0.6;
  123. end
  124. figname = ['Theta_raincloud_meas_' task '.svg'];
  125. saveas(f,fullfile(figures_path,figname));
  126. % Raincloud plots per subject
  127. theta_PLP_subj = tbl2.AvgThetaPow(tbl2.Pain == "1");
  128. theta_AmpNoPLP_subj = tbl2.AvgThetaPow((tbl2.Amp == "1") & (tbl2.Pain == "0"));
  129. theta_IC_subj = tbl2.AvgThetaPow(tbl2.Amp == "0");
  130. f = figure('Units','centimeters','Position', [10 10 24 7]);
  131. rm_raincloud({theta_PLP_subj,theta_AmpNoPLP_subj,theta_IC_subj},[cAmpPLP;cAmpNoPLP;cIC]);
  132. xlabel('logPower');
  133. xlim([-5.2, 1.6])
  134. ylim([-0.4, 0.7])
  135. title('Average theta power per subject')
  136. yticks([])
  137. ax = gca;
  138. ax.FontSize = 12;
  139. if randomizeSubjects
  140. ha = annotation('textbox',[.2 .5 .6 .1],'string','Dummy results');
  141. ha.HorizontalAlignment = 'center';
  142. ha.BackgroundColor = [0.9 0.5 1]; % make the box opaque with some color
  143. ha.FaceAlpha = 0.6;
  144. end
  145. figname = ['Theta_raincloud_subj_' task '.svg'];
  146. saveas(f,fullfile(figures_path,figname));
  147. %%
  148. close all
  149. % To check model fits
  150. figure; histogram(tbl.AvgThetaPow,10); title('AvgThetaPow per trial'); xlabel('logPower');
  151. figure; histogram(tbl2.AvgThetaPow,10); title('AvgThetaPow per subject'); xlabel('logPower');
  152. load(fullfile(results_path,'main_stats_theta'),'main_stats')
  153. RunModelDiagnostics(main_stats, 'AvgThetaPow', true);
  154. load(fullfile(results_path,'sens_stats_theta'),'sens_stats')
  155. RunModelDiagnostics(sens_stats, 'AvgThetaPow', false);
  156. %% CBPT over theta band
  157. % ============== Specify which analysis to perform ================
  158. % Contrast {'PLP', 'Amp', 'Pooled'} = {AmpPLP vs AmpNoPLP, AmpNoPLP vs IC, AmpPLP vs AmpNoPLP+IC}
  159. contrast = 'Pooled';
  160. % Weather to perform adjusted or unadjusted analysis
  161. adjust = true;
  162. % =================================================================
  163. % Copy table of features
  164. tbl = features_tbl;
  165. fBand = params.FreqBand.theta;
  166. % If PLP contrast -> remove ICs
  167. if strcmp(contrast, 'PLP')
  168. toDelete = tbl.Amp == "0";
  169. tbl(toDelete,:) = [];
  170. % If Amp contrast -> remove AmpPLPs
  171. elseif strcmp(contrast, 'Amp')
  172. toDelete = tbl.Pain == "1";
  173. tbl(toDelete,:) = [];
  174. end
  175. % Iterate over table and create struct with average power per subject and covariates
  176. uniqueSubjects = unique(tbl.Subject);
  177. contrastData = struct();
  178. for i = 1:length(uniqueSubjects)
  179. subjectRows = tbl.Subject == uniqueSubjects(i);
  180. rows = find(subjectRows);
  181. % Get grand average power across trials
  182. cfg = [];
  183. cfg.channel = 'all';
  184. cfg.parameter = 'powspctrm';
  185. cfg.keepindividual = 'no'; % here individual = trials
  186. pwrRows = tbl.Power(rows);
  187. grandavg = ft_freqgrandaverage(cfg,pwrRows{:});
  188. % log-transform power spectrum for more robust normailty assumption
  189. grandavg.powspctrm = log(grandavg.powspctrm);
  190. contrastData(i).Power = grandavg;
  191. contrastData(i).Age = tbl.Age(rows(1));
  192. if tbl.Sex(rows(1)) == 'F' % F
  193. contrastData(i).Sex = 1;
  194. else % M
  195. contrastData(i).Sex = 2;
  196. end
  197. if tbl.Amp(rows(1)) == '1' % Amp
  198. contrastData(i).Amp = 1;
  199. else % No amp
  200. contrastData(i).Amp = 2;
  201. end
  202. if tbl.Pain(rows(1)) == '1' % Pain
  203. contrastData(i).Pain = 1;
  204. else % No pain
  205. contrastData(i).Pain = 2;
  206. end
  207. subj = strsplit(string(uniqueSubjects(i)), '-');
  208. contrastData(i).Subject = str2num(subj(2));
  209. end
  210. cfg = [];
  211. cfg.avgoverchan = 'yes';
  212. cfg.method = 'montecarlo';
  213. if adjust
  214. cfg.statistic = 'ft_statfun_indepsamplesregrT';
  215. else
  216. cfg.statistic = 'ft_statfun_indepsamplesT';
  217. end
  218. cfg.parameter = 'powspctrm';
  219. cfg.frequency = fBand;
  220. cfg.correctm = 'cluster';
  221. cfg.clusteralpha = 0.05;
  222. cfg.clusterstatistic = 'maxsum';
  223. cfg.alpha = 0.05;
  224. cfg.tail = 1; % 0 = two-sided, 1 = positive/right tail, -1 = negative/left tail
  225. cfg.clustertail = cfg.tail;
  226. cfg.numrandomization = 5000;
  227. % design matrix
  228. if strcmp(contrast, 'Amp') % Amp as independent variable
  229. design = [contrastData.Amp]; ...
  230. else % contrast PLP or Pooled --> Pain as independent variable
  231. design = [contrastData.Pain]; ...
  232. end
  233. % Add covariates for adjusted test
  234. if adjust
  235. design = [ design; ...
  236. [contrastData.Age]; ... % covariate 1
  237. [contrastData.Sex]]; % covariate 2
  238. end
  239. cfg.design = design;
  240. cfg.ivar = 1; % Independent variable, main effect to test
  241. if adjust
  242. cfg.covariate = [2 3]; % Covariates
  243. end
  244. cfg.avgoverfreq = 'no';
  245. if strcmp(contrast, 'Amp')
  246. idx = [contrastData.Amp] == 1;
  247. stat_contrast = ft_freqstatistics(cfg, contrastData(idx).Power, contrastData(~idx).Power);
  248. else % contrast PLP or Pooled --> Pain
  249. idx = [contrastData.Pain] == 1;
  250. stat_contrast = ft_freqstatistics(cfg, contrastData(idx).Power, contrastData(~idx).Power);
  251. end
  252. % Set plot colors based on contrast
  253. if strcmp(contrast, 'PLP')
  254. c1 = cAmpPLP;
  255. c2 = cAmpNoPLP;
  256. elseif strcmp(contrast, 'Amp')
  257. c1 = cAmpNoPLP;
  258. c2 = cIC;
  259. elseif strcmp(contrast, 'Pooled')
  260. c1 = cAmpPLP;
  261. c2 = cPooled;
  262. end
  263. power_fig = figure('Units','centimeters','Position', [10 10 18 6],'Visible','on');
  264. cfg = [];
  265. cfg.channel = 'all';
  266. cfg.parameter = 'powspctrm';
  267. cfg.avgoverchan = 'yes';
  268. cfg.keepindividual = 'no'; % here individual = subjects
  269. grandavgPain = ft_freqgrandaverage(cfg,contrastData(idx).Power);
  270. l{1} = stdshade(squeeze(grandavgPain.powspctrm),0.1,c1,grandavgPain.freq);
  271. hold on
  272. grandavgNoPain = ft_freqgrandaverage(cfg,contrastData(~idx).Power);
  273. l{2} = stdshade(squeeze(grandavgNoPain.powspctrm),0.1,c2,grandavgNoPain.freq);
  274. if strcmp(contrast, 'PLP')
  275. legend([l{:}],'AmpPLP','AmpNoPLP');
  276. elseif strcmp(contrast, 'Pooled')
  277. legend([l{:}],'AmpPLP','AmpNoPLP+IC');
  278. elseif strcmp(contrast, 'Amp')
  279. legend([l{:}],'AmpNoPLP','IC');
  280. end
  281. xlim(fBand)
  282. ylim([-3.1, -1])
  283. if adjust
  284. ttl = strcat(contrast, ' contrast, adjusted');
  285. else
  286. ttl = strcat(contrast, ' contrast, unadjusted');
  287. end
  288. %title(ttl)
  289. ylabel('logPower');
  290. xlabel('Frequency (Hz)');
  291. ax = gca;
  292. ax.FontSize = 12;
  293. % Indicate significant clusters
  294. siglvl = 0.05;
  295. if isfield(stat_contrast, 'posclusters')
  296. pos_cluster_pvals = [stat_contrast.posclusters(:).prob];
  297. pos_clust = find(pos_cluster_pvals < siglvl);
  298. pos = ismember(stat_contrast.posclusterslabelmat, pos_clust);
  299. significant_freqs = stat_contrast.freq(pos);
  300. plot(significant_freqs,-3*ones(1,length(significant_freqs)),'k','LineWidth',3);
  301. else
  302. disp("No significant positive clusters")
  303. end
  304. if isfield(stat_contrast, 'negclusters')
  305. neg_cluster_pvals = [stat_contrast.negclusters(:).prob];
  306. neg_clust = find(neg_cluster_pvals < siglvl);
  307. neg = ismember(stat_contrast.negclusterslabelmat, neg_clust);
  308. significant_freqs = stat_contrast.freq(neg);
  309. plot(significant_freqs,-3*ones(1,length(significant_freqs)),'k','LineWidth',3);
  310. else
  311. disp("No significant negative clusters")
  312. end
  313. if randomizeSubjects
  314. ha = annotation('textbox',[.2 .6 .6 .1],'string','Dummy results');
  315. ha.HorizontalAlignment = 'center';
  316. ha.BackgroundColor = [0.9 0.5 1]; % make the box opaque with some color
  317. ha.FaceAlpha = 0.6;
  318. end
  319. if adjust
  320. figname = ['Theta_' contrast '_adjusted_' task '.svg'];
  321. else
  322. figname = ['Theta_' contrast '_unadjusted_' task '.svg'];
  323. end
  324. saveas(power_fig,fullfile(figures_path,figname));
  325. %% APF Max
  326. maxTbl = features_tbl;
  327. maxTbl.Power = []; maxTbl.Cog = []; % remove redundant rows
  328. maxTbl(isnan(maxTbl.Max),:) = []; % remove NaN entries
  329. % Fit model and get stats
  330. fprintf('\n---- Main results - Max ----')
  331. main_stats = GetStats(maxTbl, ['Max', lmeFormula], nBoot, true);
  332. save(fullfile(results_path,'main_stats_APFMax'),'main_stats');
  333. % Sensitivity analysis - Per-subject model
  334. % Iterate over table and create average power per subject
  335. uniqueSubjects = unique(maxTbl.Subject);
  336. maxTbl2 = maxTbl;
  337. maxTbl2(:,:) = [];
  338. for i = 1:length(uniqueSubjects)
  339. subjectRows = maxTbl.Subject == uniqueSubjects(i);
  340. rows = find(subjectRows);
  341. maxTbl2 = [maxTbl2; maxTbl(rows(1),:)];
  342. maxTbl2.Max(i) = mean(maxTbl.Max(rows));
  343. end
  344. % Fit model and get stats
  345. fprintf('\n---- Sensitivity analysis - Max ----')
  346. sens_stats = GetStats(maxTbl2, ['Max', lmFormula], nBoot, true);
  347. save(fullfile(results_path,'sens_stats_APFMax'),'sens_stats');
  348. % Unadjusted t-test AmpPLP vs AmpNoPLP
  349. iAmpPLP = find(maxTbl2.Pain == "1");
  350. iAmpNoPLP = find(maxTbl2.Amp=="1" & maxTbl2.Pain=="0");
  351. iIC = find(maxTbl2.Amp=="0");
  352. [~,p1,ci1,~] = ttest2(maxTbl2.Max(iAmpPLP),maxTbl2.Max(iAmpNoPLP), 'Tail', 'right');
  353. [~,p2,ci2,~] = ttest2(maxTbl2.Max(iAmpNoPLP),maxTbl2.Max(iIC), 'Tail', 'both');
  354. fprintf('\nUnadjusted t-test AmpPLP vs AmpNoPLP: p = %.4f, CI = [%.3f, %.3f] (right-tailed) \n', p1, ci1(1), ci1(2));
  355. fprintf( 'Unadjusted t-test AmpNoPLP vs IC: p = %.4f, CI = [%.3f, %.3f] (two-tailed) \n', p2, ci2(1), ci2(2));
  356. % Raincloud plots per measurement
  357. max_PLP_meas = maxTbl.Max(maxTbl.Pain == "1");
  358. max_AmpNoPLP_meas = maxTbl.Max((maxTbl.Amp == "1") & (maxTbl.Pain == "0"));
  359. max_IC_meas = maxTbl.Max(maxTbl.Amp == "0");
  360. % Raincloud plots per subject
  361. max_PLP_subj = maxTbl2.Max(maxTbl2.Pain == "1");
  362. max_AmpNoPLP_subj = maxTbl2.Max((maxTbl2.Amp == "1") & (maxTbl2.Pain == "0"));
  363. max_IC_subj = maxTbl2.Max(maxTbl2.Amp == "0");
  364. f = figure('Units','centimeters','Position', [10 10 16 16]);
  365. tiledlayout(2,1,'Padding','compact');
  366. nexttile
  367. rm_raincloud({max_PLP_meas,max_AmpNoPLP_meas,max_IC_meas},[cAmpPLP;cAmpNoPLP;cIC]);
  368. xlim(params.FreqBand.alpha + [-0.2, 0.2]);
  369. ylim([-0.5, 1.2])
  370. xticklabels([])
  371. yticks([])
  372. title('Per trial')
  373. ax = gca;
  374. ax.FontSize = 12;
  375. % fake legend
  376. h(1) = scatter(nan,nan,10,cAmpPLP,'filled');
  377. h(2) = scatter(nan,nan,10,cAmpNoPLP,'filled');
  378. h(3) = scatter(nan,nan,10,cIC,'filled');
  379. legend(h,'AmpPLP','AmpNoPLP', 'IC');
  380. nexttile
  381. rm_raincloud({max_PLP_subj,max_AmpNoPLP_subj,max_IC_subj},[cAmpPLP;cAmpNoPLP;cIC]);
  382. xlim(params.FreqBand.alpha + [-0.2, 0.2]);
  383. ylim([-0.5, 1.2])
  384. yticks([])
  385. xlabel('Frequency [Hz]')
  386. title('Per subject')
  387. ax = gca;
  388. ax.FontSize = 12;
  389. sgtitle('Peak Alpha Frequency - Max')
  390. if randomizeSubjects
  391. ha = annotation('textbox',[.2 .5 .6 .05],'string','Dummy results');
  392. ha.HorizontalAlignment = 'center';
  393. ha.BackgroundColor = [0.9 0.5 1]; % make the box opaque with some color
  394. ha.FaceAlpha = 0.6;
  395. end
  396. figname = ['Alpha_raincloud_max_' task '.svg'];
  397. saveas(f,fullfile(figures_path,figname));
  398. %%
  399. close all
  400. % To check model fits
  401. figure; histogram(maxTbl.Max,10); title('PAF-Max per trial'); xlabel('Frequency [Hz]');
  402. figure; histogram(maxTbl2.Max,10); title('PAF-Max per subject'); xlabel('Frequency [Hz]');
  403. RunModelDiagnostics(main_stats, 'Max', true);
  404. RunModelDiagnostics(sens_stats, 'Max', false);
  405. %% Run model wihtout Amp to see if Age-effect pops out
  406. % Note – only as diagnostics
  407. lme = fitlme(maxTbl, ['Max', ' ~ Pain + Age + Sex + (1|Subject)']);
  408. lm = fitlm(maxTbl2, ['Max', ' ~ Pain + Age + Sex']);
  409. %% APF CoG
  410. cogTbl = features_tbl;
  411. cogTbl.Power = []; cogTbl.Max = []; % remove redundant rows
  412. % Fit model and get stats
  413. fprintf('\n---- Main results - CoG ----')
  414. main_stats = GetStats(cogTbl, ['Cog', lmeFormula], nBoot, true);
  415. save(fullfile(results_path,'main_stats_APFCog'),'main_stats');
  416. % Sensitivity analysis - Per-subject model
  417. % Iterate over table and create average power per subject
  418. uniqueSubjects = unique(cogTbl.Subject);
  419. cogTbl2 = cogTbl;
  420. cogTbl2(:,:) = [];
  421. for i = 1:length(uniqueSubjects)
  422. subjectRows = cogTbl.Subject == uniqueSubjects(i);
  423. rows = find(subjectRows);
  424. cogTbl2 = [cogTbl2; cogTbl(rows(1),:)];
  425. cogTbl2.Cog(i) = mean(cogTbl.Cog(rows));
  426. end
  427. % Fit model and get stats
  428. fprintf('\n---- Sensitivity analysis - CoG ----')
  429. sens_stats = GetStats(cogTbl2, ['Cog', lmFormula], nBoot, true);
  430. save(fullfile(results_path,'sens_stats_APFCog'),'sens_stats');
  431. % Unadjusted t-test AmpPLP vs AmpNoPLP
  432. iAmpPLP = find(cogTbl2.Pain == "1");
  433. iAmpNoPLP = find(cogTbl2.Amp=="1" & cogTbl2.Pain=="0");
  434. iIC = find(cogTbl2.Amp=="0");
  435. [~,p1,ci1,~] = ttest2(cogTbl2.Cog(iAmpPLP),cogTbl2.Cog(iAmpNoPLP), 'Tail', 'right');
  436. [~,p2,ci2,~] = ttest2(cogTbl2.Cog(iAmpNoPLP),cogTbl2.Cog(iIC), 'Tail', 'both');
  437. fprintf('\nUnadjusted t-test AmpPLP vs AmpNoPLP: p = %.4f, CI = [%.3f, %.3f] (right-tailed) \n', p1, ci1(1), ci1(2));
  438. fprintf( 'Unadjusted t-test AmpNoPLP vs IC: p = %.4f, CI = [%.3f, %.3f] (two-tailed) \n', p2, ci2(1), ci2(2));
  439. % Raincloudplots per measurement
  440. cog_PLP_meas = cogTbl.Cog(cogTbl.Pain == "1");
  441. cog_AmpNoPLP_meas = cogTbl.Cog((cogTbl.Amp == "1") & (cogTbl.Pain == "0"));
  442. cog_IC_meas = cogTbl.Cog(cogTbl.Amp == "0");
  443. % Raincloudplots per subject
  444. cog_PLP_subj = cogTbl2.Cog(cogTbl2.Pain == "1");
  445. cog_AmpNoPLP_subj = cogTbl2.Cog((cogTbl2.Amp == "1") & (cogTbl2.Pain == "0"));
  446. cog_IC_subj = cogTbl2.Cog(cogTbl2.Amp == "0");
  447. f = figure('Units','centimeters','Position', [10 10 16 16]);
  448. tiledlayout(2,1,'Padding','compact');
  449. nexttile
  450. rm_raincloud({cog_PLP_meas,cog_AmpNoPLP_meas,cog_IC_meas},[cAmpPLP;cAmpNoPLP;cIC]);
  451. xlim(params.FreqBand.alpha + [-0.2, 0.2]);
  452. ylim([-0.5, 1.2])
  453. yticks([])
  454. xticklabels([])
  455. %xlabel('Frequency [Hz]')
  456. title('Per trial')
  457. ax = gca;
  458. ax.FontSize = 12;
  459. % fake legend
  460. %h(1) = scatter(nan,nan,10,cAmpPLP,'filled');
  461. %h(2) = scatter(nan,nan,10,cAmpNoPLP,'filled');
  462. %h(3) = scatter(nan,nan,10,cIC,'filled');
  463. %legend(h,'AmpPLP','AmpNoPLP', 'IC');
  464. nexttile
  465. rm_raincloud({cog_PLP_subj,cog_AmpNoPLP_subj,cog_IC_subj},[cAmpPLP;cAmpNoPLP;cIC]);
  466. xlim(params.FreqBand.alpha + [-0.2, 0.2]);
  467. ylim([-0.5, 1.2])
  468. yticks([])
  469. xlabel('Frequency [Hz]')
  470. title('Per subject')
  471. ax = gca;
  472. ax.FontSize = 12;
  473. sgtitle('Peak Alpha Frequency - CoG')
  474. if randomizeSubjects
  475. ha = annotation('textbox',[.2 .5 .6 .05],'string','Dummy results');
  476. ha.HorizontalAlignment = 'center';
  477. ha.BackgroundColor = [0.9 0.5 1]; % make the box opaque with some color
  478. ha.FaceAlpha = 0.6;
  479. end
  480. figname = ['Alpha_raincloud_cog_' task '.svg'];
  481. saveas(f,fullfile(figures_path,figname));
  482. %%
  483. close all
  484. % To check model fits
  485. figure; histogram(cogTbl.Cog,8); title('PAF-CoG per trial'); xlabel('Frequency [Hz]');
  486. figure; histogram(cogTbl2.Cog,8); title('PAF-CoG per subject'); xlabel('Frequency [Hz]');
  487. RunModelDiagnostics(main_stats, 'Cog', true);
  488. RunModelDiagnostics(sens_stats, 'Cog', false);

main_analysis.m, under CC-BY-4.0 · at the source

Overview

  1. Department of Electrical Engineering, Chalmers University of Technology, Gothenburg, Sweden
  2. Department of Brain and Cognitive Sciences, MIT, Cambridge, USA
Journal: Brain topography, volume 39, issue 4, article 58
Dates: received 20 January 2026; accepted 1 May 2026; published online 22 May 2026; in print 2026
Type: Research article · Language: English
License: CC BY
Identifiers: DOI 10.1007/s10548-026-01210-w · PMID 42171820 · PMCID PMC13197317 · OpenAlex W7162131284
Open access: hybrid, a free copy (OpenAlex)
Status: code verified
Categories: EEG (modality), human (organism), pain (population), systems (subfield)
Methods: Connectivity, Statistics, Smoothing, state filtering, decompositions, Preprocessing, Spectral & time-frequency
Keywords: Phantom limb pain, Amputation, Resting-state, EEG, Electroencephalography, BIDS, Theta, Alpha oscillations, Peak alpha frequency, Chronic pain, Thalamocortical dysrhythmia, Alpha slowing
MeSH: Alpha Rhythm*, Amputation, Surgical*, Brain*, Phantom Limb*, Theta Rhythm*, Adult, Cross-Sectional Studies, Electroencephalography, Female, Humans, Male, Middle Aged, Rest (* major topic)
Topic: Pain Management and Treatment (Anesthesiology and Pain Medicine, Medicine), according to OpenAlex
Funding: Chalmers University of Technology
Citations: not cited yet (Europe PMC); 40 references in the paper

Abstract

Phantom limb pain (PLP) affects a substantial portion of individuals with limb amputation, yet its neural mechanisms remain poorly understood. While neuroimaging studies have predominantly employed functional magnetic resonance imaging and magnetoencephalography, resting-state EEG could offer complementary insight into intrinsic brain oscillations but remains underexplored in this context. More generally, neuropathic pain has been associated with increased theta-band power and slowing of peak alpha frequency but whether these patterns extend to PLP is unknown. Here, we conducted a pre-registered, cross-sectional investigation of high-density resting-state EEG (58 channels) in 19 intact controls, 6 amputees without PLP, and 13 amputees with PLP. We employed mixed-effects models with bootstrap inference, multiple sensitivity analyses, and exploratory cluster-based permutation testing. Across primary and sensitivity analyses, we found no evidence for a robust association between PLP and either theta power or peak alpha frequency. Amputation-related differences in the alpha band reached statistical significance in some analyses, suggesting possible alpha-band alterations associated with limb loss rather than pain per se. Exploratory analyses showed a positive association between one measure of peak alpha frequency and pain intensity. However, inconsistent replication across spectral measures and tests indicates that these amputation and pain intensity-related findings should be interpreted with caution. For instance, results differed depending on the metric used (spectral maximum vs. center of gravity), highlighting the sensitivity of peak alpha frequency analyses to methodological choices. Together, these results suggest that resting-state EEG markers commonly reported in chronic pain do not straightforwardly generalize to PLP.

Supplementary Information: The online version contains supplementary material available at 10.1007/s10548-026-01210-w.

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

Zenodo 17977343

License: CC-BY-4.0
State: the link answers, verified on 28 September 2026
Evidence: files inventoried
Size: 1 file
Software Heritage: not checked
Found in: “Data Availability”
Not found: README, license file, CITATION.cff, environment file, tests, continuous integration, documentation
Tools: Statistics and Machine Learning Toolbox (5 files), EEGLAB (4 files), FieldTrip (2 files)
Availability: 1 check, the latest on 28 September 2026: the link answers (HTTP 200)
  • 28 September 2026: the link answers (HTTP 200)
11 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;
  • 10 scripts, each with its path and the digest of its content;
  • 11 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 Statement

The data is available open access in BIDS-EEG format at: https://openneuro.org/datasets/ds006921.

Code for the statistical analysis is available at: 10.5281/zenodo.17977343.

The data is available open access in BIDS-EEG format at: [https://openneuro.org/datasets/ds006921](https:/openneuro.org/datasets/ds006921)Code for the statistical analysis is available at: [https://doi.org/10.5281/zenodo.17977343](https:/doi.org/10.5281/zenodo.17977343).

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 → Springer Science+Business Media

Version 1, 28 September 2026: the first record

Recorded: type, language, journal, volume, issue, pages, dates, 2 authors, 12 keywords, 13 MeSH terms, 1 funder, 40 references.

Cite

This paper

Ramne, M., & Lendaro, E. (2026). Resting-State Theta and Alpha Oscillations in Amputation and Phantom Limb Pain: A Pre-Registered High-Density EEG Study. Brain topography, 39(4), 58. https://doi.org/10.1007/s10548-026-01210-w

BibTeX

@article{ramne2026resting,
author = {Ramne, Malin and Lendaro, Eva},
title = {{Resting-State Theta and Alpha Oscillations in Amputation and Phantom Limb Pain: A Pre-Registered High-Density EEG Study}},
journal = {Brain topography},
year = {2026},
month = may,
volume = {39},
number = {4},
pages = {58},
publisher = {Springer Science+Business Media},
issn = {0896-0267},
doi = {10.1007/s10548-026-01210-w},
url = {https://doi.org/10.1007/s10548-026-01210-w},
pmid = {42171820},
pmcid = {PMC13197317}
}

RIS

TY - JOUR
AU - Ramne, Malin
AU - Lendaro, Eva
TI - Resting-State Theta and Alpha Oscillations in Amputation and Phantom Limb Pain: A Pre-Registered High-Density EEG Study
T2 - Brain topography
J2 - Brain Topogr
PY - 2026
DA - 2026/05/22
VL - 39
IS - 4
SP - 58
SN - 0896-0267
PB - Springer Science+Business Media
DO - 10.1007/s10548-026-01210-w
UR - https://doi.org/10.1007/s10548-026-01210-w
LA - en
ER -

CSL-JSON

{
"id": "10.1007/s10548-026-01210-w",
"type": "article-journal",
"title": "Resting-State Theta and Alpha Oscillations in Amputation and Phantom Limb Pain: A Pre-Registered High-Density EEG Study",
"container-title": "Brain topography",
"author": [
{
"family": "Ramne",
"given": "Malin"
},
{
"family": "Lendaro",
"given": "Eva"
}
],
"container-title-short": "Brain Topogr",
"volume": "39",
"issue": "4",
"page": "58",
"DOI": "10.1007/s10548-026-01210-w",
"PMID": "42171820",
"PMCID": "PMC13197317",
"ISSN": "0896-0267",
"publisher": "Springer Science+Business Media",
"URL": "https://doi.org/10.1007/s10548-026-01210-w",
"language": "en",
"issued": {
"date-parts": [
[
2026,
5,
22
]
]
}
}

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.1186/s12984-026-01998-5
Sensory and cortical biomarkers unveil pain modulation mechanisms induced by targeted multisensory neurostimulation.
Journal: Journal of neuroengineering and rehabilitation
In common: pain, EEG, 5 references
[2] doi:10.1002/ejp.70313 [code]
Predicting Pain: Electroencephalography Signatures of Neural Integration During Experimental Tonic Thermal Pain.
Journal: European journal of pain (London, England)
In common: EEGLAB, Statistics and Machine Learning Toolbox, pain, EEG, 3 references
[3] doi:10.7554/elife.111114 [code]
Theta beta ratio in attention deficit hyperactivity disorder using a multiverse analysis.
Journal: eLife
In common: EEGLAB, FieldTrip, Statistics and Machine Learning Toolbox, EEG, 3 references
[4] doi:10.1371/journal.pbio.3003948 [code]
Neural encoding of pain is robust within but unstable between individuals.
Journal: PLoS biology
In common: FieldTrip, pain, EEG, 4 references
[5] doi:10.1038/s41467-026-73553-8 [code]
Universal rhythmic architecture uncovers two modes of neural dynamics.
Journal: Nature communications
In common: FieldTrip, Statistics and Machine Learning Toolbox, EEG, 4 references
[6] doi:10.7554/elife.108408 [code]
Frequency and laminar profile of feature-specific visual activity revealed by interleaved EEG-fMRI.
Journal: eLife
In common: FieldTrip, Statistics and Machine Learning Toolbox, systems, EEG, 3 references
[7] doi:10.1016/j.neuroimage.2026.122002
EEG-based clustering shows distinct separation of chronic pain patients before spinal cord stimulation surgery.
Journal: NeuroImage
In common: pain, EEG, 4 references
[8] doi:10.1093/braincomms/fcag351 [code]
Time-resolved aperiodic dynamics in event segmentation in attention-deficit/hyperactivity disorder.
Journal: Brain communications
In common: EEGLAB, FieldTrip, Statistics and Machine Learning Toolbox, EEG, 2 references
[9] doi:10.1371/journal.pbio.3003979 [code]
Impaired midfrontal‑motor theta phase synchronization characterizes maladaptive motivational behavior in people with obsessive‑compulsive disorder.
Journal: PLoS biology
In common: EEGLAB, FieldTrip, Statistics and Machine Learning Toolbox, systems, EEG, 1 reference
[10] doi:10.1038/s41467-026-71600-y [code]
Temporal predictions shape somatosensory perception.
Journal: Nature communications
In common: FieldTrip, Statistics and Machine Learning Toolbox, pain, EEG, 2 references

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.