Hi there,
I am trying to use ft_sourcestatistics on volumetric data with the following MATLAB Preformatted textscript
data link: dataFT.mat
script:
load dataFT.mat
% build the experimental design and analysis parameters
cfg = [];
cfg.dim = FT{1}.dim;
cfg.method = 'montecarlo';
cfg.statistic = 'ft_statfun_depsamplesFunivariate';
cfg.parameter = 'mom';
cfg.clusterthreshold = 'nonparametric_common';
cfg.correctm = 'cluster';
cfg.computecritval = 'yes';
cfg.numrandomization = 1000;
cfg.tail = 0; % Two sided testing
cfg.clustertail = cfg.tail;
cfg.correcttail = 'alpha'; % basically bonferroni correction
cfg.alpha = 0.05;
cfg.computeprob = 'yes';
% design matrix
nsubj = numel(unique(FT(:,2)));
nrows = numel(FT(:,1));
cfg.design = zeros(3,nrows);
% subject id
cfg.design(1,:) = repelem([1:nsubj],nrows/nsubj);
% Stim: real, sham
cfg.design(2,:) = repmat(repelem([1:2],2),1,nrows/4);
% order: pre, post
cfg.design(3,:) = repmat([1:2],1,nrows/2);
% maybe flip it?
% cfg.design = cfg.design';
% row of design matrix that contains unit variable (subjects)
cfg.uvar = 1;
% row of design matrix that contains within-cell variables
cfg.wvar = 2;
% row of design matrix that contains independent variable
cfg.ivar = 3;
% source statistic analysis
[stat] = ft_sourcestatistics(cfg, FT{:,1});
but I get the error:
Error using resampledesign (line 153)
the design matrix variables should be constant within a block
I think my design matrix is fine, because I have 52 participants with 2 within-subject factors.
I really appreciate your helP!