Significance test frequency power decrease baseline vs stimulation

jan-mathijs schoffelen j.schoffelen at PSY.GLA.AC.UK
Thu Jun 26 10:36:30 CEST 2008


Dear Thomas,

It's hard to say what's going wrong, but I would suggest a different  
approach in the first place. I could imagine that you are interested  
in the first place whether there's a difference in activation vs.  
baseline, and not so much in the moment in time that this occurs.  
Then the player of my choice would be freqanalysis_mtmfft. In that  
case you collapse over the time dimension, and increase your  
statistical power. Importantly, using either approach, I believe it  
is mandatory to use equal length trials in both 'conditions'. I don't  
believe this causes your error message but I see that you use  
different length trials and will lead to problems when the current  
problem is fixed and you proceed in the function.
As I said I would try to run freqanalysis with cfg.method = 'mtmfft'.  
As Nathan pointed out, it is mandatory to do cfg.keeptrials = 'yes',  
otherwise you cannot do any statistics. (This is also the case when  
you would use mtmconvol). This is a very important notion. Otherwise  
it would just suffice to look at the difference of the averages. The  
fact that you want to compute a T-value implies that you want to take  
the variance across trials into account, and therefore you need  
'keeptrials' = 'yes' (This could very well be the cause of your  
problem). Then I would call freqstatistics with either cfg.statistic  
= 'depsamplesT' (when you have paired observations) or  
cfg.statistic='indepsamplesT' (when the observations are unpaired).

As a sidestep, when encountering errors in general, it might make  
sense to use matlab's debugging functionality. When you type on the  
commandline 'dbstop if error' before running your analysis script,  
matlab enters the debugging mode when an error is encountered. This  
means that you stick to the local workspace of the function in which  
the error occurred, and you can see what is going wrong. In your case  
apparently there is no variable called data present in the workspace  
for the function prepare_design. You can toggle up and down between  
the calling functions by using dbup and dbdown. This usually gives  
useful information and points to the core of the problem. This can be  
both handy for yourself (you might be able to solve the problem  
yourself) or for anybody trying to help from a distance.

Anyway, something seems to go wrong in prepare_design. I'd rather fix  
this if I were you, but you could also see whether you can bypass  
this problem when specifying a design in your configuration for  
freqstatistics. This will bypass the function prepare_design  
altogether. There is some information on the fieldtrip wiki in the  
tutorial about cluster-based permutation tests. You could also type  
help prepare_design in the matlab commandline.

I hope this helps,

Jan-Mathijs


On Jun 26, 2008, at 9:29 AM, Thomas Dijkman wrote:

> Hi,
>
> I'm currently in the pilot phase, testing various stimuli on myself  
> and my supervisor. I want to do this analysis to get an indication  
> which stimulus has the best potential, so I can test that on a  
> sufficient large group.
>
> The data I'm testing the statistical analysis script on consists of  
> 50 trials, the subject was asked to perform motor imagery while  
> looking at the screen. Each trial consists of 3 seconds baseline  
> (empty background on screen) and 5 seconds stimulus ( hand  
> squeezing a ball on screen).
> I don't need the TFR's of the individual trials, since the mean TFR  
> will (that's what I expect) show a more prominent in power in the  
> 8-13 Hz band when I compare baseline vs stimulus.
>
> The error message I get when I run the script now is:
>
> ??? Undefined variable "data" or class "data.biol".
>
> Error in ==> prepare_design at 92
>   nrepl=size(data.biol,1);
>
> Error in ==> statistics_wrapper at 238
>   [cfg] = prepare_design(cfg);
>
> Error in ==> freqstatistics at 132
> [stat] = statistics_wrapper(cfg, varargin{:});
>
> Error in ==> fieldtripstatanalyse at 36
> [stat] = freqstatistics(cfg, stimulusTFR, baselineTFR);
>
> Thanks for your input,
>
> Thomas
>
>
> -----Oorspronkelijk bericht-----
> Van: FieldTrip discussion list namens Nathan Weisz
> Verzonden: do 26-6-2008 8:45
> Aan: FIELDTRIP at NIC.SURFNET.NL
> Onderwerp: Re: [FIELDTRIP] Significance test frequency power  
> decrease baseline vs stimulation
>
> hi,
>
> you want individual subject stats? i'm pretty sure then that you need
> to add something like
> cfg.keeptrials='yes';
> when doing your freqanalysis.
>
> btw, adding the actual error message is also a good idea when posting
> questions.
>
> good luck,
> n
>
>
> On 26.06.2008, at 00:09, Thomas Dijkman wrote:
>
>> Hi,
>>
>> For my bachelor's assignment, I'm trying to find a visual stimulus
>> of a hand
>> movement that triggers the 'largest' modulation of the EEG. I.e. ,
>> when the
>> subject looks at a right hand movement, literature suggest a
>> decrease in
>> power in the 8-13 Hz band, relative to a baseline period around
>> electrode
>> position C3.
>> I'm trying to use Fieldtrip's freqstatistics.m function to test this
>> decrease in power for significance. Following a tutorial in the
>> Fieldtrip wiki,
>> http://www2.ru.nl/fcdonders/fieldtrip/doku.php? 
>> id=fieldtrip:documentation:tutorial:statistics&s=freqstatistics#3.2_p 
>> ermutation_tests_for_time- 
>> frequency_representationswithin_trial_experiments
>>
>> which I thought applied to my situation gave me a lot of error
>> messages.
>>
>> I've already redefined my trials, so I have a separate set of
>> trials, one
>> containing 2 seconds of baseline, and one containing 2 seconds of
>> stimulus.
>> The baseline time axis is shifted so it overlaps the stimulus time
>> axis
>>
>> I then use this code to calculate TFR's for those datasets:
>>
>> cfgfreq.method = 'mtmconvol';
>> cfgfreq.output = 'pow' ;
>> cfgfreq.taper = ' hanning' ;
>> cfgfreq.foi = 8:1:13;
>> cfgfreq.t_ftimwin = 10./cfgfreq.foi;
>> cfgfreq.toi = 5:1/100:7;
>> cfgfreq.tapsmofrq = cfgfreq.foi*0.4;
>> [baselineTFR] = freqanalysis(cfgfreq,baselinedata);
>> [stimulusTFR] = freqanalysis(cfgfreq,stimulusdata);
>>
>> And then I have to do the significance test.
>>
>> cfg = [];
>> sfg.method = 'analytic';
>> cfg.statistics = 'actvsblT';
>> cfg.alpha = 0.05;
>> ?
>> [stat] = freqstatistics(cfg,stimulusTFR,baselineTFR);
>>
>> I think I have to do something with the design matrix, but I can't
>> find
>> anything about that in the wiki (or the rest of the internet).
>>
>> Thanks,
>>
>> Thomas
>>
>> ----------------------------------
>> The aim of this list is to facilitate the discussion between users
>> of the FieldTrip  toolbox, to share experiences and to discuss new
>> ideas for MEG and EEG analysis. See also http:// 
>> listserv.surfnet.nl/archives/fieldtrip.html
>>  and http://www.ru.nl/fcdonders/fieldtrip.
>
> --------------------------------
> Dr. Nathan Weisz
>
> INSERM - Unité 821
> Dynamique cérébrale et cognition
> Centre Hospitalier Le Vinatier, Bâtiment 452
> 95 Boulevard Pinel
> 69500 Bron, France
>
> Tel: ++33 - (0)4 - 7213 8915
> Email: nathan.weisz at inserm.fr
> Chat-AV: nathanweisz at mac.com
> Homepage: http://web.mac.com/nathanweisz
> Neurotree: http://neurotree.org/neurotree/tree.php?pid=8692
>
> Please avoid sending me Word or PowerPoint attachments.
> See http://www.gnu.org/philosophy/no-word-attachments.html
>
>
>
>
>
> ----------------------------------
> The aim of this list is to facilitate the discussion between users  
> of the FieldTrip  toolbox, to share experiences and to discuss new  
> ideas for MEG and EEG analysis. See also http://listserv.surfnet.nl/ 
> archives/fieldtrip.html and http://www.ru.nl/fcdonders/fieldtrip.
>
> ----------------------------------
> The aim of this list is to facilitate the discussion between users  
> of the FieldTrip  toolbox, to share experiences and to discuss new  
> ideas for MEG and EEG analysis. See also http://listserv.surfnet.nl/ 
> archives/fieldtrip.html and http://www.ru.nl/fcdonders/fieldtrip.

----------------------------------
The aim of this list is to facilitate the discussion between users of the FieldTrip  toolbox, to share experiences and to discuss new ideas for MEG and EEG analysis. See also http://listserv.surfnet.nl/archives/fieldtrip.html and http://www.ru.nl/fcdonders/fieldtrip.



More information about the fieldtrip mailing list