trentool / TRENTOOL3

Open-Source MATLAB toolbox for transfer entropy estimation
http://trentool.github.io/TRENTOOL3/
GNU General Public License v3.0
56 stars 26 forks source link

NANs in TE and MI outputs from TE surrogate #4

Closed dicaincadi closed 9 years ago

dicaincadi commented 9 years ago

Dear experts, I just started working with the TRENTOOL toolbox and Im finding some issues that I hope you could give me some advice to face them. I have a dataset of source reconstructed MEG data, where I have identified 4 sources of interest, and I have extracted the ~30 trials for each source in fieldtrip format. The trials are at 1000Hz sampling rate and go between [-50,300] ms. Before any between condition comparison, Im first interested in identifying the TE for each of the different conditions in a group of 12 subjects.

This is the header I have used. For the moment I am selecting a fixed delay u = 11.

cfgTEGP = [];
cfgTEGP.TEcalctype = 'VW_ds';
cfgTEGP.channel = {'C1' 'C2' 'C3' 'C4'};
cfgTEGP.predicttime_u = 11;
cfgTEGP.toi = [0,0.3]; % time of interest
cfgTEGP.trialselect = 'ACT';
cfgTEGP.actthrvalue = 70;
cfgTEGP.minnrtrials = 20; 
cfgTEGP.optimizemethod ='ragwitz';
cfgTEGP.ragdim = 2:5; 
cfgTEGP.repPred = 60;
cfgTEGP.ragtaurange = [0.2 0.5];
cfgTEGP.ragtausteps = 10;
cfgTEGP.flagNei = 'Mass' ; 
cfgTEGP.sizeNei = 4; 
cfgTEGP.outputpath = OutputDataPath;

load(datapath)
Data_prepared1 = TEprepare(cfgTEGP,ftdata);

% Run surrogate analysis
cfgTESS = [];
cfgTESS.shifttest = 'no';
cfgTESS.optdimusage = 'indivdim';
cfgTESS.surrogatetype = 'trialshuffling';
cfgTESS.shifttesttype = 'TE>TEshift';
cfgTESS.fileidout = 'TEsurro_cd1';
Data_surr = TEsurrogatestats(cfgTESS,Data_prepared1);

After I run this, I only got NANs in the output TE and MI. I have tryed to follow steps in the manual and publication, but Im not able to make it running. If you could tell me if you see something that you would consider uncorrect from the header config it would be really helpful.

Thanks

Jose

pwollstadt commented 9 years ago

Hi Jose,

there seems to be nothing wrong with your header/configuration. I would like to run the analysis myself to debug it. Could you send me the data or a link to the data and the script you're using to p.wollstadt[at]stud.uni-frankfurt.de?

Thank you for your feedback, have a nice day, Patricia

dicaincadi commented 9 years ago

Hi Patricia, in this link you'll find the data for one subject. https://www.dropbox.com/sh/kh2w7rjunuspxof/AAC_MZdpq57ktr6EjyktqFHDa?dl=0

Thanks!!

José

2015-04-17 11:00 GMT-04:00 pwollstadt notifications@github.com:

Hi Jose,

there seems to be nothing wrong with your header/configuration. I would like to run the analysis myself to debug it. Could you send me the data or a link to the data and the script you're using to p.wollstadt[at] stud.uni-frankfurt.de?

Thank you for your feedback, have a nice day, Patricia

— Reply to this email directly or view it on GitHub https://github.com/trentool/TRENTOOL3/issues/4#issuecomment-94003150.

José Angel Pineda Pardo

Center of Biomedical Technology (CTB)

Parque Científico y Tecnológico de la UPM

Campus de Montegancedo

28223 Pozuelo de Alarcón, Madrid, ES

pwollstadt commented 9 years ago

Hi Jose,

I had a look at the data and the script. I got an error, because the channels you define in cfgTEGP do not match the channels in the data structure. I did the following:

load(datapath)
cfgTEGP = [];
cfgTEGP.TEcalctype = 'VW_ds';
%cfgTEGP.channel = {'C1' 'C2' 'C3' 'C4'};
cfgTEGP.channel = ftdata.label;

Then there was another issue because you are calling the functions TEprepare and TEsurrogatestats directly, without using InteractionDelayReconstruction_calculate.m: there was an error in the function transferentropy.m. I fixed this, you need to update this function in your local folder.

After these changes everything seemed to work here. Could you check if it runs and let me know if you get any results?

Best, Patricia

P.S.: The time window you are using is pretty short for a robust TE estimation (300ms/300samples). Is there a way to use longer epochs for your analysis?

dicaincadi commented 9 years ago

Hi Jose,

I had a look at the data and the script. I got an error, because the channels you define in cfgTEGP do not match the channels in the data structure. I did the following:

load(datapath) cfgTEGP = []; cfgTEGP.TEcalctype = 'VW_ds'; %cfgTEGP.channel = {'C1' 'C2' 'C3' 'C4'}; cfgTEGP.channel = ftdata.label;

Thats true. I changed the channels to avoid confussion. But on my scripts they were Ok.

Then there was another issue because you are calling the functions TEprepare and TEsurrogatestats directly, without using InteractionDelayReconstruction_calculate.m: there was an error in the function transferentropy.m https://github.com/trentool/TRENTOOL3/raw/master/private/transferentropy.m. I fixed this, you need to update this function in your local folder.

Ok, now its working. Thanks!!

After these changes everything seemed to work here. Could you check if it runs and let me know if you get any results?

Best, Patricia

P.S.: The time window you are using is pretty short for a robust TE

estimation (300ms/300samples). Is there a way to use longer epochs for your analysis?

The window of interest in the trial is only this period. I could take a longer segment +-500 ms at each side as a padding for the computation, but I do not want them to contribute in the TE estimation. Does it make any sense?

Thanks!

José

— Reply to this email directly or view it on GitHub https://github.com/trentool/TRENTOOL3/issues/4#issuecomment-94009665.

José Angel Pineda Pardo

Center of Biomedical Technology (CTB)

Parque Científico y Tecnológico de la UPM

Campus de Montegancedo

28223 Pozuelo de Alarcón, Madrid, ES

pwollstadt commented 9 years ago

Hm, it doesn't make sense to include more samples if they shouldn't contribute to the TE estimation. Then you have to run it like that. Another option would be the ensemble method (pooling data points over trials to estimate TE from short time windows), but for that you need a NVIDIA-GPU.

I would mark this issue as closed.

Best, Patricia

rita-o commented 4 years ago

Hello,

Sorry if this is a basic question, but I cannot find it anywhere. What does it mean "short time window", how many time samples are recommended for the epochs for a robust TE estimation? And another question is, should the epochs start at 0 or a bit before, to give some information about the baseline (as here, where the considered interval was [-50,300] ms)?

Thank you in advance, Rita