[FieldTrip] Problem with ft_timelockstatistics, within subject comparison of two conditions
Clara A. Scholl
clara.scholl at gmail.com
Tue Oct 7 15:55:36 CEST 2014
Dear Barbara,
Just three thoughts:
1) Should cfg.ivar and cfg.uvar both be single values, i.e. the dimension
of the design matrix that contains the independent and unit variables?
Then you'd have cfg.ivar=1 and cfg.uvar=2 (or vise versa, depending on the
design matrix).
2) I think the design matrix itself might be off, right now it just seems
to have dimensions of 1 x (# targets+standards). It should have a second
dimension which counts the # of trials, something like:
design(1,:) = [ones(size(targetclean_tlt.trial,1),1);
2*ones(size(standardclean_tlt.trial,1),1)]';
design(2,:)= ([1:size(targetclean_tlt.trial) 1:size(standardclean_tlt.trial
,1)])
3) Since this is a design where each trial is an observation, I think you
should be using indepsamplesT for cfg.statistic (the trials aren't paired
and there aren't necessarily identical #'s of trials for each condition.
What do you think?
Respectfully,
Clara
On Tue, Oct 7, 2014 at 9:42 AM, <barbara.schorr at uni-ulm.de> wrote:
> 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
>
>
>
> _______________________________________________
> fieldtrip mailing list
> fieldtrip at donders.ru.nl
> http://mailman.science.ru.nl/mailman/listinfo/fieldtrip
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20141007/64be64b4/attachment-0002.html>
More information about the fieldtrip
mailing list