[FieldTrip] Issue with independent samples design matrix in ft_timelockstatistics

Anne Koopman koopman.anne at gmail.com
Tue Jul 30 17:14:09 CEST 2019


Hi Tara,

Thank you, removing that line solved everything and the code ran smoothly
afterwards!

I used an independent samples t-test because I was following the tutorial
and that's what was used there, but now that you mention it a dependent may
be more appropriate. It's indeed the same participant doing each condition.
In the end I don't think it matters much in this case. I was trying to see
if each participant individually had a significant ERP, and exclude the
participants that didn't have this. However, in the end only 1 out of 25
people had it, so I will not be using it for this purpose after all.

Thanks for all your help,
Anne

On Mon, Jul 29, 2019 at 1:31 PM Tara van Viegen <taravanviegen at gmail.com>
wrote:

Hi Anne,

I think this happens because your design matrix uses the trials of the
different conditions, but the parameter you give timelockstats in 'avg'
(i.e. the ERP).

May I  ask why you are using independent samples t-stats? I would expect
that the participant participating in each condition is the same?

Best,
Tara

On Mon, Jul 29, 2019 at 1:03 PM Anne Koopman <koopman.anne at gmail.com> wrote:

> Dear Fieldtrip community,
>
> My name is Anne Koopman and I'm doing a PhD in Penny Lewis's lab in
> Cardiff. I focus on targeted memory reactivation during sleep, which is a
> fancy way of saying I play memory-related sounds to people while they
sleep
> in our lab and I hope their brain responds in some way. During the
> experiment I'm trying to analyse here I played two types of sounds to
> people: experimental (i.e. memory-related) and control. I'm trying to find
> out whether there is a difference in the ERP response to these two
> different types of sounds. I've already successfully done this on a group
> level, but now I'm trying to look at each participant separately on a
> between-trial level.
>
> I've followed the example code for between-trials experiments in the
> tutorial "Cluster-based permutation tests on event related fields" (link:
> http://www.fieldtriptoolbox.org/tutorial/cluster_permutation_timelock/).
> I'm following the tutorial exactly, including the specification of the
> design matrix (though substituting my own variable names, of course). I
get
> the following error message:
>
> Error using ft_timelockstatistics (line 168)
> the length of the design matrix (1) does not match the number of
> observations in the data (2)
>
> It looks like during that step in ft_timelockstatistics the data consists
> of two columns (one for each sound type?), whereas the design matrix only
> has one. I can see where it goes wrong, but I don't have enough insight
> into Fieldtrip to understand why and how to fix it. I tried adding a
second
> column in the design matrix with the trial numbers as a uvar, but
> predictably this gave me an error saying:
> Error using ft_statfun_indepsamplesT (line 74)
> cfg.uvar should not exist for an independent samples statistic
>
> The cfg and data I use are as follows: (note that there is also a
> corresponding data struct called ERP_ctrl which looks exactly the same as
> ERP_exp except for the fact that it has 204 trials instead of 215).
>
> >> display(cfg)
>
> cfg =
>
>   struct with fields:
>
>              channel: {'F4'  'Fz'  'F3'}
>           neighbours: [1×13 struct]
>              latency: [0 2]
>          avgovertime: 'no'
>            parameter: 'avg'
>               method: 'montecarlo'
>            statistic: 'ft_statfun_indepsamplesT'
>                alpha: 0.0500
>             correctm: 'cluster'
>          correcttail: 'alpha'
>                 tail: 0
>          clustertail: 0
>     numrandomization: 200
>            minnbchan: 0
>               design: [1×419 double]
>                 ivar: 1
>
> >> display(ERP_exp)
>
> ERP_exp =
>
>   struct with fields:
>
>           avg: [18×2500 double]
>           var: [18×2500 double]
>          time: [1×2500 double]
>           dof: [18×2500 double]
>         label: {18×1 cell}
>         trial: [215×18×2500 double]
>        dimord: 'rpt_chan_time'
>          elec: [1×1 struct]
>     trialinfo: [215×1 double]
>           cfg: [1×1 struct]
>
> I've uploaded my data and the script that I use here:
> https://we.tl/t-aOiKBh6fO7
>
> Sorry for the long email! I hope I've described everything clearly and I
> really appreciate any insight that you could give. I should note, I'm
using
> Matlab R2016b with Fieldtrip version 03/04/2017.
>
> Thanks in advance for your help,
> Anne
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20190730/687a9236/attachment-0002.html>


More information about the fieldtrip mailing list