When the inner clock fades: Interoceptive decline and consolidation of phase resetting in cortical rhythms by cardiac events underlie healthy lifespan aging.
The 7 matches · 2 of them tie a paragraph to a whole file, not to given lines: weak matches, whose lines are not tinted
- [1] § Results › Heartbeat evoked responses (HERs) across lifespan ↔ MVGC.m, lines 21–91 · score 0.97 · Frontal Sup Orb, Frontal Med Orb, Frontal Mid Orb, Frontal Sup Medial, Frontal Inf Orb, Frontal Inf Tri
- [2] § Materials and Methods › Cardiovascular scores ↔ PanTompkin_Rpeak.m, lines 31–49 · score 0.68 · heart rate variability, Pan Tompkins, HRV, IBI, cardiovascular, interval
- [3] § Materials and Methods › Granger causality ↔ MVGC.m, lines 252–299 · score 0.63 · Granger Causality, diff, lag, stationarity, MVGC, tsdata
- [4] § Materials and Methods › Heartbeat evoked responses (HERs) ↔ HERsAcrossAge.m, the whole file · a weak match · score 0.55 · Pan Tompkins, cardiac cycle, epoch, MEG, peaks, ECG
- [5] § Materials and Methods › Pan-Tompkins algorithm ↔ HERsAcrossAge.m, the whole file · a weak match · score 0.54 · Pan Tompkins, cardiac cycle, peaks, ECG
- [6] § Results › Physiological metrics of cardiovascular health across lifespan ageing ↔ PanTompkin_Rpeak.m, lines 31–49 · score 0.51 · heart rate variability, HRV, IBI, cardiovascular, electrocardiographic, interval
- [7] § Materials and Methods › Data preprocessing ↔ ICA_July_thirdfinal_HEPdec2022 (1).ipynb, lines 31–62 · score 0.50 · MNE, ICA, max, Component, filter, 45 Hz
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 · 623 lines · 53 KB · no license · 2 matches
- %% Calculating MVGC using autocov_to_mvgc function
- % Date: 07/28/2025
- % Step 1: Included EKG signal; not checking for stationarity
- % (Autocovariance empty)
- % Step 2: Detrended; diff of 2
- %%
- restoredefaultpath
- addpath(genpath('/Volumes/Kirti/Final_First_Draft_2023/Codes/github_repo'));
- prefix1 = 'D:\NatureAging\ROITimeseries\CC';
- suffix1 = '.mat';
- prefix2 = 'D:\NatureAging\EKG_Epochs\CC';
- suffix2 = '.mat';
- subjects = [110037;110182;120137;120376;120409;120462;121111;120061;120550;110606;120212;121685;120347;110056;110126;110098;110101;120276;120727;122016;110033;120208;120795;122620;110174;110187;110411;120065;120120;120184;120469;121317;121795;120008;120182;120640;121144;121200;121428;121479;120218;120309;120319;120764;121397;122172;122405;110069;110087;110319;120049;120166;120264;120313;120470;121106;121158;220526;221033;112141;210250;210519;212153;220115;220352;220519;221209;221373;222555;210148;210174;220151;220518;221648;222652;210023;210172;210182;220132;220419;221054;222797;220098;220511;220535;220610;221244;221565;221755;221775;221828;221954;222185;222956;220223;220323;220713;220828;221595;221886;210314;210422;210617;220107;220203;220284;220335;220920;221336;221527;221737;221980;222125;210051;210124;220234;220506;220697;220901;221107;221487;221740;222258;222326;210088;220232;220635;221040;221324;221511;221733;223115;223286;210526;210657;220198;220372;220567;220843;220974;220999;221002;221220;221352;221585;221935;221977;222120;222264;222367;221031;222304;222496;223085;320267;310203;320109;320417;320575;320616;321174;321506;321529;310129;310414;320022;320297;320321;320342;320478;320574;320686;321000;321025;321053;321087;321203;310391;310397;310410;320088;320361;320680;320687;321069;321137;310051;310052;310135;320448;320461;320651;320904;321428;321504;321976;310361;310400;320661;320814;321073;321594;310256;320325;320336;320568;320759;321107;321291;321544;321557;321585;321595;310008;310463;312149;320202;320428;320576;320608;320636;320698;321368;321464;310214;310331;310450;310473;320002;320500;320621;321281;321331;321880;310086;310224;310252;312058;320089;320107;320206;320218;320359;320445;320776;320850;320861;320870;320888;320893;322186;310142;310385;312222;320059;320160;320379;320429;320553;321154;321431;410354;420089;420383;321899;410097;410169;410286;420004;420173;420244;420322;420402;420587;420776;410284;420217;420226;420260;420566;420720;420888;410015;410323;420060;420167;420202;420392;420433;420493;420623;410220;410432;420071;420075;420091;420149;420162;420182;420229;420324;420412;420589;410182;410251;420143;420204;420236;420396;420435;410248;410325;412004;412021;420231;420261;420356;420364;420454;420582;410032;410040;410113;410173;410179;410222;420197;420222;420241;420462;420464;410101;410243;410390;420094;420100;420137;420148;420286;410084;410086;410091;410119;410177;410387;420348;410129;410287;410289;410297;420157;420198;510043;510161;520042;520253;510050;510609;510629;520168;520197;520287;520398;520584;510039;510242;510243;510258;510259;510284;510483;520011;520065;520480;520624;510433;510551;510648;520055;520147;520175;520395;520775;510076;510115;510255;510354;510438;510548;510639;512003;520097;510256;510342;510486;520078;520211;520215;520247;520377;520424;520436;520745;521040;510163;510321;510323;510329;510415;520002;520053;520391;520552;520597;520607;510086;510355;510434;510473;520083;520136;520239;520390;520517;520560;510208;510220;510237;510304;510474;510534;520127;520209;520254;520477;520503;520562;510226;510392;520013;520122;520134;520200;520673;520868;510393;510395;520279;520585;520980;610022;610028;610051;610101;620121;620259;620359;620406;610071;610099;610308;610594;620073;620262;620429;620479;620527;620785;621184;610039;610372;610496;610625;610671;620026;620085;620496;620821;621080;610285;610344;610575;610653;620090;620106;620118;620619;620659;620793;620935;610040;610046;610178;610292;610405;610576;620164;621199;621248;610058;610469;620114;620526;620549;621642;620005;620314;620567;620592;610210;610392;620129;620284;620451;620454;620466;620515;621128;610146;610227;610462;610568;620193;620264;620405;620413;620610;621011;621118;610052;610076;610212;610508;610631;620279;620444;620685;620354;620518;620572;620720;620885;620919;710037;710176;720188;721888;621284;710214;710223;710486;710858;710982;720119;720511;720670;720941;721052;721107;721114;721292;721418;721585;722421;722536;722651;710429;710494;711027;711128;711158;720238;720304;720329;720330;720497;721291;721377;721392;721449;721648;721707;721894;723197;710313;710350;720622;721729;710462;710664;720023;720407;721504;721704;710342;710382;710548;710566;720358;720986;721891;710679;720290;720516;720723;721434;722891;710131;710446;710551;710591;711244;711245;720400;721374;723395;712027;720774;721224;721532];
- for ii = 1:length(subjects)
- try
- %% Loading subject file - ROI time series
- load(strcat(prefix1, num2str(subjects(ii,1)), suffix1))
- % Build ROI x Time matrix
- roi_labels = {
- 'Frontal_Sup_Orb_R', 'Frontal_Mid_Orb_R', 'Frontal_Inf_Tri_L', ...
- 'Frontal_Med_Orb_R', 'Temporal_Pole_Mid_R', 'Temporal_Pole_Sup_L', ...
- 'Temporal_Pole_Sup_R', 'Frontal_Sup_R', 'Frontal_Sup_Medial_R', ...
- 'Frontal_Med_Orb_L', 'Cingulum_Ant_R', 'Frontal_Mid_Orb_L', ...
- 'Frontal_Sup_Orb_L', 'Frontal_Inf_Orb_L', 'Frontal_Inf_Orb_R', ...
- 'Insula_R'};
- n_rois = length(roi_labels);
- for r = 1:n_rois
- roi_ts_matrix(r, :) = ROI_ts.(roi_labels{r});
- end
- % %% Loading subject file - EKG signal
- load(strcat(prefix2, num2str(subjects(ii,1)), suffix2));
- ekg_mat = mean(cat(3, epochs{:}),3);
- %
- roi_ts = [roi_ts_matrix;ekg_mat]; % matrix includes ROI time series and ECG signal
- %
- addpath(genpath('D:\Final_First_Draft_2023\Codes\github_repo'));
- % Method to find out the model order
- ptic('\n*** tsdata_to_infocrit\n');
- [~, ~, ~, mobic] = tsdata_to_infocrit(roi_ts, 10, 'OLS');
- ptoc('*** tsdata_to_infocrit took ');
- % Making sure the time series for GC is stationary
- % Detrending and taking difference
- dt_ROI = [];
- dt_diff_ROI = [];
- for roi = 1:17
- dt_ROI(roi,:) = detrend(roi_ts(roi,:));
- dt_diff_ROI(roi,:) = diff(dt_ROI(roi,:),2);
- end
- % Calculating the AR variables
- morder = mobic;
- regmode = 'OLS';
- ptic('\n*** tsdata_to_var... ');
- [A,SIG] = tsdata_to_var(dt_diff_ROI,morder,regmode); % use same model order for reduced as for full regressions
- ptoc;
- % Autocovariance calculation
- acmaxlags = mobic;
- ptic('*** var_to_autocov...');
- [G,info] = var_to_autocov(A, SIG, acmaxlags);
- ptoc;
- % Calculating the GC using autocov_to_mvgc function
- for kk = 1:length(roi_ts(:,1))
- for jj = 1:length(roi_ts(:,1))
- try
- F1(jj,kk) = autocov_to_mvgc(G,jj,kk);
- catch
- end
- end
- end
- cd('D:\NatureAging\GC\mvgc_originalSig')
- savefile = strcat('CC',num2str(subjects(ii,1)),'.mat');
- save(savefile,'F1')
- catch
- end
- end
- %% plotting global average age wise
- prefix3 = '/media/shrey/Kirti1/NatureAging/GC/mvgc_originalSig/CC';
- suffix3 = '.mat';
- young = [110182;120137;120376;120409;120462;121111;120061;120550;110606;120212;121685;120347;110056;110126;110098;110101;120276;120727;122016;110033;120208;120795;122620;110174;110187;110411;120065;120120;120184;120469;121317;121795;120008;120182;120640;121144;121200;121428;121479;120218;120309;120319;120764;121397;122172;122405;110069;110087;110319;120049;120166;120264;120313;120470;121106;121158;220526;221033;112141;210250;210519;212153;220115;220352;220519;221209;221373;222555;210148;210174;220151;220518;221648;222652;210023;210172;210182;220132;220419;221054;222797;220098;220511;220535;220610;221244;221565;221755;221775;221828;221954;222185;222956;220223;220323;220713;220828;221595;221886;210314;210422;210617;220107;220203;220284;220335;220920;221336;221527;221737;221980;222125;210051;210124;220234;220506;220697;220901;221107;221487;221740;222258;222326;210088;220232;220635;221040;221324;221511;221733;223115;223286;210526;210657;220198;220372;220567;220843;220974;220999;221002;221220;221352;221585;221935;221977;222120;222264;222367;221031;222304;222496;223085;320267;310203;320109;320417;320575;320616;321174;321506;321529;310129;310414;320022;320297;320321;320342;320478;320574;320686;321000;321025;321053;321087;321203];
- for ii = 1:length(young)
- try
- load(strcat(prefix3, num2str(young(ii,1)), suffix3));
- F_young1{ii} = F1;
- catch
- end
- ii
- end
- mat_F_young1 = cat(3,F_young1{:,1});
- middle = [310391;310397;310410;320088;320361;320680;320687;321069;321137;310051;310052;310135;320448;320461;320651;320904;321428;321504;321976;310361;310400;320661;320814;321073;321594;310256;320325;320336;320568;320759;321107;321291;321544;321557;321585;321595;310008;310463;312149;320202;320428;320576;320608;320636;320698;321368;321464;310214;310331;310450;310473;320002;320500;320621;321281;321331;321880;310086;310224;310252;312058;320089;320107;320206;320218;320359;320445;320776;320850;320861;320870;320888;320893;322186;310142;310385;312222;320059;320160;320379;320429;320553;321154;321431;410354;420089;420383;321899;410097;410169;410286;420004;420173;420244;420322;420402;420587;420776;410284;420217;420226;420260;420566;420720;420888;410015;410323;420060;420167;420202;420392;420433;420493;420623;410220;410432;420071;420075;420091;420149;420162;420182;420229;420324;420412;420589;410182;410251;420143;420204;420236;420396;420435;410248;410325;412004;412021;420231;420261;420356;420364;420454;420582;410032;410040;410113;410173;410179;410222;420197;420222;420241;420462;420464;410101;410243;410390;420094;420100;420137;420148;420286;410084;410086;410091;410119;410177;410387;420348;410129;410287;410289;410297;420157;420198;510043;510161;520042;520253;510050;510609;510629;520168;520197;520287;520398;520584;510039;510242;510243;510258;510259;510284;510483;520011;520065;520480;520624];
- for ii = 1:length(middle)
- try
- load(strcat(prefix3, num2str(middle(ii,1)), suffix3));
- F_middle1{ii} = F1;
- catch
- end
- ii
- end
- mat_F_middle1 = cat(3,F_middle1{:,1});
- old = [510433;510551;510648;520055;520147;520175;520395;520775;510076;510115;510255;510354;510438;510548;510639;512003;520097;510256;510342;510486;520078;520211;520215;520247;520377;520424;520436;520745;521040;510163;510321;510323;510329;510415;520002;520053;520391;520552;520597;520607;510086;510355;510434;510473;520083;520136;520239;520390;520517;520560;510208;510220;510237;510304;510474;510534;520127;520209;520254;520477;520503;520562;510226;510392;520013;520122;520134;520200;520673;520868;510393;510395;520279;520585;520980;610022;610028;610051;610101;620121;620259;620359;620406;610071;610099;610308;610594;620073;620262;620429;620479;620527;620785;621184;610039;610372;610496;610625;610671;620026;620085;620496;620821;621080;610285;610344;610575;610653;620090;620106;620118;620619;620659;620793;620935;610040;610046;610178;610292;610405;610576;620164;621199;621248;610058;610469;620114;620526;620549;621642;620005;620314;620567;620592;610210;610392;620129;620284;620451;620454;620466;620515;621128;610146;610227;610462;610568;620193;620264;620405;620413;620610;621011;621118;610052;610076;610212;610508;610631;620279;620444;620685;620354;620518;620572;620720;620885;620919;710037;710176;720188;721888;621284;710214;710223;710486;710858;710982;720119;720511;720670;720941;721052;721107;721114;721292;721418;721585;722421;722536;722651;710429;710494;711027;711128;711158;720238;720304;720329;720330;720497;721291;721377;721392;721449;721648;721707;721894;723197;710313;710350;720622;721729;710462;710664;720023;720407;721504;721704;710342;710382;710548;710566;720358;720986;721891;710679;720290;720516;720723;721434;722891;710131;710446;710551;710591;711244;711245;720400;721374;723395;712027;720774;721224;721532];
- old_updated = [510433;510551;510648;520055;520147;520175;520395;520775;510076;510115;510255;510354;510438;510548;510639;512003;520097;510256;510342;510486;520078;520211;520215;520247;520377;520424;520436;520745;521040;510163;510321;510323;510329;510415;520002;520053;520391;520552;520597;520607;510086;510355;510434;510473;520083;520136;520239;520390;520517;520560;510208;510220;510237;510304;510474;510534;520127;520209;520254;520477;520503;520562;510226;510392;520013;520122;520134;520200;520673;520868;510393;510395;520279;520585;520980;610022;610028;610051;610101;620121;620259;620359;620406;610071;610099;610308;610594;620073;620262;620429;620479;620527;620785;621184;610039;610372;610496;610625;610671;620026;620085;620496;620821;621080;610285;610344;610575;610653;620090;620106;620118;620619;620659;620793;620935;610040;610046;610178;610292;610405;610576;620164;621199;621248;610058;610469;620114;620526;620549;621642;620005;620314;620567;620592;610210;610392;620129;620284;620451;620454;620466;620515;621128;610146;610227;610462;610568;620193;620264;620405;620413;620610;621011;621118;610052;610076;610212;610508;610631;620279;620444;620685;620354;620518;620572;620720;620885;620919;710037;710176;720188;721888;621284;710214;710223;710486;710858;710982;720119;720511;720670;720941;721052;721107;721114;721292;721418;721585;722421;722536;722651;710429;710494;711027;711128;711158;720238;720304;720329;720330;720497;721291;721377;721392;721449;721648;721707;721894;723197;710313;710350;720622;721729;710462;710664;720023;720407;721504;721704;710342;710382;710548;720986;721891;710679;720290;720516;720723;721434;722891;710131;710446;710551;710591;711244;711245;720400;721374;723395;712027;720774;721224;721532];
- for ii = 1:length(old_updated)
- try
- load(strcat(prefix3, num2str(old_updated(ii,1)), suffix3));
- F_old1{ii} = F1;
- catch
- ii
- end
- end
- mat_F_old1 = cat(3,F_old1{:,1});
- GC_y = mean(mat_F_young1,3);
- GC_m = mean(mat_F_middle1,3);
- GC_o = mean(mat_F_old1,3);
- % Lower linit
- lo = min([min(min(GC_y)), min(min(GC_m)), min(min(GC_o))]);
- up = max([max(max(GC_y)), max(max(GC_m)), max(max(GC_o))]);
- % Figures
- figure;
- subplot(2,3,1); imagesc(GC_y); caxis([lo up]); title('Young'); colormap('jet');
- subplot(2,3,2); imagesc(GC_m); caxis([lo up]); title('Middle'); colormap('jet');
- subplot(2,3,3); imagesc(GC_o); caxis([lo up]); title('Old'); colormap('jet');
- set(gca,'Layer','top','XTick',[1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17],'XTickLabel',...
- {'ORBsup.R','ORBmid.R','IFGtriang.L','ORBmid.R','TPOmid.R','TPOsup.L','TPOsup.R','SFGdor.R','SFGmed.R','ORBmid.L','ACG.R','ORBmid.L','ORBsup.R','ORBinf.L','ORBinf.R','INS.R'},...
- 'XTickLabelRotation',45,'YTick',[1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17],'YTickLabel',...
- {'ORBsup.R','ORBmid.R','IFGtriang.L','ORBmid.R','TPOmid.R','TPOsup.L','TPOsup.R','SFGdor.R','SFGmed.R','ORBmid.L','ACG.R','ORBmid.L','ORBsup.R','ORBinf.L','ORBinf.R','INS.R'},...
- 'YTickLabelRotation',45);
- %% Loading each subject from Old age group to find which subject contributes to the imaginary
- % Date: 08/03/2025
- % Subject list
- old = [510433;510551;510648;520055;520147;520175;520395;520775;510076;510115;510255;510354;510438;510548;510639;512003;520097;510256;510342;510486;520078;520211;520215;520247;520377;520424;520436;520745;521040;510163;510321;510323;510329;510415;520002;520053;520391;520552;520597;520607;510086;510355;510434;510473;520083;520136;520239;520390;520517;520560;510208;510220;510237;510304;510474;510534;520127;520209;520254;520477;520503;520562;510226;510392;520013;520122;520134;520200;520673;520868;510393;510395;520279;520585;520980;610022;610028;610051;610101;620121;620259;620359;620406;610071;610099;610308;610594;620073;620262;620429;620479;620527;620785;621184;610039;610372;610496;610625;610671;620026;620085;620496;620821;621080;610285;610344;610575;610653;620090;620106;620118;620619;620659;620793;620935;610040;610046;610178;610292;610405;610576;620164;621199;621248;610058;610469;620114;620526;620549;621642;620005;620314;620567;620592;610210;610392;620129;620284;620451;620454;620466;620515;621128;610146;610227;610462;610568;620193;620264;620405;620413;620610;621011;621118;610052;610076;610212;610508;610631;620279;620444;620685;620354;620518;620572;620720;620885;620919;710037;710176;720188;721888;621284;710214;710223;710486;710858;710982;720119;720511;720670;720941;721052;721107;721114;721292;721418;721585;722421;722536;722651;710429;710494;711027;711128;711158;720238;720304;720329;720330;720497;721291;721377;721392;721449;721648;721707;721894;723197;710313;710350;720622;721729;710462;710664;720023;720407;721504;721704;710342;710382;710548;710566;720358;720986;721891;710679;720290;720516;720723;721434;722891;710131;710446;710551;710591;711244;711245;720400;721374;723395;712027;720774;721224;721532];
- old_updated = [510433;510551;510648;520055;520147;520175;520395;520775;510076;510115;510255;510354;510438;510548;510639;512003;520097;510256;510342;510486;520078;520211;520215;520247;520377;520424;520436;520745;521040;510163;510321;510323;510329;510415;520002;520053;520391;520552;520597;520607;510086;510355;510434;510473;520083;520136;520239;520390;520517;520560;510208;510220;510237;510304;510474;510534;520127;520209;520254;520477;520503;520562;510226;510392;520013;520122;520134;520200;520673;520868;510393;510395;520279;520585;520980;610022;610028;610051;610101;620121;620259;620359;620406;610071;610099;610308;610594;620073;620262;620429;620479;620527;620785;621184;610039;610372;610496;610625;610671;620026;620085;620496;620821;621080;610285;610344;610575;610653;620090;620106;620118;620619;620659;620793;620935;610040;610046;610178;610292;610405;610576;620164;621199;621248;610058;610469;620114;620526;620549;621642;620005;620314;620567;620592;610210;610392;620129;620284;620451;620454;620466;620515;621128;610146;610227;610462;610568;620193;620264;620405;620413;620610;621011;621118;610052;610076;610212;610508;610631;620279;620444;620685;620354;620518;620572;620720;620885;620919;710037;710176;720188;721888;621284;710214;710223;710486;710858;710982;720119;720511;720670;720941;721052;721107;721114;721292;721418;721585;722421;722536;722651;710429;710494;711027;711128;711158;720238;720304;720329;720330;720497;721291;721377;721392;721449;721648;721707;721894;723197;710313;710350;720622;721729;710462;710664;720023;720407;721504;721704;710342;710382;710548;720986;721891;710679;720290;720516;720723;721434;722891;710131;710446;710551;710591;711244;711245;720400;721374;723395;712027;720774;721224;721532];
- prefix = '/media/shrey/Kirti1/NatureAging/GC/mvgc_originalSig/CC';
- suffix = '.mat';
- imaginary_subjects = []; % Store subjects with imaginary values
- nan_subjects = []; % Optional: track subjects with NaNs
- inf_subjects = []; % Optional: track subjects with Infs
- for sub = 1:length(old)
- sub_id = old(sub);
- file_path = strcat(prefix, [num2str(sub_id), suffix]);
- try
- load(file_path, 'F1');
- if any(imag(F1(:)) ~= 0)
- imaginary_subjects(end+1) = sub_id;
- elseif any(isnan(F1(:)))
- nan_subjects(end+1) = sub_id;
- elseif any(isinf(F1(:)))
- inf_subjects(end+1) = sub_id;
- end
- catch ME
- fprintf('Could not load subject %d: %s\n', sub_id, ME.message);
- end
- end
- %% Applying statistics on the GC calculated
- restoredefaultpath
- prefix1 = '/media/shrey/Kirti1/NatureAging/ROITimeseries/CC';
- suffix1 = '.mat';
- prefix2 = '/media/shrey/Kirti1/NatureAging/EKG_Epochs/CC';
- suffix2 = '.mat';
- subjects = [110182;120137;120376;120409;120462;121111;120061;120550;110606;120212;121685;120347;110056;110126;110098;110101;120276;120727;122016;110033;120208;120795;122620;110174;110187;110411;120065;120120;120184;120469;121317;121795;120008;120182;120640;121144;121200;121428;121479;120218;120309;120319;120764;121397;122172;122405;110069;110087;110319;120049;120166;120264;120313;120470;121106;121158;220526;221033;112141;210250;210519;212153;220115;220352;220519;221209;221373;222555;210148;210174;220151;220518;221648;222652;210023;210172;210182;220132;220419;221054;222797;220098;220511;220535;220610;221244;221565;221755;221775;221828;221954;222185;222956;220223;220323;220713;220828;221595;221886;210314;210422;210617;220107;220203;220284;220335;220920;221336;221527;221737;221980;222125;210051;210124;220234;220506;220697;220901;221107;221487;221740;222258;222326;210088;220232;220635;221040;221324;221511;221733;223115;223286;210526;210657;220198;220372;220567;220843;220974;220999;221002;221220;221352;221585;221935;221977;222120;222264;222367;221031;222304;222496;223085;320267;310203;320109;320417;320575;320616;321174;321506;321529;310129;310414;320022;320297;320321;320342;320478;320574;320686;321000;321025;321053;321087;321203;310391;310397;310410;320088;320361;320680;320687;321069;321137;310051;310052;310135;320448;320461;320651;320904;321428;321504;321976;310361;310400;320661;320814;321073;321594;310256;320325;320336;320568;320759;321107;321291;321544;321557;321585;321595;310008;310463;312149;320202;320428;320576;320608;320636;320698;321368;321464;310214;310331;310450;310473;320002;320500;320621;321281;321331;321880;310086;310224;310252;312058;320089;320107;320206;320218;320359;320445;320776;320850;320861;320870;320888;320893;322186;310142;310385;312222;320059;320160;320379;320429;320553;321154;321431;410354;420089;420383;321899;410097;410169;410286;420004;420173;420244;420322;420402;420587;420776;410284;420217;420226;420260;420566;420720;420888;410015;410323;420060;420167;420202;420392;420433;420493;420623;410220;410432;420071;420075;420091;420149;420162;420182;420229;420324;420412;420589;410182;410251;420143;420204;420236;420396;420435;410248;410325;412004;412021;420231;420261;420356;420364;420454;420582;410032;410040;410113;410173;410179;410222;420197;420222;420241;420462;420464;410101;410243;410390;420094;420100;420137;420148;420286;410084;410086;410091;410119;410177;410387;420348;410129;410287;410289;410297;420157;420198;510043;510161;520042;520253;510050;510609;510629;520168;520197;520287;520398;520584;510039;510242;510243;510258;510259;510284;510483;520011;520065;520480;520624;510433;510551;510648;520055;520147;520175;520395;520775;510076;510115;510255;510354;510438;510548;510639;512003;520097;510256;510342;510486;520078;520211;520215;520247;520377;520424;520436;520745;521040;510163;510321;510323;510329;510415;520002;520053;520391;520552;520597;520607;510086;510355;510434;510473;520083;520136;520239;520390;520517;520560;510208;510220;510237;510304;510474;510534;520127;520209;520254;520477;520503;520562;510226;510392;520013;520122;520134;520200;520673;520868;510393;510395;520279;520585;520980;610022;610028;610051;610101;620121;620259;620359;620406;610071;610099;610308;610594;620073;620262;620429;620479;620527;620785;621184;610039;610372;610496;610625;610671;620026;620085;620496;620821;621080;610285;610344;610575;610653;620090;620106;620118;620619;620659;620793;620935;610040;610046;610178;610292;610405;610576;620164;621199;621248;610058;610469;620114;620526;620549;621642;620005;620314;620567;620592;610210;610392;620129;620284;620451;620454;620466;620515;621128;610146;610227;610462;610568;620193;620264;620405;620413;620610;621011;621118;610052;610076;610212;610508;610631;620279;620444;620685;620354;620518;620572;620720;620885;620919;710037;710176;720188;721888;621284;710214;710223;710486;710858;710982;720119;720511;720670;720941;721052;721107;721114;721292;721418;721585;722421;722536;722651;710429;710494;711027;711128;711158;720238;720304;720329;720330;720497;721291;721377;721392;721449;721648;721707;721894;723197;710313;710350;720622;721729;710462;710664;720023;720407;721504;721704;710342;710382;710548;710566;720358;720986;721891;710679;720290;720516;720723;721434;722891;710131;710446;710551;710591;711244;711245;720400;721374;723395;712027;720774;721224;721532];
- for ii = 1:length(subjects)
- %% Loading subject file - ROI time series
- % cd('/media/shrey/Kirti1/NatureAging/ROITimeseries/')
- % dir(strcat('CC',num2str(subjects(ii,1)),'.mat'))
- load(strcat(prefix1, num2str(subjects(ii,1)), suffix1))
- % Build ROI x Time matrix
- roi_labels = {
- 'Frontal_Sup_Orb_R', 'Frontal_Mid_Orb_R', 'Frontal_Inf_Tri_L', ...
- 'Frontal_Med_Orb_R', 'Temporal_Pole_Mid_R', 'Temporal_Pole_Sup_L', ...
- 'Temporal_Pole_Sup_R', 'Frontal_Sup_R', 'Frontal_Sup_Medial_R', ...
- 'Frontal_Med_Orb_L', 'Cingulum_Ant_R', 'Frontal_Mid_Orb_L', ...
- 'Frontal_Sup_Orb_L', 'Frontal_Inf_Orb_L', 'Frontal_Inf_Orb_R', ...
- 'Insula_R'};
- n_rois = length(roi_labels);
- for r = 1:n_rois
- roi_ts_matrix(r, :) = ROI_ts.(roi_labels{r});
- end
- % %% Loading subject file - EKG signal
- load(strcat(prefix2, num2str(subjects(ii,1)), suffix2));
- ekg_mat = mean(cat(3, epochs{:}),3);
- roi_ts = [roi_ts_matrix;ekg_mat]; % matrix includes ROI time series and ECG signal
- %
- % roi_ts = roi_ts_matrix(:,230:799);
- %% Matrix for surrogate analysis
- % Phase-randomize each ROI
- [n_rois, N] = size(roi_ts);
- signal_rand = zeros(n_rois, N);
- for roi = 1:n_rois
- X = fft(roi_ts(roi, :));
- mag = abs(X);
- phs = angle(X);
- rand_phs = 2 * pi * rand(1, floor(N/2) - 1);
- new_phs = phs;
- new_phs(2:floor(N/2)) = rand_phs;
- new_phs(N:-1:(N - floor(N/2) + 2)) = -rand_phs;
- X_rand = mag .* exp(1i * new_phs);
- signal_rand(roi, :) = real(ifft(X_rand));
- end
- addpath(genpath('/media/shrey/Kirti1/Final_First_Draft_2023/Codes/github_repo'));
- % Method to find out the model order
- ptic('\n*** tsdata_to_infocrit\n');
- [~, ~, ~, mobic] = tsdata_to_infocrit(signal_rand, 10, 'OLS');
- ptoc('*** tsdata_to_infocrit took ');
- % for jj = 1:16
- % [h(jj),pVal(jj)] = kpsstest(signal_rand(jj,:));
- % end
- %% Making sure the time series for GC is stationary
- % Detrending and taking difference
- dt_ROI = [];
- dt_diff_ROI = [];
- alpha = 0.05;
- q = mobic; %no. of lags
- for roi = 1:n_rois
- dt_ROI(roi,:) = detrend(signal_rand(roi,:));
- dt_diff_ROI(roi,:) = diff(dt_ROI(roi,:),2);
- % [h1(roi),pVal1(roi)] = kpsstest(dt_diff_ROI(roi,:));
- end
- % Return VAR parameters
- try
- X = dt_diff_ROI;
- morder = mobic;
- regmode = 'OLS';
- % if all(h1 == 0)
- ptic('\n*** tsdata_to_var... ');
- [A,SIG] = tsdata_to_var(X,morder,regmode); % use same model order for reduced as for full regressions
- ptoc;
- % else
- % failed_roi = find(h1 == 1);
- % failed_subject_ids{ii} = subjects(ii,1); % Make sure current_subject_id is defined
- % end
- % Autocovariance calculation
- acmaxlags = mobic;
- ptic('*** var_to_autocov...');
- [G,info] = var_to_autocov(A, SIG, acmaxlags);
- ptoc;
- % Granger causality calclation: time domain
- ptic('*** autocov_to_pwcgc... ');
- F_null = autocov_to_pwcgc(G);
- ptoc;
- cd('/media/shrey/Kirti1/NatureAging/GC/mvgc_originalSig/Surrogate')
- savefile = strcat('CC',num2str(subjects(ii,1)),'.mat');
- save(savefile,'F_null')
- catch
- end
- ii
- end
- %% Applying stats (Permutation testing)
- n_rois = 17;
- subjects = [110037;110182;120137;120376;120409;120462;121111;120061;120550;110606;120212;121685;120347;110056;110126;110098;110101;120276;120727;122016;110033;120208;120795;122620;110174;110187;110411;120065;120120;120184;120469;121317;121795;120008;120182;120640;121144;121200;121428;121479;120218;120309;120319;120764;121397;122172;122405;110069;110087;110319;120049;120166;120264;120313;120470;121106;121158;220526;221033;112141;210250;210519;212153;220115;220352;220519;221209;221373;222555;210148;210174;220151;220518;221648;222652;210023;210172;210182;220132;220419;221054;222797;220098;220511;220535;220610;221244;221565;221755;221775;221828;221954;222185;222956;220223;220323;220713;220828;221595;221886;210314;210422;210617;220107;220203;220284;220335;220920;221336;221527;221737;221980;222125;210051;210124;220234;220506;220697;220901;221107;221487;221740;222258;222326;210088;220232;220635;221040;221324;221511;221733;223115;223286;210526;210657;220198;220372;220567;220843;220974;220999;221002;221220;221352;221585;221935;221977;222120;222264;222367;221031;222304;222496;223085;320267;310203;320109;320417;320575;320616;321174;321506;321529;310129;310414;320022;320297;320321;320342;320478;320574;320686;321000;321025;321053;321087;321203;310391;310397;310410;320088;320361;320680;320687;321069;321137;310051;310052;310135;320448;320461;320651;320904;321428;321504;321976;310361;310400;320661;320814;321073;321594;310256;320325;320336;320568;320759;321107;321291;321544;321557;321585;321595;310008;310463;312149;320202;320428;320576;320608;320636;320698;321368;321464;310214;310331;310450;310473;320002;320500;320621;321281;321331;321880;310086;310224;310252;312058;320089;320107;320206;320218;320359;320445;320776;320850;320861;320870;320888;320893;322186;310142;310385;312222;320059;320160;320379;320429;320553;321154;321431;410354;420089;420383;321899;410097;410169;410286;420004;420173;420244;420322;420402;420587;420776;410284;420217;420226;420260;420566;420720;420888;410015;410323;420060;420167;420202;420392;420433;420493;420623;410220;410432;420071;420075;420091;420149;420162;420182;420229;420324;420412;420589;410182;410251;420143;420204;420236;420396;420435;410248;410325;412004;412021;420231;420261;420356;420364;420454;420582;410032;410040;410113;410173;410179;410222;420197;420222;420241;420462;420464;410101;410243;410390;420094;420100;420137;420148;420286;410084;410086;410091;410119;410177;410387;420348;410129;410287;410289;410297;420157;420198;510043;510161;520042;520253;510050;510609;510629;520168;520197;520287;520398;520584;510039;510242;510243;510258;510259;510284;510483;520011;520065;520480;520624;510433;510551;510648;520055;520147;520175;520395;520775;510076;510115;510255;510354;510438;510548;510639;512003;520097;510256;510342;510486;520078;520211;520215;520247;520377;520424;520436;520745;521040;510163;510321;510323;510329;510415;520002;520053;520391;520552;520597;520607;510086;510355;510434;510473;520083;520136;520239;520390;520517;520560;510208;510220;510237;510304;510474;510534;520127;520209;520254;520477;520503;520562;510226;510392;520013;520122;520134;520200;520673;520868;510393;510395;520279;520585;520980;610022;610028;610051;610101;620121;620259;620359;620406;610071;610099;610308;610594;620073;620262;620429;620479;620527;620785;621184;610039;610372;610496;610625;610671;620026;620085;620496;620821;621080;610285;610344;610575;610653;620090;620106;620118;620619;620659;620793;620935;610040;610046;610178;610292;610405;610576;620164;621199;621248;610058;610469;620114;620526;620549;621642;620005;620314;620567;620592;610210;610392;620129;620284;620451;620454;620466;620515;621128;610146;610227;610462;610568;620193;620264;620405;620413;620610;621011;621118;610052;610076;610212;610508;610631;620279;620444;620685;620354;620518;620572;620720;620885;620919;710037;710176;720188;721888;621284;710214;710223;710486;710858;710982;720119;720511;720670;720941;721052;721107;721114;721292;721418;721585;722421;722536;722651;710429;710494;711027;711128;711158;720238;720304;720329;720330;720497;721291;721377;721392;721449;721648;721707;721894;723197;710313;710350;720622;721729;710462;710664;720023;720407;721504;721704;710342;710382;710548;710566;720358;720986;721891;710679;720290;720516;720723;721434;722891;710131;710446;710551;710591;711244;711245;720400;721374;723395;712027;720774;721224;721532];
- n_sub = length(subjects_updated);
- % Preallocate
- F_real_all = nan(n_rois, n_rois, n_sub);
- F_null_all = nan(n_rois, n_rois, n_sub);
- prefix1= '/media/shrey/Kirti1/NatureAging/GC/mvgc_originalSig/CC';
- suffix1 = '.mat';
- prefix2 = '/media/shrey/Kirti1/NatureAging/GC/mvgc_originalSig/Surrogate/CC';
- suffix2 = '.mat';
- for ii = 1:length(subjects_updated)
- try
- %Load real GC
- load(strcat(prefix1, num2str(subjects_updated(ii,1)), suffix1));
- F_real_all(:, :,ii) = F1;
- %Load null GC
- load(strcat(prefix2, num2str(subjects_updated(ii,1)), suffix2));
- F_null_all(:,:,ii) = F_null;
- catch
- end
- ii
- end
- % Checking if the F_null includes any imaginary value
- % Subject list
- subjects = [110182;120137;120376;120409;120462;121111;120061;120550;110606;120212;121685;120347;110056;110126;110098;110101;120276;120727;122016;110033;120208;120795;122620;110174;110187;110411;120065;120120;120184;120469;121317;121795;120008;120182;120640;121144;121200;121428;121479;120218;120309;120319;120764;121397;122172;122405;110069;110087;110319;120049;120166;120264;120313;120470;121106;121158;220526;221033;112141;210250;210519;212153;220115;220352;220519;221209;221373;222555;210148;210174;220151;220518;221648;222652;210023;210172;210182;220132;220419;221054;222797;220098;220511;220535;220610;221244;221565;221755;221775;221828;221954;222185;222956;220223;220323;220713;220828;221595;221886;210314;210422;210617;220107;220203;220284;220335;220920;221336;221527;221737;221980;222125;210051;210124;220234;220506;220697;220901;221107;221487;221740;222258;222326;210088;220232;220635;221040;221324;221511;221733;223115;223286;210526;210657;220198;220372;220567;220843;220974;220999;221002;221220;221352;221585;221935;221977;222120;222264;222367;221031;222304;222496;223085;320267;310203;320109;320417;320575;320616;321174;321506;321529;310129;310414;320022;320297;320321;320342;320478;320574;320686;321000;321025;321053;321087;321203;310391;310397;310410;320088;320361;320680;320687;321069;321137;310051;310052;310135;320448;320461;320651;320904;321428;321504;321976;310361;310400;320661;320814;321073;321594;310256;320325;320336;320568;320759;321107;321291;321544;321557;321585;321595;310008;310463;312149;320202;320428;320576;320608;320636;320698;321368;321464;310214;310331;310450;310473;320002;320500;320621;321281;321331;321880;310086;310224;310252;312058;320089;320107;320206;320218;320359;320445;320776;320850;320861;320870;320888;320893;322186;310142;310385;312222;320059;320160;320379;320429;320553;321154;321431;410354;420089;420383;321899;410097;410169;410286;420004;420173;420244;420322;420402;420587;420776;410284;420217;420226;420260;420566;420720;420888;410015;410323;420060;420167;420202;420392;420433;420493;420623;410220;410432;420071;420075;420091;420149;420162;420182;420229;420324;420412;420589;410182;410251;420143;420204;420236;420396;420435;410248;410325;412004;412021;420231;420261;420356;420364;420454;420582;410032;410040;410113;410173;410179;410222;420197;420222;420241;420462;420464;410101;410243;410390;420094;420100;420137;420148;420286;410084;410086;410091;410119;410177;410387;420348;410129;410287;410289;410297;420157;420198;510043;510161;520042;520253;510050;510609;510629;520168;520197;520287;520398;520584;510039;510242;510243;510258;510259;510284;510483;520011;520065;520480;520624;510433;510551;510648;520055;520147;520175;520395;520775;510076;510115;510255;510354;510438;510548;510639;512003;520097;510256;510342;510486;520078;520211;520215;520247;520377;520424;520436;520745;521040;510163;510321;510323;510329;510415;520002;520053;520391;520552;520597;520607;510086;510355;510434;510473;520083;520136;520239;520390;520517;520560;510208;510220;510237;510304;510474;510534;520127;520209;520254;520477;520503;520562;510226;510392;520013;520122;520134;520200;520673;520868;510393;510395;520279;520585;520980;610022;610028;610051;610101;620121;620259;620359;620406;610071;610099;610308;610594;620073;620262;620429;620479;620527;620785;621184;610039;610372;610496;610625;610671;620026;620085;620496;620821;621080;610285;610344;610575;610653;620090;620106;620118;620619;620659;620793;620935;610040;610046;610178;610292;610405;610576;620164;621199;621248;610058;610469;620114;620526;620549;621642;620005;620314;620567;620592;610210;610392;620129;620284;620451;620454;620466;620515;621128;610146;610227;610462;610568;620193;620264;620405;620413;620610;621011;621118;610052;610076;610212;610508;610631;620279;620444;620685;620354;620518;620572;620720;620885;620919;710037;710176;720188;721888;621284;710214;710223;710486;710858;710982;720119;720511;720670;720941;721052;721107;721114;721292;721418;721585;722421;722536;722651;710429;710494;711027;711128;711158;720238;720304;720329;720330;720497;721291;721377;721392;721449;721648;721707;721894;723197;710313;710350;720622;721729;710462;710664;720023;720407;721504;721704;710342;710382;710548;710566;720358;720986;721891;710679;720290;720516;720723;721434;722891;710131;710446;710551;710591;711244;711245;720400;721374;723395;712027;720774;721224;721532];
- subjects_updated = [110182;120137;120376;120409;120462;121111;120061;120550;110606;120212;121685;120347;110056;110126;110098;110101;120276;120727;122016;110033;120208;120795;122620;110174;110187;110411;120065;120120;120184;120469;121317;121795;120008;120182;120640;121144;121200;121428;121479;120218;120309;120319;120764;121397;122172;122405;110069;110087;110319;120049;120166;120264;120313;120470;121106;121158;220526;221033;112141;210250;210519;212153;220115;220352;220519;221209;221373;222555;210148;210174;220151;220518;221648;222652;210023;210172;210182;220132;220419;221054;222797;220098;220511;220535;220610;221244;221565;221755;221775;221828;221954;222185;222956;220223;220323;220713;220828;221595;221886;210314;210422;210617;220107;220203;220284;220335;220920;221336;221527;221737;221980;222125;210051;210124;220234;220506;220697;220901;221107;221487;221740;222258;222326;210088;220232;220635;221040;221324;221511;221733;223115;223286;210526;210657;220198;220372;220567;220843;220974;220999;221002;221220;221352;221585;221935;221977;222120;222264;222367;221031;222304;222496;223085;320267;310203;320109;320417;320575;320616;321174;321506;321529;310129;310414;320022;320297;320321;320342;320478;320574;320686;321000;321025;321053;321087;321203;310391;310397;310410;320088;320361;320680;320687;321069;321137;310051;310052;310135;320448;320461;320651;320904;321428;321504;321976;310361;310400;320661;320814;321073;321594;310256;320325;320336;320568;320759;321107;321291;321544;321557;321585;321595;310008;310463;312149;320202;320428;320576;320608;320636;320698;321368;321464;310214;310331;310450;310473;320002;320500;320621;321281;321331;321880;310086;310224;310252;312058;320089;320107;320206;320218;320359;320445;320776;320850;320861;320870;320888;320893;322186;310142;310385;312222;320059;320160;320379;320429;320553;321154;321431;410354;420089;420383;321899;410097;410169;410286;420004;420173;420244;420322;420402;420587;420776;410284;420217;420226;420260;420566;420720;420888;410015;410323;420060;420167;420202;420392;420433;420493;420623;410220;410432;420071;420075;420091;420149;420162;420182;420229;420324;420412;420589;410182;410251;420143;420204;420236;420396;420435;410248;410325;412004;412021;420231;420261;420356;420364;420454;420582;410032;410040;410113;410173;410179;410222;420197;420222;420241;420462;420464;410101;410243;410390;420094;420100;420137;420148;420286;410084;410086;410091;410119;410177;410387;420348;410129;410287;410289;410297;420157;420198;510043;510161;520042;520253;510050;510609;510629;520168;520197;520287;520398;520584;510039;510242;510243;510258;510259;510284;510483;520011;520065;520480;520624;510433;510551;510648;520055;520147;520175;520395;520775;510076;510115;510255;510354;510438;510548;510639;512003;520097;510256;510342;510486;520078;520211;520215;520247;520377;520424;520436;520745;521040;510163;510321;510323;510329;510415;520002;520053;520391;520552;520597;520607;510086;510355;510434;510473;520083;520136;520239;520390;520517;520560;510208;510220;510237;510304;510474;510534;520127;520209;520254;520477;520503;520562;510226;510392;520013;520122;520134;520200;520673;520868;510393;510395;520279;520585;520980;610022;610028;610051;610101;620121;620259;620359;620406;610071;610099;610308;610594;620073;620262;620429;620479;620527;620785;621184;610039;610372;610496;610625;610671;620026;620085;620496;620821;621080;610285;610344;610575;610653;620090;620106;620118;620619;620659;620793;620935;610040;610046;610178;610292;610405;610576;620164;621199;621248;610058;610469;620114;620526;620549;621642;620005;620314;620567;620592;610210;610392;620129;620284;620451;620454;620466;620515;621128;610146;610227;610462;610568;620193;620264;620405;620413;620610;621011;621118;610052;610076;610212;610508;610631;620279;620444;620685;620354;620518;620572;620720;620885;620919;710037;710176;720188;721888;621284;710214;710223;710486;710858;710982;720119;720511;720670;720941;721052;721107;721114;721292;721418;721585;722421;722536;722651;710429;710494;711027;711128;711158;720238;720304;720329;720330;720497;721291;721377;721392;721449;721648;721707;721894;723197;710313;710350;720622;721729;710462;710664;720023;720407;721504;721704;710342;710382;710548;720986;721891;710679;720290;720516;720723;721434;722891;710131;710446;710551;710591;711244;711245;720400;721374;723395;712027;720774;721224;721532];
- prefix = '/media/shrey/Kirti1/NatureAging/GC/mvgc_originalSig/CC';
- suffix = '.mat';
- imaginary_subjects = []; % Store subjects with imaginary values
- nan_subjects = []; % Optional: track subjects with NaNs
- inf_subjects = []; % Optional: track subjects with Infs
- for sub = 1:length(subjects_updated)
- sub_id = subjects_updated(sub);
- file_path = strcat(prefix, [num2str(sub_id), suffix]);
- try
- load(file_path, 'F1');
- if any(imag(F1(:)) ~= 0)
- imaginary_subjects(end+1) = sub_id;
- elseif any(isnan(F1(:)))
- nan_subjects(end+1) = sub_id;
- inf_subjects(end+1) = sub_id;
- end
- catch ME
- fprintf('Could not load subject %d: %s\n', sub_id, ME.message);
- end
- end
- % Display results
- disp('Subjects with imaginary values in F1:');
- disp(imaginary_subjects');
- disp('Subjects with NaNs in F1 (if any):');
- disp(nan_subjects');
- disp('Subjects with Infs in F1 (if any):');
- disp(inf_subjects');
- %% Applying stats
- % Date: 08/06/2025
- % Applying FDR correction
- % === INPUTS ===
- % F_real : [16 x 16 x 620] real GC values across subjects
- % F_surrogate : [16 x 16 x 620] surrogate GC values (null distribution)
- nVars = size(F_real_all,1);
- nSubj = size(F_real_all,3);
- alpha = 0.01;
- % === Step 1: Compute mean GC across subjects (real)
- GC_real_mean = mean(F_real_all, 3, 'omitnan'); % [16 x 16]
- % === Step 2: Compute null distribution from surrogate data
- % For each connection (i→j), collect 620 surrogate values and get 99th percentile
- threshold_matrix = nan(nVars, nVars);
- pval_matrix = nan(nVars, nVars);
- signif_matrix = false(nVars, nVars);
- for i = 1:nVars
- for j = 1:nVars
- null_vals = squeeze(F_null_all(i,j,:)); % surrogate GC values for i→j
- null_vals = null_vals(~isnan(null_vals));
- real_val = GC_real_mean(i,j);
- if ~isempty(null_vals) && ~isnan(real_val)
- % 99th percentile threshold
- threshold = quantile(null_vals, 1 - alpha);
- threshold_matrix(i,j) = threshold;
- % Compare real value to threshold
- if real_val > threshold
- signif_matrix(i,j) = true;
- end
- % Also compute uncorrected p-value
- pval_matrix(i,j) = mean(null_vals >= real_val);
- end
- end
- end
- % === Step 3: Bonferroni correction
- nTests = nVars * nVars;
- bonf_alpha = alpha / nTests;
- signif_matrix_bonf = pval_matrix < bonf_alpha;
- % === Outputs ===
- fprintf('Connections above 99th percentile (uncorrected): %d\n', sum(signif_matrix(:)));
- fprintf('Connections significant after Bonferroni: %d\n', sum(signif_matrix_bonf(:)));
- % === OPTIONAL: Visualize
- figure;
- subplot(1,3,1); imagesc(GC_real_mean); title('Mean Real GC'); colorbar; axis square;
- subplot(1,3,2); imagesc(signif_matrix); title('Uncorrected Significance'); axis square;
- subplot(1,3,3); imagesc(signif_matrix_bonf); title('Bonferroni Corrected'); axis square;
- %% Understanding trend of the signficant connections
- % Linear regression between 1 to 5
- for ii = 1:176
- GCVal_young(ii) = F_young1{ii,1}(4,15);
- age_young(ii) = F_young1{ii,3};
- ii
- end
- for ii = 1:198
- GCVal_middle(ii) = F_middle1{ii,1}(4,15);
- age_middle(ii) = F_middle1{ii,3};
- ii
- end
- for ii = 1:243
- GCVal_old(ii) = F_old1{ii,1}(4,15);
- age_old(ii) = F_old1{ii,3};
- ii
- end
- GC = [GCVal_young, GCVal_middle, GCVal_old];
- age = [age_young, age_middle, age_old];
- [r,p] = corrcoef(age, GC)
- figure; scatter(age,GC);
- set(gca,'FontSize',14);
- xlabel('Age (years)');
- ylabel('GC Values');
- xlim([10 90]);
- %% DATE: 08/11/2025
- % Applying stats on group wise
- n_rois = 17;
- sub_y = length(young);
- sub_m = length(middle);
- sub_o = length(old_updated);
- young = [110182;120137;120376;120409;120462;121111;120061;120550;110606;120212;121685;120347;110056;110126;110098;110101;120276;120727;122016;110033;120208;120795;122620;110174;110187;110411;120065;120120;120184;120469;121317;121795;120008;120182;120640;121144;121200;121428;121479;120218;120309;120319;120764;121397;122172;122405;110069;110087;110319;120049;120166;120264;120313;120470;121106;121158;220526;221033;112141;210250;210519;212153;220115;220352;220519;221209;221373;222555;210148;210174;220151;220518;221648;222652;210023;210172;210182;220132;220419;221054;222797;220098;220511;220535;220610;221244;221565;221755;221775;221828;221954;222185;222956;220223;220323;220713;220828;221595;221886;210314;210422;210617;220107;220203;220284;220335;220920;221336;221527;221737;221980;222125;210051;210124;220234;220506;220697;220901;221107;221487;221740;222258;222326;210088;220232;220635;221040;221324;221511;221733;223115;223286;210526;210657;220198;220372;220567;220843;220974;220999;221002;221220;221352;221585;221935;221977;222120;222264;222367;221031;222304;222496;223085;320267;310203;320109;320417;320575;320616;321174;321506;321529;310129;310414;320022;320297;320321;320342;320478;320574;320686;321000;321025;321053;321087;321203];
- middle = [310391;310397;310410;320088;320361;320680;320687;321069;321137;310051;310052;310135;320448;320461;320651;320904;321428;321504;321976;310361;310400;320661;320814;321073;321594;310256;320325;320336;320568;320759;321107;321291;321544;321557;321585;321595;310008;310463;312149;320202;320428;320576;320608;320636;320698;321368;321464;310214;310331;310450;310473;320002;320500;320621;321281;321331;321880;310086;310224;310252;312058;320089;320107;320206;320218;320359;320445;320776;320850;320861;320870;320888;320893;322186;310142;310385;312222;320059;320160;320379;320429;320553;321154;321431;410354;420089;420383;321899;410097;410169;410286;420004;420173;420244;420322;420402;420587;420776;410284;420217;420226;420260;420566;420720;420888;410015;410323;420060;420167;420202;420392;420433;420493;420623;410220;410432;420071;420075;420091;420149;420162;420182;420229;420324;420412;420589;410182;410251;420143;420204;420236;420396;420435;410248;410325;412004;412021;420231;420261;420356;420364;420454;420582;410032;410040;410113;410173;410179;410222;420197;420222;420241;420462;420464;410101;410243;410390;420094;420100;420137;420148;420286;410084;410086;410091;410119;410177;410387;420348;410129;410287;410289;410297;420157;420198;510043;510161;520042;520253;510050;510609;510629;520168;520197;520287;520398;520584;510039;510242;510243;510258;510259;510284;510483;520011;520065;520480;520624];
- old_updated = [510433;510551;510648;520055;520147;520175;520395;520775;510076;510115;510255;510354;510438;510548;510639;512003;520097;510256;510342;510486;520078;520211;520215;520247;520377;520424;520436;520745;521040;510163;510321;510323;510329;510415;520002;520053;520391;520552;520597;520607;510086;510355;510434;510473;520083;520136;520239;520390;520517;520560;510208;510220;510237;510304;510474;510534;520127;520209;520254;520477;520503;520562;510226;510392;520013;520122;520134;520200;520673;520868;510393;510395;520279;520585;520980;610022;610028;610051;610101;620121;620259;620359;620406;610071;610099;610308;610594;620073;620262;620429;620479;620527;620785;621184;610039;610372;610496;610625;610671;620026;620085;620496;620821;621080;610285;610344;610575;610653;620090;620106;620118;620619;620659;620793;620935;610040;610046;610178;610292;610405;610576;620164;621199;621248;610058;610469;620114;620526;620549;621642;620005;620314;620567;620592;610210;610392;620129;620284;620451;620454;620466;620515;621128;610146;610227;610462;610568;620193;620264;620405;620413;620610;621011;621118;610052;610076;610212;610508;610631;620279;620444;620685;620354;620518;620572;620720;620885;620919;710037;710176;720188;721888;621284;710214;710223;710486;710858;710982;720119;720511;720670;720941;721052;721107;721114;721292;721418;721585;722421;722536;722651;710429;710494;711027;711128;711158;720238;720304;720329;720330;720497;721291;721377;721392;721449;721648;721707;721894;723197;710313;710350;720622;721729;710462;710664;720023;720407;721504;721704;710342;710382;710548;720986;721891;710679;720290;720516;720723;721434;722891;710131;710446;710551;710591;711244;711245;720400;721374;723395;712027;720774;721224;721532];
- % Preallocate
- F_real_young = nan(n_rois, n_rois, sub_y);
- F_null_young = nan(n_rois, n_rois, sub_y);
- F_real_middle = nan(n_rois, n_rois, sub_m);
- F_null_middle = nan(n_rois, n_rois, sub_m);
- F_real_old = nan(n_rois, n_rois, sub_o);
- F_null_old = nan(n_rois, n_rois, sub_o);
- prefix1= '/media/shrey/Kirti1/NatureAging/GC/mvgc_originalSig/CC';
- suffix1 = '.mat';
- prefix2 = '/media/shrey/Kirti1/NatureAging/GC/mvgc_originalSig/Surrogate/CC';
- suffix2 = '.mat';
- for ii = 1:length(young)
- try
- %Load real GC
- load(strcat(prefix1, num2str(young(ii,1)), suffix1));
- F_real_young(:, :,ii) = F1;
- %Load null GC
- load(strcat(prefix2, num2str(young(ii,1)), suffix2));
- F_null_young(:,:,ii) = F_null(1:16,1:16);
- catch
- end
- ii
- end
- for ii = 1:length(middle)
- try
- %Load real GC
- load(strcat(prefix1, num2str(middle(ii,1)), suffix1));
- F_real_middle(:, :,ii) = F1(1:16,1:16);
- %Load null GC
- load(strcat(prefix2, num2str(middle(ii,1)), suffix2));
- F_null_middle(:,:,ii) = F_null(1:16,1:16);
- catch
- end
- ii
- end
- for ii = 1:length(old_updated)
- try
- %Load real GC
- load(strcat(prefix1, num2str(old_updated(ii,1)), suffix1));
- F_real_old(:, :,ii) = F1(1:16,1:16);
- %Load null GC
- load(strcat(prefix2, num2str(old_updated(ii,1)), suffix2));
- F_null_old(:,:,ii) = F_null(1:16,1:16);
- catch
- end
- ii
- end
- %% STATS
- % F_surrogate : [16 x 16 x 620] surrogate GC values (null distribution)
- nVars = size(F_real_old,1);
- nSubj = size(F_real_old,3);
- alpha = 0.01;
- % === Step 1: Compute mean GC across subjects (real)
- GC_real_mean = mean(F_real_old, 3, 'omitnan'); % [16 x 16]
- % === Step 2: Compute null distribution from surrogate data
- % For each connection (i→j), collect 620 surrogate values and get 99th percentile
- threshold_matrix = nan(nVars, nVars);
- pval_matrix= nan(nVars, nVars);
- signif_matrix = false(nVars, nVars);
- for i = 1:nVars
- for j = 1:nVars
- null_vals = squeeze(F_null_old(i,j,:)); % surrogate GC values for i→j
- null_vals = null_vals(~isnan(null_vals));
- real_val = GC_real_mean(i,j);
- if ~isempty(null_vals) && ~isnan(real_val)
- % 99th percentile threshold
- threshold = quantile(null_vals, 1 - alpha);
- threshold_matrix(i,j) = threshold;
- % Compare real value to threshold
- if real_val > threshold
- signif_matrix(i,j) = true;
- end
- % Also compute uncorrected p-value
- pval_matrix(i,j) = mean(null_vals >= real_val);
- end
- end
- end
- % === Step 3: Bonferroni correction
- nTests = nVars * nVars;
- bonf_alpha = alpha / nTests;
- signif_matrix_bonf = pval_matrix< bonf_alpha;
- % === Outputs ===
- fprintf('Connections above 99th percentile (uncorrected): %d\n', sum(signif_matrix(:)));
- fprintf('Connections significant after Bonferroni: %d\n', sum(signif_matrix_bonf(:)));
- % === OPTIONAL: Visualize
- figure;
- subplot(1,3,1); imagesc(GC_real_mean); title('Old'); colorbar; axis square;
- subplot(1,3,2); imagesc(signif_matrix); title('Uncorrected Significance'); axis square;
- subplot(1,3,3); imagesc(signif_matrix_bonf); title('Bonferroni Corrected'); axis square;
- %% Understanding the trend of the significant GC connections
- %% Understanding trend of the signficant connections
- % Linear regression between 1 to 5
- for ii = 1:size(F_young1,1)
- GCVal_young(ii) = F_young1{ii,1}(4,15);
- age_young(ii) = F_young1{ii,3};
- ii
- end
- for ii = 1:size(F_middle1,1)
- GCVal_middle(ii) = F_middle1{ii,1}(4,15);
- age_middle(ii) = F_middle1{ii,3};
- ii
- end
- for ii = 1:size(F_old1,1)
- GCVal_old(ii) = F_old1{ii,1}(4,15);
- age_old(ii) = F_old1{ii,3};
- ii
- end
- GC = [GCVal_young, GCVal_middle, GCVal_old];
- age = [age_young, age_middle, age_old];
- [r,p] = corrcoef(age, GC)
- figure; scatter(age,GC);
- set(gca,'FontSize',14);
- xlabel('Age (years)');
- ylabel('GC Values');
- xlim([10 90]);
MVGC.m at commit 35b1c30, no license · at the source
Overview
- National Brain Research Centre, Manesar, India
- Centre for Brain Science and Applications (CBSA), School of AIDE, Indian Institute of Technology, Jodhpur, India
Abstract
The brain continuously integrates signals from the external environment along with internal bodily cues to support adaptive cognition and homeostasis. Among these, multiple visceral rhythms, such as respiration, circadian fluctuations, and cardiac activity, contribute to the organization of intrinsic brain dynamics. The present study focuses on cardiac signals, as the heartbeat provides a continuous, quasi-periodic physiological rhythm that enables precise time-locking of neural responses and offers a tractable model for investigating brain–body interactions at rest. Interoceptive processing is influenced by factors, including arousal, emotional state, and aging, and is known to be altered in neurological conditions such as Parkinson’s disease and dementia. Here, we investigated how the cortical representation of cardiac signals changes across the adult lifespan and the mechanisms underlying this reorganization. Using a large human cohort (N = 620, aged 18–88 years) with simultaneous resting-state MEG and ECG, the study found that cortical heartbeat-evoked responses (HERs) showed distinct amplitude changes in the 180–320 ms window post the heartbeat including a systematic reduction in amplitude with age. Cardiac signals modulated the phase of ongoing theta-band neural oscillations rather than altering overall power, and this phase-resetting effect became more consolidated in older adults. Source analysis revealed that resting-state HERs originated primarily from fronto-temporal regions, including orbitofrontal, frontal, and temporal pole areas, and exhibited a clear age-related shift from predominantly frontal to more temporal generators. Directed connectivity analyses revealed an age-related shift in heart–brain communication, characterized by increased heart-to-brain and decreased brain-to-heart Granger causality. Together, these findings demonstrate that cardiac processing undergoes systematic age-related reorganization, characterized by changes in response amplitude, phase dynamics, and heart–brain interactions. These alterations may contribute to broader age-related differences in cognitive functions such as attention, emotions, and time perception.
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 7 matches between paragraphs and lines of code.
kirtisaluja/HER-Across-Ageing
35b1c30602d9215083ba7114d6e88a8b9a70d151, 14 September 2025Availability: 1 check, the latest on 27 September 2026: the link answers
- 27 September 2026: the link answers
7 files
- ECGSignalQualityMeasures
.m , MATLAB, 79 lines - HERsAcrossAge.m, MATLAB, 83 lines, 2 matches
- ICA_July_thirdfinal_HEPd
ec2022 (1).ipynb , Jupyter, 130 lines, 1 match - ITC_critical_value.m, MATLAB, 63 lines
- MVGC.m, MATLAB, 623 lines, 2 matches
- PanTompkin_Rpeak.m, MATLAB, 72 lines, 2 matches
- README.md, Text, 33 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;
- 6 scripts, each with its path and the digest of its content;
- 7 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 and Code Availability
The neuroimaging data of healthy participants were obtained from publicly available CamCAN repository (available at http://
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
- Funding: added Department of Biotechnology, Ministry of Science and Technology, India; National Brain Research Centre
Version 1, 27 September 2026: the first record
Recorded: type, language, journal, volume, pages, dates, 3 authors, 6 keywords, 58 references.
Cite
This paper
Saluja, K., Roy, D., & Banerjee, A. (2026). When the inner clock fades: Interoceptive decline and consolidation of phase resetting in cortical rhythms by cardiac events underlie healthy lifespan aging. Imaging neuroscience (Cambridge, Mass.), 4, IMAG.a.1319. https://
BibTeX
@article{saluja2026when,
author = {Saluja, Kirti and Roy, Dipanjan and Banerjee, Arpan},
title = {{When the inner clock fades: Interoceptive decline and consolidation of phase resetting in cortical rhythms by cardiac events underlie healthy lifespan aging}},
journal = {Imaging neuroscience (Cambridge, Mass.)},
year = {2026},
month = jul,
volume = {4},
pages = {IMAG.a.1319},
publisher = {MIT Press},
issn = {2837-6056},
doi = {10.1162/
url = {https://
pmid = {42569459},
pmcid = {PMC13449928}
}
RIS
TY - JOUR
AU - Saluja, Kirti
AU - Roy, Dipanjan
AU - Banerjee, Arpan
TI - When the inner clock fades: Interoceptive decline and consolidation of phase resetting in cortical rhythms by cardiac events underlie healthy lifespan aging
T2 - Imaging neuroscience (Cambridge, Mass.)
J2 - Imaging Neurosci (Camb)
PY - 2026
DA - 2026/
VL - 4
SP - IMAG.a.1319
SN - 2837-6056
PB - MIT Press
DO - 10.1162/
UR - https://
LA - en
ER -
CSL-JSON
{
"id": "10.1162/
"type": "article-journal",
"title": "When the inner clock fades: Interoceptive decline and consolidation of phase resetting in cortical rhythms by cardiac events underlie healthy lifespan aging",
"container-title": "Imaging neuroscience (Cambridge, Mass.)",
"author": [
{
"family": "Saluja",
"given": "Kirti"
},
{
"family": "Roy",
"given": "Dipanjan"
},
{
"family": "Banerjee",
"given": "Arpan"
}
],
"container-title-short":
"volume": "4",
"page": "IMAG.a.1319",
"DOI": "10.1162/
"PMID": "42569459",
"PMCID": "PMC13449928",
"ISSN": "2837-6056",
"publisher": "MIT Press",
"URL": "https://
"language": "en",
"issued": {
"date-parts": [
[
2026,
7,
29
]
]
}
}
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.1111/psyp.70297 [code]
- Heartbeat-Evoked Responses in M/
EEG: A Systematic Review of Methods With Suggestions for Analysis and Reporting. Journal: PsychophysiologyIn common: NumPy, 17 references - [2] doi:10.1111/psyp.70301
- Oscillatory Markers of Interoceptive Attention: Beta Suppression as a Neural Signature of Heartbeat Processing.Journal: PsychophysiologyIn common: cognitive, 9 references
- [3] doi:10.1162/imag.a.1353 [code]
- Model-based cardiac field artefact correction for OP-MEG.Journal: Imaging neuroscience (Cambridge, Mass.)In common: FieldTrip, Statistics and Machine Learning Toolbox, 6 references
- [4] doi:10.1093/braincomms/fcag120 [code]
- The heartbeat evoked potential and the prediction of functional seizure semiology.Journal: Brain communicationsIn common: MNE-Python, SciPy, NumPy, 5 references
- [5] doi:10.7554/elife.100605 [code]
- Age-related changes in ‘cortical’ 1/
f dynamics are linked to cardiac activity Journal: n/aIn common: MNE-Python, SciPy, NumPy, 5 references - [6] doi:10.1088/1741-2552/ae5fd7 [code]
- Metric validation for detection of delayed and directed coupling.Journal: Journal of neural engineeringIn common: FieldTrip, Statistics and Machine Learning Toolbox, SciPy, 1 other tool, 4 references
- [7] doi:10.1038/s41467-026-73553-8 [code]
- Universal rhythmic architecture uncovers two modes of neural dynamics.Journal: Nature communicationsIn common: FieldTrip, MNE-Python, Statistics and Machine Learning Toolbox, 2 other tools, 3 references
- [8] doi:10.1038/s41467-026-71568-9 [code]
- Convergent and selective representations of pain, appetitive processes, aversive processes, and cognitive control in the insula.Journal: Nature communicationsIn common: Statistics and Machine Learning Toolbox, SciPy, NumPy, cognitive, 4 references
- [9] doi:10.1038/s41598-026-52930-9
- Cardiac systole is associated with enhanced go responding in an orthogonalized go/
nogo task. Journal: Scientific reportsIn common: cognitive, 5 references - [10] doi:10.1038/s41597-025-06397-4 [code]
- MEG-SCANS - A comprehensive magnetoencephalography speech dataset with Stories, Chirps and Noisy SentencesJournal: n/aIn common: FieldTrip, MNE-Python, Statistics and Machine Learning Toolbox, 2 other tools, 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.
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, 6 scripts, and 7 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:9068c2daf94a7e90…
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
[, paste the snippet at the top, then “Commit changes…” and, to review it first, “Create a new branch and start a pull request”. You open the pull request; OSCR asks for no permission.
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.
