[FieldTrip] NaNs in Granger Spectrum

Jörn M. Horschig jorn at artinis.com
Thu Nov 19 09:30:55 CET 2015


Dear Helen,

 

I am not quite sure why there are only nans or 0s in your granger spectrum. It could be because of the nans in your data. You could test that by just putting the time from e.g. 0.3s to 0.7s in. As a general tip, I would always segment trials into larger chunks that you want to do your final analysis on, otherwise edge artifacts (either from filtering or like here in the TFR) will show up. Also, I used constant 400ms time windows <http://journals.plos.org/plosone/article?id=10.1371/journal.pone.0138685>  (link) <http://journals.plos.org/plosone/article?id=10.1371/journal.pone.0138685> , which apart from making the time-windows of the TFR look ‘nicer’, it also makes it easier to compare across frequencies. With the frequency-dependent time window, you could run into issues with SNR across frequencies, as the lower frequency content is estimated by a longer time windows, and averaging over more data should lead to a higher SNR. Thus, the lower frequency content should be more reliable when using frequency-dependent time windows.

 

Two other general tips: 

1)      If I recall correctly, the Wilson factorization that is being used for estimating the transfer matrix assumes that your data contains all frequencies from DC to the Nyquist frequency. So better not restrict your analysis from 1 to 20Hz, but use 0 to fsample/2.

2)      If you have strong noise components in your data, for example line noise, your power spectrum will sharply rise near the line noise frequency, and quickly fall off a few Hz after that. Such sharp changes will lead to strange effects in your Granger estimation, showing up as changes in estimated peak frequencies. Filtering such artifacts out though should be done with care though, see e.g. http://www.ncbi.nlm.nih.gov/pubmed/21864571 and http://www.ncbi.nlm.nih.gov/pubmed/20026279. I would advise against trying to filter out line noise based on experience with my own data. I found it more suitable to use zero padding, which “artificially” increases your frequency resolution, thereby smoothes the power spectrum and thus avoid prevents sharp changes in there. Btw, note that the two above papers are on parametric Granger, which might be differently affected by filtering than the nonparametric version (that’s at least what I found using simulated data – parametric Granger was more invariant to different preprocessing pipelines)

 

Best of luck ;)

Greetings,

Jörn

 

--
Jörn M. Horschig, PhD, Software Engineer
 <http://www.artinis.com/> Artinis Medical Systems  |  +31 481 350 980 

 

From: fieldtrip-bounces at science.ru.nl [mailto:fieldtrip-bounces at science.ru.nl] On Behalf Of Helen Wieffering
Sent: Wednesday, November 18, 2015 15:47
To: FieldTrip discussion list <fieldtrip at science.ru.nl>
Subject: [FieldTrip] NaNs in Granger Spectrum

 

Dear Fieldtrip users,

I am working with a 128 channel EEG data and am currently in the process of calculating non-parametric Granger causality measures. I am following the steps outlined in Dhamala, Rangarajan, and Ding (2008) from NeuroImage.

However, I'm facing the curious problem that my output data from calling ft_connectivity has a grangerspctrm made up only of NaN and 0 values. Does anyone have insight as to why that might be? I've tried playing around with cfg.toi and the location of our virtual channels, but neither seems to help. 

My code is below, where 'source01' and 'source02' refer to virtual channels we created based off powspctrm data from beamformer source localization on our own data, according to steps outlined in the FT connectivity tutorial.

data = 
label: {2x1 cell}
trial: {1x155 cell}
time: {1x155 cell}
fsample: 250
cfg: [1x1 struct]
sampleinfo: [155x2 double]

% perform multitaper analysis
cfg = [];
cfg.method = 'mtmconvol';
cfg.channelcmb = { 'all' 'all'};
cfg.fsample = 250;
cfg.channel = data.label;
cfg.output = 'powandcsd';
cfg.foi = 0:1:20;                      
cfg.toi = -0.5:0.004:1.5;       
cfg.taper = 'hanning';
cfg.t_ftimwin = 4 ./ cfg.foi;            
freq = ft_freqanalysis(cfg, data_both);

Note: I've checked the values in freq.powspctrm, and though there are NaNs around the temporal edges, there is real data amid the time frame of interest. I've attached a sample TFR plot.


% compute granger causality
cfg = [];
cfg.method = 'granger';
cfg.channel = {'source01' 'source02'};
cfg.channelcmb = {'all' 'all'};
granger = ft_connectivityanalysis(cfg, freq);

% plot
cfg = [];
cfg.parameter = 'grangerspctrm';
cfg.zlim = [0 .5];
cfg.refchannel = 'source02';
cfg.directionality = 'outflow';
ft_singleplotTFR(cfg, granger);

However, this plot is a blank no matter which values I seem to choose as a zlim.

Any tips are much appreciated - thanks! 

(Please excuse my re-posting of a similar message twice - I'm simply hoping to catch a few more responses. As far as I can tell, this issue has not yet been addressed in the digest archives - though if I'm mistaken please feel free to point me to the appropriate thread!)

Best,

Helen Wieffering

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20151119/4f8fd3e0/attachment-0002.html>


More information about the fieldtrip mailing list