<div dir="ltr">Dear Barbara,<div><br></div><div>Just three thoughts:</div><div><br></div><div>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).</div><div><br></div><div>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:</div><div><br></div><div><span style="font-family:arial,sans-serif;font-size:13px">design(1,:) = [ones(size(targetclean_tlt.</span><u style="font-family:arial,sans-serif;font-size:13px"></u><span style="font-family:arial,sans-serif;font-size:13px">tri</span><span style="font-family:arial,sans-serif;font-size:13px">al,1),1); 2*ones(size(standardclean_tlt.</span><u style="font-family:arial,sans-serif;font-size:13px"></u><span style="font-family:arial,sans-serif;font-size:13px">trial,1),1)]';</span><br style="font-family:arial,sans-serif;font-size:13px"><span style="font-family:arial,sans-serif;font-size:13px"> design(2,:)= ([1:size(targetclean_</span><u style="font-family:arial,sans-serif;font-size:13px"></u><span style="font-family:arial,sans-serif;font-size:13px">tlt</span><span style="font-family:arial,sans-serif;font-size:13px">.trial) 1:size(standardclean_tlt.</span><u style="font-family:arial,sans-serif;font-size:13px"></u><span style="font-family:arial,sans-serif;font-size:13px">trial</span><span style="font-family:arial,sans-serif;font-size:13px">,1)])</span><br></div><div><span style="font-family:arial,sans-serif;font-size:13px"><br></span></div><div><span style="font-family:arial,sans-serif;font-size:13px">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.</span></div><div><span style="font-family:arial,sans-serif;font-size:13px"><br></span></div><div><span style="font-family:arial,sans-serif;font-size:13px">What do you think? </span></div><div>Respectfully,</div><div>Clara</div><div class="gmail_extra"><div><div dir="ltr"><br></div></div>
<br><div class="gmail_quote">On Tue, Oct 7, 2014 at 9:42 AM,  <span dir="ltr"><<a href="mailto:barbara.schorr@uni-ulm.de" target="_blank">barbara.schorr@uni-ulm.de</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Dear fieldtripers,<br>
<br>
I would like to compare to conditions of an auditory oddball paradigm (target tones and standard tones).<br>
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.<br>
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.<br>
<br>
<br>
I wrote the script following the tutorials on the fieldtrip homepage.<br>
<br>
I already wrote a code but it does not work:<br>
%%<br>
<br>
for i = 3:10 % subject number<br>
    mypfad = 'G:\BackUp07.07.14_DatenPrepr\<u></u>Daten1\P300'<br>
    cd(mypfad)<br>
    cd Kontrollen;<br>
    List = dir<br>
    cd (List(i).name);<br>
    for j = 1:4 %session number<br>
        cd (mypfad);<br>
        cd Kontrollen;<br>
        List = dir<br>
        cd (List(i).name);<br>
        eval(['cd M' num2str(j)]);<br>
        load cleandata_tlt; %preprocessed timelocked data standardclean_tlt  and targetclean_tlt<br>
<br>
        cfg = []<br>
        cfg.neighbourdist = .09;<br>
        cfg.layout= ulmegilay;<br>
        cfg.method = 'distance';<br>
<br>
        Neighbours = ft_prepare_neighbours(cfg, standardclean_tlt)<br>
<br>
        cfg = []<br>
        cfg.method = 'montecarlo' ; %significance probability<br>
        cfg.statistic = 'ft_statfun_depsamplesT'<br>
        cfg.correctm = 'cluster'<br>
        cfg.clusteralpha = 0.05 %alpha level of the sample specific test statistic that will<br>
                                % be used for thresholding<br>
        cfg.clusterstatistic = 'maxsum'<br>
        cfg.minnbchan = 4<br>
        cfg.latency = [0.25 0.8]<br>
        cfg.neighbours = Neighbours<br>
        cfg.tail = 0<br>
        cfg.clustertail = 0<br>
        cfg.alpha = 0.025<br>
        cfg.numrandomization = 1000<br>
<br>
        design = [ones(size(targetclean_tlt.<u></u>trial,1),1); 2*ones(size(standardclean_tlt.<u></u>trial,1),1)]';<br>
        design([1:size(targetclean_<u></u>tlt.trial) 1:size(standardclean_tlt.<u></u>trial,1)])<br>
<br>
<br>
        cfg.design = design<br>
        cfg.ivar = [ones(size(targetclean_tlt.<u></u>trial,1),1); 2*ones(size(standardclean_tlt.<u></u>trial,1),1)]'<br>
        cfg.uvar = [1:size(targetclean_tlt.trial) 1:size(standardclean_tlt.<u></u>trial,1)]<br>
<br>
        tlt_statsnew = ft_timelockstatistics(cfg, targetclean_tlt, standardclean_tlt )<br>
<br>
        cd 'G:\BackUp07.07.14_DatenPrepr\<u></u>Daten1\P300';<br>
        cd Kontrollen;<br>
        List2 = dir<br>
        cd (List2(i).name);<br>
        eval(['cd M' num2str(j)]);<br>
        save statnew tlt_statsnew<br>
<br>
    end<br>
end<br>
<br>
<br>
This is what gets displayed while running the script:<br>
<br>
selected 245 channels<br>
selected 139 time bins<br>
selected 1 frequency bins<br>
using "ft_statistics_montecarlo" for the statistical testing<br>
using "ft_statfun_depsamplesT" for the single-sample statistics<br>
constructing randomized design<br>
total number of measurements     = 189<br>
total number of variables        = 1<br>
number of independent variables  = 189<br>
number of unit variables         = 189<br>
number of within-cell variables  = 0<br>
number of control variables      = 0<br>
using a permutation resampling approach<br>
<br>
Then, this error occurs:<br>
<br>
Error using resampledesign (line 168)<br>
A within-units shuffling requires a at least one unit variable and at least<br>
one independent variable<br>
<br>
Error in ft_statistics_montecarlo (line 241)<br>
resample = resampledesign(cfg, design);<br>
<br>
Error in statistics_wrapper (line 310)<br>
    [stat, cfg] = statmethod(cfg, dat, design);<br>
<br>
Error in ft_timelockstatistics (line 113)<br>
[stat, cfg] = statistics_wrapper(cfg, varargin{:});<br>
<br>
I have no clue where I made a mistake. I have unit variables and independent variables (189 if I understand it correctly).<br>
Is there anything I am missing? Any additional information or is the design matrix wrong?<br>
<br>
<br>
I really appreciate your help.<br>
<br>
Best regards,<br>
Barbara<br>
<br>
<br>
<br>
<br>
Barbara Schorr, MSc<br>
Clinical and Biological Psychology<br>
University of Ulm<br>
Albert-Einstein-Allee 47<br>
89069 Ulm<br>
<br>
<br>
<br>
______________________________<u></u>_________________<br>
fieldtrip mailing list<br>
<a href="mailto:fieldtrip@donders.ru.nl" target="_blank">fieldtrip@donders.ru.nl</a><br>
<a href="http://mailman.science.ru.nl/mailman/listinfo/fieldtrip" target="_blank">http://mailman.science.ru.nl/<u></u>mailman/listinfo/fieldtrip</a><br>
</blockquote></div><br></div></div>