[FieldTrip] Design matrix for depsamplesregrT within subject

Antonius Wiehler antonius.wiehler at gmail.com
Fri Dec 21 21:01:53 CET 2018

I have two questions about correctly specifying the design matrix for

It is a within-subject experimental design, where I want to test the
(linear) effect of time. So, per subject, I have 5 consecutive sessions,
with ~170 trials each. In the time-frequency domain, I would like to test
if power is changing with session. For group statistics, I did the

1) Compute per subject and session the mean with ft_freqdescriptives,
because I don't have enough memory to work with single trial data.

2) Testing the session effect with a dependent samples regression

    % parameters for test
    cfg = [];
    cfg.parameter           = 'powspctrm';
    cfg.latency             = 'all';
    cfg.method              = 'montecarlo';
    cfg.statistic           = 'depsamplesregrT';
    cfg.correcttail         = 'prob';
    cfg.tail                = 0;
    cfg.alpha               = 0.05;
    cfg.numrandomization    = 500;
    cfg.correctm            = 'cluster';
    cfg.clusteralpha        = 0.05;
    cfg.clusterstatistic    = 'maxsum';
    cfg.clusterthreshold    = 'nonparametric_common'; % method for
single-sample threshold
    cfg.clustertail         = 0;
    cfg.minnbchan           = 3;
    cfg.wcm_weight          = 1;

    %design matrix
    design       = zeros(2, n_sessions*n_subjects);
    design(1, :) = repmat(1:n_subjects, 1, n_sessions);  % subject
    design(2, :) = repelem(1:n_sessions, n_subjects);  % session

    cfg.design              = design;
    cfg.uvar                = 1;  % which row is the unit variable, here
    cfg.ivar                = 2;  % which row is the independent variable,
here sessions

    %generate stats from two cell arrays of full fieldtrip "data" structures
    stat = ft_freqstatistics(cfg, session1{:}, session2{:}, session3{:},
session4{:}, session5{:});

This leads to a significant cluster.

Now, I would like to test if the effect is significant in every single
subject. So I thought I would just set n_subjects to 1 and could use the
same approach. However, I get an error saying that I need as least two
subjects (uvar).

I'm wondering what is the right way to set this up. An indepsamplesregrT is
running fine, but I think the data is still depended, as it is from one

Second, I would like to test the conjunction, i.e. finding a cluster that
is overlapping between subjects and significant within *every* single
subject. How could I do this in Fieldtrip?

Thanks a lot for your help in advance!

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20181221/91d58b12/attachment-0001.html>

More information about the fieldtrip mailing list