<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" style="display:none;"><!-- P {margin-top:0;margin-bottom:0;} --></style>
</head>
<body dir="ltr">
<div id="divtagdefaultwrapper" dir="ltr" style="font-size:12pt; color:rgb(0,0,0); font-family:Calibri,Helvetica,sans-serif,EmojiFont,"Apple Color Emoji","Segoe UI Emoji",NotoColorEmoji,"Segoe UI Symbol","Android Emoji",EmojiSymbols">
<p></p>
<div style="font-family:Calibri,Helvetica,sans-serif,EmojiFont,"Apple Color Emoji","Segoe UI Emoji",NotoColorEmoji,"Segoe UI Symbol","Android Emoji",EmojiSymbols; font-size:16px">
<p style="margin-bottom:1rem; text-align:justify; color:rgb(12,84,96)"><span style="color:rgb(0,0,0)">Dear community,</span></p>
<span style="color:rgb(0,0,0)"></span>
<p style="margin-bottom:1rem; text-align:justify; color:rgb(12,84,96)"><span style="color:rgb(0,0,0)">My name is Walter Caņedo Riedel and I am working at Kelschlab (Mainz University). I am currently analyzing LFP data; there are several channels and I am trying
to obtain their Granger causality spectra (by pairs of channels) with the non-parametric approach starting with a wavelet transform. My LFP data is at a resolution of 1000Hz.</span><span style="color:rgb(0,0,0)"></span></p>
<p style="margin-bottom:1rem; text-align:justify; color:rgb(12,84,96)"><span style="color:rgb(0,0,0)"></span></p>
<p style="margin-bottom:1rem; font-family:Calibri,Helvetica,sans-serif,EmojiFont,"Apple Color Emoji","Segoe UI Emoji",NotoColorEmoji,"Segoe UI Symbol","Android Emoji",EmojiSymbols; font-size:16px; text-align:justify; color:rgb(12,84,96)">
<span style="color:rgb(0,0,0)"><b>I would appreciate if you help me understand how to run the non-parametric Granger causality correctly. </b></span><span style="color: rgb(0, 0, 0);">The GC spectra that I obtain have all the following artifact: every second
frequency is exalted with respect to its immediate neighbor frequencies, forming a zebra-stripe pattern (image:
</span><i style="color: rgb(0, 0, 0);">GC from a channel to another</i><span style="color: rgb(0, 0, 0);">).</span></p>
<p></p>
<p style="margin-bottom:1rem; text-align:justify; color:rgb(12,84,96)"><span style="color:rgb(0,0,0)">I made a
</span><span style="color:rgb(0,0,0)">simple simulation to look into it. Channel 1 and channel 2 are modulated by different frequencies plus noise. Ch1 from time t-3 to t-1 influences Ch2 linearly at time t.</span><br>
<span style="color:rgb(0,0,0)">If Ch1 is modulated by a frequency below 10 Hz, then I get the stripe artifact for its Granger causality to Ch2. (Image:
<i>GC has an artifact...</i>) The script for the simulation is found below after my signature. </span></p>
<p style="margin-bottom:1rem; text-align:justify; color:rgb(12,84,96)"><span style="color:rgb(0,0,0)"></span></p>
<div style="font-family:Calibri,Helvetica,sans-serif,EmojiFont,"Apple Color Emoji","Segoe UI Emoji",NotoColorEmoji,"Segoe UI Symbol","Android Emoji",EmojiSymbols; font-size:16px">
<p style="margin-bottom:1rem; text-align:justify; color:rgb(12,84,96)"><span style="color:rgb(0,0,0)">Things that I've tried to no avail:</span></p>
<p style="margin-bottom:1rem; text-align:justify; color:rgb(12,84,96)"></p>
<ul style="margin-bottom:0px; margin-top:0px">
<li>Doing the analysis up to the Nyquist limit (by down-sampling the data to 200Hz and analyzing frequencies 1:100).</li><li>High-pass filtering my data (I still get stripes even after filtering out frequencies below 15Hz).</li><li>Trying out 'mtmconvol' with hanning or with dpss instead of 'wavelet' for <span style="font-family:Calibri,Helvetica,sans-serif,EmojiFont,"Apple Color Emoji","Segoe UI Emoji",NotoColorEmoji,"Segoe UI Symbol","Android Emoji",EmojiSymbols; font-size:16px; text-align:justify">ft_freqanalysis cfg.method.</span></li><li>Trying cfg.output = 'fourier' or 'powandcsd'.</li><li>Varying the size of the width for the wavelet or of the respective window for mtmconvol. </li></ul>
</div>
<p></p>
<p style="margin-bottom:1rem; text-align:justify; color:rgb(12,84,96)"><span style="color:rgb(0,0,0)"><br>
</span></p>
<p style="margin-bottom:1rem; text-align:justify; color:rgb(12,84,96)"><img naturalheight="337" naturalwidth="465" size="127433" id="img300784" tabindex="0" style="max-width: 99.9%; user-select: none;" src="cid:b088c18a-8599-4446-8130-f8bf549fe488"><br>
</p>
<p style="margin-bottom:1rem; text-align:justify; color:rgb(12,84,96)"><img naturalheight="328" naturalwidth="1483" size="86480" id="img534768" tabindex="0" style="max-width: 99.9%; user-select: none;" src="cid:7683ed51-e509-48ee-bf96-835fc2867626"><br>
</p>
<p style="margin-bottom:1rem; text-align:justify; color:rgb(12,84,96)"><br>
</p>
</div>
<div id="Signature">
<div id="divtagdefaultwrapper" dir="ltr" style="color:rgb(0,0,0); font-family:Calibri,Helvetica,sans-serif,EmojiFont,"Apple Color Emoji","Segoe UI Emoji",NotoColorEmoji,"Segoe UI Symbol","Android Emoji",EmojiSymbols">
<p style="font-size:12pt"><span style="font-size:13px; font-family:Tahoma,serif,EmojiFont; color:rgb(128,128,128)"></span></p>
<div>All the best,</div>
<div><span style="color:rgb(128,128,128); font-family:Tahoma,serif,EmojiFont; font-size:13px">Walter Caņedo Riedel</span></div>
<p style=""><span style="font-size:8pt; font-family:Tahoma,serif,EmojiFont; color:rgb(128,128,128)"></span></p>
<p style="font-size:12pt"><font color="808080" style="font-family:Tahoma,serif,EmojiFont; font-size:13px">Central Institute of Mental Health (ZI)<br>
AG Kelsch</font><span style="font-family:Tahoma,serif,EmojiFont; font-size:13px; color:rgb(128,128,128)"></span></p>
<p style="font-size:12pt"><font color="808080" style="font-family:Tahoma,serif,EmojiFont; font-size:13px">+49 (0)621 1703 6203</font></p>
<p style="font-size:12pt"><font color="808080" style="font-family:Tahoma,serif,EmojiFont; font-size:13px"><br>
</font></p>
<p style="font-size:12pt"><font color="808080" style="font-family:Tahoma,serif,EmojiFont; font-size:13px"><br>
</font></p>
<p style="font-size:12pt"><font color="808080" style="font-family:Tahoma,serif,EmojiFont; font-size:13px"></p>
<div>%% Simulation</div>
<div>clear</div>
<div>lfpchannels = NaN(1200000, 2); % Two channels (CH1 & CH2) with million two hundred thousand datapoints</div>
<div>frequency = 1000; % I have a 1000Hz resolution</div>
<div><br>
</div>
<div>SaverGC = [];</div>
<div>SaverPW = [];</div>
<div>for fr = 1:10</div>
<div> lfpchannels(:, :) = rand(size(lfpchannels)); % Initial noise in the channels</div>
<div> </div>
<div> % Modulate CH1 at (fr)Hz</div>
<div> dt = 1/frequency; </div>
<div> StopTime = size(lfpchannels,1)/frequency; </div>
<div> t = (0:dt:StopTime-dt)'; </div>
<div> F = fr; % Sine wave frequency (Hz)</div>
<div> Modulator1 = sin(2*pi*F*t) / 10; </div>
<div> lfpchannels(1:numel(Modulator1), 1) = lfpchannels(1:numel(Modulator1), 1) + Modulator1;</div>
<div> % Modulate CH2 at 38Hz</div>
<div> F = 38; % Sine wave frequency (Hz)</div>
<div> Modulator = sin(2*pi*F*t) / 10;</div>
<div> lfpchannels(1:numel(Modulator), 2) = lfpchannels(1:numel(Modulator), 2) + Modulator;</div>
<div> </div>
<div> % Random weights for CH1(t-3:t-1) influencing CH2(t).</div>
<div> FRA_s = 3;</div>
<div> FRA = rand(FRA_s, 1);</div>
<div> % Make CH1 influence CH2</div>
<div> for p = FRA_s+1:size(lfpchannels,1)</div>
<div> lfpchannels(p, 2) = lfpchannels(p, 2) + mean(FRA.*lfpchannels(p-FRA_s : p-1, 1));</div>
<div> end</div>
<div> % z score channels to have same variance</div>
<div> lfpchannels = (lfpchannels - mean(lfpchannels,1)) ./ std(lfpchannels, 0, 1);</div>
<div> </div>
<div> %%% Make data structure with trials</div>
<div> TrialMarker = 1:numel(-1.999:0.001:14)/2:(numel(-1.999:0.001:14)/2)*150 + 1;</div>
<div> data = struct;</div>
<div> data.label = {'1';'2'};</div>
<div> data.fsample = 1000;</div>
<div> data.trial = {};</div>
<div> data.time = {};</div>
<div> for tr = 1:50</div>
<div> data.trial{tr} = lfpchannels(TrialMarker(tr):TrialMarker(tr+2)-1, :)';</div>
<div> data.time{tr} = -1.999:0.001:14;</div>
<div> end</div>
<div> data.sampleinfo = [1:50;101:150];</div>
<div> data.trialinfo = ones(1, 50);</div>
<div> </div>
<div> %%% Run wavelet transform</div>
<div> cfg = [];</div>
<div> cfg.method = 'wavelet';</div>
<div> cfg.output = 'powandcsd';</div>
<div> cfg.foi = 1:100;</div>
<div> cfg.width = 7;</div>
<div> cfg.toi = (3);</div>
<div> cfg.pad = 20;</div>
<div> freq = ft_freqanalysis(cfg, data);</div>
<div> </div>
<div> cfg = [];</div>
<div> cfg.method = 'granger';</div>
<div> cfg.granger.sfmethod = 'bivariate';</div>
<div> Granger = ft_connectivityanalysis(cfg, freq);</div>
<div> SaverGC(fr, :) = Granger.grangerspctrm(1, :);</div>
<div> SaverPW(fr, :) = freq.powspctrm(1, :);</div>
<div>end</div>
<div><br>
</div>
<div>figure</div>
<div>tiledlayout(1, 2)</div>
<div>nexttile</div>
<div>imagesc(SaverPW)</div>
<div>xlabel("Power spectrum (Hz)")</div>
<div>ylabel("Modulating signal (Hz)")</div>
<div>nexttile</div>
<div>imagesc(SaverGC)</div>
<div>xlabel("GC spectrum (Hz)")</div>
<div>sgtitle("GC has an artifact for the channel modulated by a signal of less than 10Hz")</div>
<div><br>
</div>
<br>
</font>
<p></p>
</div>
</div>
</div>
</body>
</html>