# [FieldTrip] calculating correlation

jan-mathijs schoffelen jan.schoffelen at donders.ru.nl
Mon Jul 2 08:53:51 CEST 2012

```Hi Ingrid,

This calls for a statfun_corr or even a statfun_glm! It so happens that I have some of these sitting on my hard drive. As you know I am fond of beer, chocolate and co-authorships, so I am sure we can strike a deal. I have not yet had the opportunity to contribute these statfuns to FieldTrip, but now I sense a win-win-win situation: win 1 is for me (beer/chocolate/co-authorships/etc), win 2 is for you (you can compute your statistic of interest) and win 3 for the community (where you test the code, write documentation on the wiki etcetc). How does that sound for a plan?

Cheers,

JM

On Jul 1, 2012, at 10:15 PM, Ingrid Nieuwenhuis 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

Jan-Mathijs Schoffelen, MD PhD

Donders Institute for Brain, Cognition and Behaviour,
Centre for Cognitive Neuroimaging,
Radboud University Nijmegen, The Netherlands

Max Planck Institute for Psycholinguistics,
Nijmegen, The Netherlands

J.Schoffelen at donders.ru.nl
Telephone: +31-24-3614793

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20120702/2a1a7512/attachment-0002.html>
```

More information about the fieldtrip mailing list