[FieldTrip] Issue with independent samples design matrix in ft_timelockstatistics

Tara van Viegen taravanviegen at gmail.com
Mon Jul 29 19:31:28 CEST 2019


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
>
> _______________________________________________
> fieldtrip mailing list
> https://mailman.science.ru.nl/mailman/listinfo/fieldtrip
> https://doi.org/10.1371/journal.pcbi.1002202
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20190729/31b8d72e/attachment-0002.html>


More information about the fieldtrip mailing list