[FieldTrip] design matrix for cluster-based permutation testing
Eelke Spaak
e.spaak at donders.ru.nl
Mon Aug 10 10:49:17 CEST 2020
Dear Carolina,
I think your 2nd try should work as far as cfg.design is concerned,
but I suspect the problem lies with the way your data is structured.
What type are DS_GA_induc_gamma.cond_A etc.? The easiest would be to
collect all the data structures (1 per subject, per condition, so 85
total) in a big cell array "alldata" or so, and call
ft_freqstatistics(cfg, alldata{:}). If your type of your
DS_GA_induc_gamma.cond_A etc. already are cell arrays, the change you
need might be as easy as adding {:} after each of the input arguments
into ft_freqstatistics.
Best,
Eelke
On Tue, 4 Aug 2020 at 17:44, Carolina Ogawa <carolyogawa at gmail.com> wrote:
>
> Dear community,
>
> I'm having trouble defining the design matrix ("cfg.design") to perform a cluster-based permutation testing.
>
> There are 17 subjects (1 group only) and 5 conditions in my dataset.
> My data is organized in the "DS_GA_induc_gamma" data structure, and the 5 conditions to be compared are organized within the data structure as "DS_GA_induc_gamma.cond_A", "DS_GA_induc_gamma.cond_B", "DS_GA_induc_gamma.cond_C", "DS_GA_induc_gamma.cond_D", "DS_GA_induc_gamma.cond_E"
>
> My code is as follows:
>
> cfg = [];
> cfg.statistic = 'ft_statfun_depsamplesFunivariate';
> cfg.method = 'montecarlo';
> cfg.correctm = 'cluster';
> cfg.clusteralpha = 0.05;
> cfg.clusterstatistic = 'maxsum';
> cfg.minnbchan = 0;
> cfg.tail = 0;
> cfg.clustertail = 0;
> cfg.alpha = 0.025;
> cfg.numrandomization = 1000;
> cfg_neighb.method = 'triangulation';
> cfg_neighb.layout = 'acticap-64ch-standard2.mat';
> cfg.neighbours = ft_prepare_neighbours(cfg_neighb, DS_GA_induc_gamma.cond_A);
> cfg.design = See below
> cfg.uvar = 1;
> cfg.ivar = 2;
>
> induc_gamma_diff = ft_freqstatistics(cfg, DS_GA_induc_gamma.cond_A, DS_GA_induc_gamma.cond_B,...
> DS_GA_induc_gamma.cond_C, DS_GA_induc_gamma.cond_D, DS_GA_induc_gamma.cond_E);
>
> So far, I've tried the following "cfg.design" definitions and have got the following errors:
>
> 1st try:
>
> cfg.design = [1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1;...
>
> 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2;...
>
> 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3;...
> 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4;...
> 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5];
>
> Output:
>
> constructing randomized design
> total number of measurements = 5
> total number of variables = 17
> number of independent variables = 1
> number of unit variables = 1
> number of within-cell variables = 0
> number of control variables = 0
> using a permutation resampling approach
> repeated measurement in variable 1 over 5 levels
> number of repeated measurements in each level is 1 1 1 1 1
> computing a parametric threshold for clustering
> Error using ft_statfun_depsamplesFunivariate (line 94)
> Invalid specification of the design array.
> Error using ft_statistics_montecarlo (line 244)
> could not determine the parametric critical value for clustering
>
> Error in ft_freqstatistics (line 191)
> [stat, cfg] = statmethod(cfg, dat, design);
>
>
> 2nd try:
> cfg.design =
>
> Columns 1 through 22
> 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 1 2 3 4 5
> 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2
>
> Columns 23 through 44
> 6 7 8 9 10 11 12 13 14 15 16 17 1 2 3 4 5 6 7 8 9 10
> 2 2 2 2 2 2 2 2 2 2 2 2 3 3 3 3 3 3 3 3 3 3
>
> Columns 45 through 66
> 11 12 13 14 15 16 17 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
> 3 3 3 3 3 3 3 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4
>
> Columns 67 through 85
> 16 17 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
> 4 4 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5
>
>
> Output:
>
> Error using ft_freqstatistics (line 178)
> the length of the design matrix (2) does not match the number of observations in the data (5)
>
>
>
> Can anyone help me with this, please?
>
> Also, is there any problem comparing substructures of a data structure using "ft_freqstatistics" the way I'm doing?
>
>
> Thank you,
> Carolina Ogawa
> _______________________________________________
> fieldtrip mailing list
> https://mailman.science.ru.nl/mailman/listinfo/fieldtrip
> https://doi.org/10.1371/journal.pcbi.1002202
More information about the fieldtrip
mailing list