[FieldTrip] Problem with ft_timelockstatistics, within subject comparison of two conditions
barbara.schorr at uni-ulm.de
barbara.schorr at uni-ulm.de
Tue Oct 7 15:42:53 CEST 2014
Dear fieldtripers,
I would like to compare to conditions of an auditory oddball paradigm
(target tones and standard tones).
For the identification of the electrodes which show the biggest P300,
I would like to use cluster based permutation test, i.e. I want to use
ft_timelockstatistics, to identify the clusters with a significant
difference between the target and the standardtones.
Important: I don't want to do a group statistic, but I want to compare
these two conditions within each subject, to identify interesting
clusters for each subject separately.
I wrote the script following the tutorials on the fieldtrip homepage.
I already wrote a code but it does not work:
%%
for i = 3:10 % subject number
mypfad = 'G:\BackUp07.07.14_DatenPrepr\Daten1\P300'
cd(mypfad)
cd Kontrollen;
List = dir
cd (List(i).name);
for j = 1:4 %session number
cd (mypfad);
cd Kontrollen;
List = dir
cd (List(i).name);
eval(['cd M' num2str(j)]);
load cleandata_tlt; %preprocessed timelocked data
standardclean_tlt and targetclean_tlt
cfg = []
cfg.neighbourdist = .09;
cfg.layout= ulmegilay;
cfg.method = 'distance';
Neighbours = ft_prepare_neighbours(cfg, standardclean_tlt)
cfg = []
cfg.method = 'montecarlo' ; %significance probability
cfg.statistic = 'ft_statfun_depsamplesT'
cfg.correctm = 'cluster'
cfg.clusteralpha = 0.05 %alpha level of the sample specific
test statistic that will
% be used for thresholding
cfg.clusterstatistic = 'maxsum'
cfg.minnbchan = 4
cfg.latency = [0.25 0.8]
cfg.neighbours = Neighbours
cfg.tail = 0
cfg.clustertail = 0
cfg.alpha = 0.025
cfg.numrandomization = 1000
design = [ones(size(targetclean_tlt.trial,1),1);
2*ones(size(standardclean_tlt.trial,1),1)]';
design([1:size(targetclean_tlt.trial)
1:size(standardclean_tlt.trial,1)])
cfg.design = design
cfg.ivar = [ones(size(targetclean_tlt.trial,1),1);
2*ones(size(standardclean_tlt.trial,1),1)]'
cfg.uvar = [1:size(targetclean_tlt.trial)
1:size(standardclean_tlt.trial,1)]
tlt_statsnew = ft_timelockstatistics(cfg, targetclean_tlt,
standardclean_tlt )
cd 'G:\BackUp07.07.14_DatenPrepr\Daten1\P300';
cd Kontrollen;
List2 = dir
cd (List2(i).name);
eval(['cd M' num2str(j)]);
save statnew tlt_statsnew
end
end
This is what gets displayed while running the script:
selected 245 channels
selected 139 time bins
selected 1 frequency bins
using "ft_statistics_montecarlo" for the statistical testing
using "ft_statfun_depsamplesT" for the single-sample statistics
constructing randomized design
total number of measurements = 189
total number of variables = 1
number of independent variables = 189
number of unit variables = 189
number of within-cell variables = 0
number of control variables = 0
using a permutation resampling approach
Then, this error occurs:
Error using resampledesign (line 168)
A within-units shuffling requires a at least one unit variable and at least
one independent variable
Error in ft_statistics_montecarlo (line 241)
resample = resampledesign(cfg, design);
Error in statistics_wrapper (line 310)
[stat, cfg] = statmethod(cfg, dat, design);
Error in ft_timelockstatistics (line 113)
[stat, cfg] = statistics_wrapper(cfg, varargin{:});
I have no clue where I made a mistake. I have unit variables and
independent variables (189 if I understand it correctly).
Is there anything I am missing? Any additional information or is the
design matrix wrong?
I really appreciate your help.
Best regards,
Barbara
Barbara Schorr, MSc
Clinical and Biological Psychology
University of Ulm
Albert-Einstein-Allee 47
89069 Ulm
More information about the fieldtrip
mailing list