Mensen / ept_TFCE-matlab

Advanced EEG Statistics
27 stars 9 forks source link

data structure for EEGLAB ERSP data #2

Open lix90 opened 8 years ago

lix90 commented 8 years ago

Hi Mensen:

These days I was trying to use your toolbox to analyse eeglab ersp data. I am not an expert on matlab. I have not figured out that how to arrange my datasets to correctly run TFCE. Could you kindly specify that how to prepare data structure in order to attain expected results?

I have read source code of ept_rmANOVA, in which I found lines that have information of data structure, but what does the fourth dimension refer to? Is it the dimension of frequency? Thank you in advance for your time.

    Data{1,1} = randi(20,14,125,249);
    Data{1,2} = randi(20,14,125,249)+3;
    Data{1,3} = randi(20,14,125,249);
    Data{2,1} = randi(20,14,125,249);
    Data{2,2} = randi(20,14,125,249);
    Data{2,3} = randi(20,14,125,249)+1;
nF1     = size(Data,1);
nF2     = size(Data,2);
nP      = size(Data{1,1},1); % number of participants
nC      = size(Data{1,1},2); % number of channels
nT      = size(Data{1,1},3); % number of time points (samples)
Mensen commented 8 years ago

Hi!

Depending on what sort of analysis you are running, and what sort of data you have, your data will look a little different.

Just explain what you saw in the source code: randi(20, 14, 125, 249); refers to the random number generation of integers from 1-20 with a variable size of 14 * 125 * 249. This was my typical ERP dataset size with 14 participants/trials, 125 channels, and 249 time points.

To give you specific advice on your data structure, I'll need to know whether your ERSP data are for a single channel, or do you have a time*frequency decomposition for all your channels individually?


If its only a single channel you want to test on then your data should be structured as: participants x time x frequency

and then you'll need to set the flag_ft option to true when running the analysis so the script does not look for channels.

E.g...

ept_TFCE(dataset1, dataset2, ... [],... 'type', 'i', ... 'flag_ft', true, ... 'flag_tfce', true, ... 'nPerm', 5000,... 'rSample', EEG.srate, ... 'saveName', 'ept_Results.mat');

Where the third empty input would be the channel structure which you don't need.

Type is the analysis type you wish to run, 'i' is independent while 'd' is dependend/paired data


If you have ERSP data for many channels you want your data structured as: participants x channels x time x frequency

And you'll need the third input to the be the channel locations structure. Which in your case, using EEGLAB is simply EEG.chanlocs

lix90 commented 8 years ago

Hey, Mensen. Thank you so much. Your so detailed explanation really clear my confusion.

sankar-mukherjee commented 8 years ago

Hi Mensen,

I am confused on how to use your toolbox if i have different number of trials for each subjects.

Mensen commented 8 years ago

@sankar-mukherjee

Hi! So in general you usually have to decide whether you want to analyse at the individual level, or the group level. In your case, it sounds like you want to analyse over multiple participants. So at the individual level you should just have one dataset the is representative of that individual... this will generally be the average activity over all trials of the same type etc.

In theory one might want to analyse at the individual level but use data from multiple subjects together and specify subjects as an additional factor. This is very rarely done in practice (I've basically yet to see this sort of thing published anywhere), but possible in principle. Is this what you were thinking of doing? I have some basic code that could be adapted to make this sort of thing work... but I'll suppose you actually just want to average your individual EEG activity over the trials and then analyse at the group level.

Let me know.

abhishekpatil32 commented 10 months ago

Hii Mensen,

I have a few very basic doubts about ERSP based on EEGLAB. I am using the "pop_newtimef.m" function for my ERSP calculation.

I have calculated ERSP of all subjects and averaged them. I get 1 x 30 (30 is the number of the electrodes) and each electrode has an ERSP of size 42 x 200 where 42 are nfreqs and 200 is the ntimes.

I have a few doubts:

  1. I am currently working on group comparisons: so I have averaged all the data across subjects is this the right way to do time-frequency analysis?

  2. I want to further correct the ERSP for significance and multiple comparisons. I have used 'mcorrect', 'FDR' in the pop_newtimef function. I don't think this is right because with and without the results are the same.

  3. I wanted to know how to plot - ERSP (in dB) vs time (ms) in this.

Regards, Abhishek