# [FieldTrip] calculating behavioural-power correlation

Frédéric Roux f.roux at bcbl.eu
Wed Feb 18 10:15:57 CET 2015

```Hello Hweeling,

Cheers,
Fred

Frédéric Roux

----- Original Message -----
From: "Hwee Ling Lee" <hweeling.lee at gmail.com>
To: "Frédéric Roux" <f.roux at bcbl.eu>
Cc: "FieldTrip discussion list" <fieldtrip at science.ru.nl>, "arjen stolk" <arjen.stolk at donders.ru.nl>
Sent: Wednesday, February 18, 2015 8:58:51 AM
Subject: Re: [FieldTrip] calculating behavioural-power correlation

Dear Frederic,

>From my limited understanding, the way you specify your design matrix seems correct to me. I did the same thing as well, however, I was not interested in the correlation along the time dimension, and I averaged some frequencies to examine my behavioural-power change correlation with specific frequency bands (e.g. 2 - 4 Hz for Delta band, 4 - 8 Hz for Theta band, etc).

I think the main reason for the long computation time of your design matrix is because the statistics is calculating the correlation for every frequency and every time point and every channel. You should probably ask yourself if the behavioural is going to change along the time dimension. If not, then probably averaging across time might be a good idea, or pick a time period that you hypothesized to be most sensitive to your behavioural measure. Also, I would suggest to look into some specify frequency bands based on your hypothesis, and averaged across a specified frequency band would shorten your computation time.

I hope this helps.

Cheers,
Hweeling

On 17 February 2015 at 18:03, Frédéric Roux < f.roux at bcbl.eu > wrote:

Dear Arjen, dear Hweeling,

I would be interested in trying this method as well.

May I ask you how to specify the design matrix?

For instance if I want to measure the correlation between a TFR-matrix
and some behavioral measure (Y) across participants would something like
this make sense:

AVG =
powspctrm:[4-D double]
label:{186x1 cell}
freq:[1x49 double]
time:[1x121 double]
dimord: 'subj_chan_freq_time'
cfg:[1x1 stuct]

dum = AVG;
dum.powspctrm = repmat(Y,[1 size(AVG.powspctrm,2) size(AVG.powspctrm,3) size(AVG.powspctrm,4)]);
%here Y is a vector with the behavioral measure

cfg = [];
cfg.method = 'montecarlo';
cfg.parameter = 'powspctrm';
cfg.statistic = 'ft_statfun_correlationT';
etc

cfg.design = [];
cfg.design(1,:) = [ones(1,lenght(Y)) 2*ones(1,length(Y))];
cfg.design(2,:) = [1:length(Y) 1:length(Y)];

freq_stat = ft_freqstatistica(cfg,AVG,dum);

This, however, results in extremely long computing times, which makes me
doubt that this is the correct way.

Best,

Fred

Frédéric Roux

----- Original Message -----
From: "Hwee Ling Lee" < hweeling.lee at gmail.com >
To: "arjen stolk" < arjen.stolk at donders.ru.nl >
Cc: "FieldTrip discussion list" < fieldtrip at science.ru.nl >
Sent: Tuesday, February 17, 2015 5:39:29 PM
Subject: Re: [FieldTrip] calculating behavioural-power correlation

Thanks! One last question, just to be sure, what is the reference for this correlation method? I tried to search for your publications but not sure which one to cite.

Cheers,
Hweeling

On 17 February 2015 at 16:44, arjen stolk < a.stolk8 at gmail.com > wrote:

Yes it does. ;)
Arjen

-------- Oorspronkelijk bericht --------
Van: Hwee Ling Lee < hweeling.lee at gmail.com >
Datum:
Aan: "Stolk, A. (Arjen)" < a.stolk at donders.ru.nl >
Cc: FieldTrip discussion list < fieldtrip at science.ru.nl >
Onderwerp: Re: [FieldTrip] calculating behavioural-power correlation

Dear Arjen,

Thanks! It works well now.

I plotted the results using ft_clusterplot, and it only shows the significant clusters that show significant correlation of power and behavioural measure, right? Or is there a better way I can display the results?

Thanks again.

Cheers,
Hweeling

On 17 February 2015 at 11:45, Stolk, A. (Arjen) < a.stolk at donders.ru.nl > wrote:

Hey Hweeling,

"Just to ensure that I get this right, I should create a variable for the behavioural measure such that the variable contains a powspctrm field with the behavioural information for every frequency?"
> indeed

"What I'm confused is that in the walkthrough website, under the subsection on correlation, it is suggested to create the cfg.design with the behavioural measure that one wants to correlate. So is this information in the walkthrough website incorrect?"
> the walkthough may refer to a GLM-based statistical implementation, for which the FT implementation differs from the correlationT statfun. Namely, the former uses the behavioral measure as a regressor in a data model whereas the latter uses the behavioral measure as a datapoint series for correlation with another datapoint series (and then converts to a T value). The correlationT statfun is relatively 'new', hence not yet addressed in the walkthrough.

Yours,
arjen

From: fieldtrip-bounces at science.ru.nl [ fieldtrip-bounces at science.ru.nl ] on behalf of Hwee Ling Lee [ hweeling.lee at gmail.com ]
Sent: Tuesday, February 17, 2015 11:34 AM
To: FieldTrip discussion list

Subject: Re: [FieldTrip] calculating behavioural-power correlation

Dear Arjen,

Thanks for the prompt reply again!

Just to ensure that I get this right, I should create a variable for the behavioural measure such that the variable contains a powspctrm field with the behavioural information for every frequency?

What I'm confused is that in the walkthrough website, under the subsection on correlation, it is suggested to create the cfg.design with the behavioural measure that one wants to correlate. So is this information in the walkthrough website incorrect?

Cheers,
Hweeling

On 17 February 2015 at 11:23, Stolk, A. (Arjen) < a.stolk at donders.ru.nl > wrote:

Hey Hweeling,

It seems you're only inserting one input variable into the statistics function, i.e. " [c200_delta_stat] = ft_freqstatistics(cfg, sub_LF_c200{:});"

Could you try something along this line: ft_freqstatistics(cfg, freq1, freq2)

where freq1 is the original freq data, and freq2 is a copy of freq but with the relevant values (say, in powspctrm) replaced with behavior values (ensure this behavior matrix is matched in terms of size and dimensions to the original freq values).

Hope this helps,
Arjen

--
Donders Institute for Brain, Cognition and Behaviour
Centre for Cognitive Neuroimaging

Email: a.stolk at donders.ru.nl
Phone: +31 (0)243 68294
Web: www.arjenstolk.nl

From: Hwee Ling Lee [ hweeling.lee at gmail.com ]
Sent: Tuesday, February 17, 2015 10:33 AM
To: Stolk, A. (Arjen)
Cc: FieldTrip discussion list
Subject: Re: [FieldTrip] calculating behavioural-power correlation

Dear Arjen,

Thanks for the prompt reply. I keep getting an error message when I set up my correlation cluster statistics, and I'm not sure what I could have done wrong. Here's my script:

cfg = [];
cfg.layout = 'EEG1010.lay';
cfg.neighbours = neighbours;
cfg.channel = 'all';
cfg.latency = 'all';
cfg.avgovertime = 'no';
cfg.avgoverchan = 'no';
cfg.avgoverfreq = 'yes';
cfg.parameter = 'powspctrm';
cfg.method = 'montecarlo';
cfg.statistic = 'ft_statfun_correlationT';
cfg.correctm = 'cluster';
cfg.clusteralpha = 0.05;
cfg.clusterstatistics = 'maxsum';
cfg.minnbchan = 2;
cfg.tail = 0;
cfg.clustertail = 0;
cfg.alpha = 0.025;
cfg.numrandomization = 1000;
cfg.ivar = 1;
cfg.uvar = 1;

% design matrices
clear design;
% change in MMSE score relative to baseline
design(1,:) = [0.095238095 -0. 045454545 - 0 .533333333 0.238095238 -0.157894737 0.117647059];

design(2,:) = 1:6;
cfg.design = design;

% for delta band
cfg.frequency = [2 4];
[c200_delta_stat] = ft_freqstatistics(cfg, sub_LF_c200{:});
[c210_delta_stat] = ft_freqstatistics(cfg, sub_HF_c210{:});

Here's the output from Matlab:

computing statistic over the frequency range [2.000 4.000]
the call to "ft_appendfreq" took 0 seconds
the call to "ft_selectdata" took 0 seconds
using "ft_statistics_montecarlo" for the statistical testing
using "ft_statfun_correlationT" for the single-sample statistics
constructing randomized design
total number of measurements = 6
total number of variables = 2
number of independent variables = 1
number of unit variables = 1
number of within-cell variables = 0
number of control variables = 0
using a permutation resampling approach
repeated measurement in variable 1 over 6 levels
number of repeated measurements in each level is 1 1 1 1 1 1
computing a parametric threshold for clustering
Error using ft_statfun_correlationT (line 90)
Invalid specification of the design array.
Error using ft_statistics_montecarlo (line 254)
could not determine the parametric critical value
for clustering

Error in ft_freqstatistics (line 319)
[stat, cfg] = statmethod(cfg, dat, cfg.design);

Would you please tell what I have done wrong in this case?

Thanks!

Cheers,
Hweeling

On 17 February 2015 at 10:18, Stolk, A. (Arjen) < a.stolk at donders.ru.nl > wrote:

Hi Hweeling,

Have a look at the help of ft_statfun_correlationT, which might be the function you're looking for. This function calculates correlations between two variables (e.g. subjects' behaviors and brain activities) and converts the resulting correlation coefficients to t-statistics.

Best,
arjen

--
Donders Institute for Brain, Cognition and Behaviour
Centre for Cognitive Neuroimaging

Email: a.stolk at donders.ru.nl
Phone: +31 (0)243 68294
Web: www.arjenstolk.nl

From: fieldtrip-bounces at science.ru.nl [ fieldtrip-bounces at science.ru.nl ] on behalf of Hwee Ling Lee [ hweeling.lee at gmail.com ]
Sent: Tuesday, February 17, 2015 10:06 AM
To: FieldTrip discussion list
Subject: [FieldTrip] calculating behavioural-power correlation

Dear all,

I read on the "walkthrough" that it is possible to calculate behavioural-power correlation across subjects. However, I was not sure what type of descriptive statistics (i.e. cfg.statistics) I should use when performing correlation cluster statistics.

Would someone please enlighten me which type of statistics I should input for cfg.statistics?

Thanks!

Best regards,
Hweeling

_______________________________________________
fieldtrip mailing list
fieldtrip at donders.ru.nl
http://mailman.science.ru.nl/mailman/listinfo/fieldtrip

--

=================================================
Dr. rer. nat. Lee, Hwee Ling
Postdoc
German Center for Neurodegenerative Diseases (DZNE) Bonn

Email 1: hwee-ling.lee<at> dzne.de
Email 2: hweeling.lee<at> gmail.com

Ernst-Robert-Curtius Strasse 12, 53117, Bonn, Germany
=================================================

--

=================================================
Dr. rer. nat. Lee, Hwee Ling
Postdoc
German Center for Neurodegenerative Diseases (DZNE) Bonn

Email 1: hwee-ling.lee<at> dzne.de
Email 2: hweeling.lee<at> gmail.com

Ernst-Robert-Curtius Strasse 12, 53117, Bonn, Germany
=================================================

_______________________________________________
fieldtrip mailing list
fieldtrip at donders.ru.nl
http://mailman.science.ru.nl/mailman/listinfo/fieldtrip

--

=================================================
Dr. rer. nat. Lee, Hwee Ling
Postdoc
German Center for Neurodegenerative Diseases (DZNE) Bonn

Email 1: hwee-ling.lee<at> dzne.de
Email 2: hweeling.lee<at> gmail.com