The spectral granger causality was calculated with the following piece of code

clear load P2_granger_data.mat [bic, aic]=cca_find_model_order(X, 1,20); order = max(aic,bic); freqs = [1:0.5:50]; [GW,COH,pp,waut,cons] = cca_pwcausal(X, 1, size(X,2), order, s_freq, freqs, 0); semilogy(freqs, squeeze(GW(1,2,:)), 'linewidth', 2); hold on semilogy(freqs, squeeze(GW(2,1,:)), 'linewidth', 2) xlabel('Frequency [Hz]'); ylabel('Spectral Granger'); legend('2->1', '1->2','Location', 'Best')