[FieldTrip] calculating correlation

Gio Piantoni g.piantoni at nin.knaw.nl
Mon Jul 2 19:39:16 CEST 2012

Hi Ingrid,

You're trying to test two very different things.
1) power-behavior correlation over trials, and differences between
subjects are just unexplained variance.
2) power-behavior correlation across subjects.

For 2) problem, I don't have anything to add to what Jan-Mathijs said.
Correlation/GLM is very easy outside Fieldtrip but I hope Jan-Mathijs
will include the GLM functions, it sounds very cool. For your
"repeated questionnaires", I'd use a summary score (difference score
for example) and do a simple correlation.

For 1) problem, you could do a 2-level analysis, like SPM does for
fMRI data: 1- you do correlation at the single-subject level, 2- you
do a t-test on the slope (or your GLM column of interest), to test if
it's different from zero. I don't know of Fieldtrip tools for this but
I don't like this approach too much, because you lose quite some power
and you don't model the trial-level noise.
I've had some success using linear mixed-effects models for these
types of research questions. There is the package lme4 in R which is
very powerful. The only pain is to export data from Matlab and read
them in R. You can get t-values from the linear mixed-effects models
for each electrode/time point/freq point (unless you average over some
dimension). Then you can use the cluster-level correction as
implemented in Fieldtrip by flipping the sign of the t-statistics.
There is some learning to do to use linear mixed-effects models but
there are very flexible.
Let me know if you need help with that. You can bribe me with the same
things Jan-Mathijs likes...

Hope this helps,


Giovanni Piantoni, MSc
Dept. Sleep & Cognition
Netherlands Institute for Neuroscience
Meibergdreef 47
1105 BA Amsterdam (NL)

+31 20 5665492
gio at gpiantoni.com

On Sun, Jul 1, 2012 at 9:15 PM, Ingrid Nieuwenhuis
<inieuwenhuis at berkeley.edu> wrote:
> Hi FTers,
> I'd like to do two sorts of correlation calculations, and was  wondering if
> there's any easy way to do this within FieldTrip.
> 1) I'd like to calculate the correlation between performance over trials and
> power within a specific frequency over trials. So I have the performance
> measure per trial, and my chan*freq measure after freqanalysis. So for each
> channel I have a series of power values (trials) and I have a series of
> performance measures (per trial), and now like to know (first within, and
> then over subjects) which channel's frequency power follows (correlates)
> with the performance.
> From the walkthrough I understand I can give in these performance measures
> through the design (cfg.design = [0.1 0.2 0.3 0.4 0.5 0.4 0.3 0.1 0.2];
> cfg.ivar= 1;), but which method to use for ft_freqstatistics? I don't see
> statistics = 'correlation' or 'pearson' or 'spearman' in method = 'analytic.
> Also how to make the design to correlate over trials?
> 2) I'd like to calculate the correlation between the score on repeated
> questionnaire over participants with power within a frequency. So I have
> several power values per participant for each channel, and the repeated
> scores on the questionnaire for each participant. And now I'd like to
> calculate a value per channel reflecting the correlation over the repeats of
> the questionnaire and over participants.
> Any idea on FieldTrip settings? Both in general, is there a correlation
> statistics implemented, and more specifically for my question, how would I
> make the appropriate designs?
> Thanks so much!
> Ingrid
> --
> Ingrid Nieuwenhuis PhD
> Postdoctoral Fellow
> Sleep and Neuroimaging Laboratory
> Department of Psychology
> University of California, Berkeley
> California 94720-1650
> Tolman Hall, room 5305
> _______________________________________________
> fieldtrip mailing list
> fieldtrip at donders.ru.nl
> http://mailman.science.ru.nl/mailman/listinfo/fieldtrip

More information about the fieldtrip mailing list