# [FieldTrip] calculating correlation

Ingrid Nieuwenhuis inieuwenhuis at berkeley.edu
Mon Jul 2 19:58:04 CEST 2012

Hi Gio!

Guys, where are the good old times of unconditional sharing between
scientists for the greater good? ;) Must be the economy...
Anyways, thanks! I'm just starting to learn R actually, I'll check out
the lme4. Might be useful to include some FieldTrip to R functionality.

I'll get in touch when I need help :)
Cheers,
Ingrid

On 7/2/2012 10:39 AM, Gio Piantoni wrote:
> 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,
>
> Gio
>

--
Ingrid Nieuwenhuis PhD
Postdoctoral Fellow
Sleep and Neuroimaging Laboratory
Department of Psychology
University of California, Berkeley
California 94720-1650
Tolman Hall, room 5305

More information about the fieldtrip mailing list