<div dir="ltr">Hello everyone<div>I have understood the correct fix to my issue, and I wanted to document what I discovered just in case someone else encounters the same confusion due to difficulty finding answers. The struct variable stat.stat demonstrates the t-values of each element of the timelocked data. </div><div>I haven't been able to figure out how to run a three-way analysis using ft_timelockstatistics, but instead, I use a for loop to run each combination I desire to use. </div><div>The variable stat.prob demonstrates the location of each cluster with their probability at that specific element, and the elements with value 1 demonstrate that no cluster was identified in that specific location. Additionally, the error about unique permutations in a nutshell is I didn't have enough subjects for 1000 unique permutations to occur.</div><div><br></div><div>There is still some confusion on my part on what other stat variable means, but I hoped these brief descriptions above can help</div><div>Best</div><div>Merlin</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, Sep 5, 2023 at 5:31 PM Merlin Kelly <<a href="mailto:merlinkelly75@gmail.com">merlinkelly75@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">Hello <div>I am currently trying to use the command ft_timelockstatistics to replicate the method of data analysis as demonstrated in the paper: "EEG alpha–theta dynamics during mind wandering in the context of breath focus meditation: An experience sampling approach with novice meditation practitioners". They also have used fieldtrip for permutation data analysis, but the code they provide doesn't seem to function for the alpha:theta ratio data.</div><div><br></div><div>I have recorded my data in a within-subject study with a baseline and two independent variables. I have my data separated between these three classes in a 4D array with dimensions, subject x trial/epoch x EEG channel x ratio data. Below is the code on how I convert this data to be fieldtrip friendly:</div><div><div style="padding:30px"><div style="font-size:10pt;font-family:Menlo,Monaco,Consolas,"Courier New",monospace"><span style="white-space:pre-wrap"><span style="color:rgb(14,0,255)">function </span>[DATA, layout]=permutation(data, Participant_index, index)</span></div><div style="font-size:10pt;font-family:Menlo,Monaco,Consolas,"Courier New",monospace"><span style="white-space:pre-wrap">    load(<span style="color:rgb(167,9,245)">'electrode19.mat'</span>)</span></div><div style="font-size:10pt;font-family:Menlo,Monaco,Consolas,"Courier New",monospace"><span style="white-space:pre-wrap">    load(<span style="color:rgb(167,9,245)">'chanlocs.mat'</span>)</span></div><div style="font-size:10pt;font-family:Menlo,Monaco,Consolas,"Courier New",monospace"><span style="white-space:pre-wrap">    </span></div><div style="font-size:10pt;font-family:Menlo,Monaco,Consolas,"Courier New",monospace"><span style="white-space:pre-wrap">    DATA = cell(1, max(unique(Participant_index)));</span></div><div style="font-size:10pt;font-family:Menlo,Monaco,Consolas,"Courier New",monospace"><span style="white-space:pre-wrap">    <span style="color:rgb(0,128,19)">%for each participant, load data in struct form and prepare for</span></span></div><div style="font-size:10pt;font-family:Menlo,Monaco,Consolas,"Courier New",monospace"><span style="white-space:pre-wrap">    <span style="color:rgb(0,128,19)">%fieldtrip</span></span></div><div style="font-size:10pt;font-family:Menlo,Monaco,Consolas,"Courier New",monospace"><span style="white-space:pre-wrap">    <span style="color:rgb(14,0,255)">for </span>i=1:max(unique(Participant_index))</span></div><div style="font-size:10pt;font-family:Menlo,Monaco,Consolas,"Courier New",monospace"><span style="white-space:pre-wrap">        clear <span style="color:rgb(167,9,245)">Data</span></span></div><div style="font-size:10pt;font-family:Menlo,Monaco,Consolas,"Courier New",monospace"><span style="white-space:pre-wrap">        Data=struct();</span></div><div style="font-size:10pt;font-family:Menlo,Monaco,Consolas,"Courier New",monospace"><span style="white-space:pre-wrap">        Data.label=electrode19;</span></div><div style="font-size:10pt;font-family:Menlo,Monaco,Consolas,"Courier New",monospace"><span style="white-space:pre-wrap">        Data.hdr.nChans=numel(electrode19);</span></div><div style="font-size:10pt;font-family:Menlo,Monaco,Consolas,"Courier New",monospace"><span style="white-space:pre-wrap">        Data.hdr.label=electrode19';</span></div><div style="font-size:10pt;font-family:Menlo,Monaco,Consolas,"Courier New",monospace"><span style="white-space:pre-wrap">        Data.hdr.Fs=500;</span></div><div style="font-size:10pt;font-family:Menlo,Monaco,Consolas,"Courier New",monospace"><span style="white-space:pre-wrap">        Data.fsample=500;</span></div><div style="font-size:10pt;font-family:Menlo,Monaco,Consolas,"Courier New",monospace"><span style="white-space:pre-wrap">        data_sel = data(Participant_index(index) == i, :,:,:);</span></div><div style="font-size:10pt;font-family:Menlo,Monaco,Consolas,"Courier New",monospace"><span style="white-space:pre-wrap">        <span style="color:rgb(14,0,255)">if </span>size(data_sel, 1) ~= 1</span></div><div style="font-size:10pt;font-family:Menlo,Monaco,Consolas,"Courier New",monospace"><span style="white-space:pre-wrap">            data_sel = reshape(data_sel, [], size(data_sel, 3), size(data_sel, 4));</span></div><div style="font-size:10pt;font-family:Menlo,Monaco,Consolas,"Courier New",monospace"><span style="white-space:pre-wrap">        <span style="color:rgb(14,0,255)">else</span></span></div><div style="font-size:10pt;font-family:Menlo,Monaco,Consolas,"Courier New",monospace"><span style="white-space:pre-wrap">            data_sel = squeeze(data_sel);</span></div><div style="font-size:10pt;font-family:Menlo,Monaco,Consolas,"Courier New",monospace"><span style="white-space:pre-wrap">        <span style="color:rgb(14,0,255)">end</span></span></div><div style="font-size:10pt;font-family:Menlo,Monaco,Consolas,"Courier New",monospace"><span style="white-space:pre-wrap">        Data.trial = data_sel;</span></div><div style="font-size:10pt;font-family:Menlo,Monaco,Consolas,"Courier New",monospace"><span style="white-space:pre-wrap">        Data.time=1:0.1:3.5;</span></div><div style="font-size:10pt;font-family:Menlo,Monaco,Consolas,"Courier New",monospace"><span style="white-space:pre-wrap">        Data.hdr.nSamples=1;</span></div><div style="font-size:10pt;font-family:Menlo,Monaco,Consolas,"Courier New",monospace"><span style="white-space:pre-wrap">        Data.dimord = <span style="color:rgb(167,9,245)">'chan_time'</span>;</span></div><div style="font-size:10pt;font-family:Menlo,Monaco,Consolas,"Courier New",monospace"><span style="white-space:pre-wrap">        <span style="color:rgb(14,0,255)">try</span></span></div><div style="font-size:10pt;font-family:Menlo,Monaco,Consolas,"Courier New",monospace"><span style="white-space:pre-wrap">            cfg=[];</span></div><div style="font-size:10pt;font-family:Menlo,Monaco,Consolas,"Courier New",monospace"><span style="white-space:pre-wrap">            Data=ft_preprocessing(cfg, Data);</span></div><div style="font-size:10pt;font-family:Menlo,Monaco,Consolas,"Courier New",monospace"><span style="white-space:pre-wrap">            Data = ft_timelockanalysis(cfg, Data);</span></div><div style="font-size:10pt;font-family:Menlo,Monaco,Consolas,"Courier New",monospace"><span style="white-space:pre-wrap">            Data = ft_datatype_timelock(Data);</span></div><div style="font-size:10pt;font-family:Menlo,Monaco,Consolas,"Courier New",monospace"><span style="white-space:pre-wrap">        </span></div><div style="font-size:10pt;font-family:Menlo,Monaco,Consolas,"Courier New",monospace"><span style="white-space:pre-wrap">           <span style="color:rgb(0,128,19)">% Data.trialinfo=labels;</span></span></div><div style="font-size:10pt;font-family:Menlo,Monaco,Consolas,"Courier New",monospace"><span style="white-space:pre-wrap">        </span></div><div style="font-size:10pt;font-family:Menlo,Monaco,Consolas,"Courier New",monospace"><span style="white-space:pre-wrap">            cfg.layout = <span style="color:rgb(167,9,245)">'biosemi32.lay'</span>;</span></div><div style="font-size:10pt;font-family:Menlo,Monaco,Consolas,"Courier New",monospace"><span style="white-space:pre-wrap">            Data.layout = ft_prepare_layout(cfg);</span></div><div style="font-size:10pt;font-family:Menlo,Monaco,Consolas,"Courier New",monospace"><span style="white-space:pre-wrap">            layout = ft_prepare_layout(cfg);</span></div><div style="font-size:10pt;font-family:Menlo,Monaco,Consolas,"Courier New",monospace"><span style="white-space:pre-wrap">            Data.layout=Data;</span></div><div style="font-size:10pt;font-family:Menlo,Monaco,Consolas,"Courier New",monospace"><span style="white-space:pre-wrap">            DATA{i} = Data;</span></div><div style="font-size:10pt;font-family:Menlo,Monaco,Consolas,"Courier New",monospace"><span style="white-space:pre-wrap">        <span style="color:rgb(14,0,255)">catch</span></span></div><div style="font-size:10pt;font-family:Menlo,Monaco,Consolas,"Courier New",monospace"><span style="white-space:pre-wrap">            DATA{i} = NaN;</span></div><div style="font-size:10pt;font-family:Menlo,Monaco,Consolas,"Courier New",monospace"><span style="white-space:pre-wrap">        <span style="color:rgb(14,0,255)">end</span></span></div><div style="font-size:10pt;font-family:Menlo,Monaco,Consolas,"Courier New",monospace"></div><div style="font-size:10pt;font-family:Menlo,Monaco,Consolas,"Courier New",monospace"><span style="white-space:pre-wrap">    <span style="color:rgb(14,0,255)">end</span></span><span style="font-size:10pt;white-space:pre-wrap">  </span></div><div style="font-size:10pt;font-family:Menlo,Monaco,Consolas,"Courier New",monospace"><span style="white-space:pre-wrap"><span style="color:rgb(14,0,255)">end</span></span></div><div style="font-size:10pt"><font face="arial, sans-serif">and below is the code for which I use this converted data and apply it to the command ft_timelockstatistics:</font></div><div style="font-size:10pt"><div style="padding:30px"><div style="font-size:10pt;font-family:Menlo,Monaco,Consolas,"Courier New",monospace"><span style="white-space:pre-wrap">clear <span style="color:rgb(167,9,245)">cls</span></span></div><div style="font-size:10pt;font-family:Menlo,Monaco,Consolas,"Courier New",monospace"><span style="white-space:pre-wrap"><span style="color:rgb(0,128,19)">%Loads the directory names and the processed data</span></span></div><div style="font-size:10pt;font-family:Menlo,Monaco,Consolas,"Courier New",monospace"><span style="white-space:pre-wrap">dirs = dir(<span style="color:rgb(167,9,245)">'C:/Users/merli/OneDrive - University College London/Desktop/Study_!/P*/*.mat'</span>);</span></div><div style="font-size:10pt;font-family:Menlo,Monaco,Consolas,"Courier New",monospace"><span style="white-space:pre-wrap">load(<span style="color:rgb(167,9,245)">'C:\Users\merli\OneDrive - University College London\Desktop\Study_!\Data.mat'</span>);</span></div><div style="font-size:10pt;font-family:Menlo,Monaco,Consolas,"Courier New",monospace"></div><div style="font-size:10pt;font-family:Menlo,Monaco,Consolas,"Courier New",monospace"><span style="white-space:pre-wrap"><span style="color:rgb(0,128,19)">%For loop and unique command seperates each class and participant so we can extract an index</span></span></div><div style="font-size:10pt;font-family:Menlo,Monaco,Consolas,"Courier New",monospace"><span style="white-space:pre-wrap"><span style="color:rgb(14,0,255)">for </span>i=1:size(dirs,1)</span></div><div style="font-size:10pt;font-family:Menlo,Monaco,Consolas,"Courier New",monospace"><span style="white-space:pre-wrap">    class = split(dirs(i).name, <span style="color:rgb(167,9,245)">'_'</span>);</span></div><div style="font-size:10pt;font-family:Menlo,Monaco,Consolas,"Courier New",monospace"><span style="white-space:pre-wrap">    Par = split(dirs(i).folder, <span style="color:rgb(167,9,245)">'P'</span>);</span></div><div style="font-size:10pt;font-family:Menlo,Monaco,Consolas,"Courier New",monospace"><span style="white-space:pre-wrap">    cls{i} = class{1};</span></div><div style="font-size:10pt;font-family:Menlo,Monaco,Consolas,"Courier New",monospace"><span style="white-space:pre-wrap">    P{i} = Par{2};</span></div><div style="font-size:10pt;font-family:Menlo,Monaco,Consolas,"Courier New",monospace"><span style="white-space:pre-wrap"><span style="color:rgb(14,0,255)">end</span></span></div><div style="font-size:10pt;font-family:Menlo,Monaco,Consolas,"Courier New",monospace"><span style="white-space:pre-wrap">[uniqueStrings, ~, index] = unique(cls);</span></div><div style="font-size:10pt;font-family:Menlo,Monaco,Consolas,"Courier New",monospace"><span style="white-space:pre-wrap">[PuniqueStrings, ~, Pindex] = unique(P);</span></div><div style="font-size:10pt;font-family:Menlo,Monaco,Consolas,"Courier New",monospace"></div><div style="font-size:10pt;font-family:Menlo,Monaco,Consolas,"Courier New",monospace"><span style="white-space:pre-wrap"><span style="color:rgb(0,128,19)">%Seperate data to each class based on the previous index</span></span></div><div style="font-size:10pt;font-family:Menlo,Monaco,Consolas,"Courier New",monospace"><span style="white-space:pre-wrap"><span style="color:rgb(0,128,19)">%percentage ratio is a 4D array with dimensions subject x trial/epoch x</span></span></div><div style="font-size:10pt;font-family:Menlo,Monaco,Consolas,"Courier New",monospace"><span style="white-space:pre-wrap"><span style="color:rgb(0,128,19)">%channel x frequency data</span></span></div><div style="font-size:10pt;font-family:Menlo,Monaco,Consolas,"Courier New",monospace"></div><div style="font-size:10pt;font-family:Menlo,Monaco,Consolas,"Courier New",monospace"><span style="white-space:pre-wrap"><span style="color:rgb(0,128,19)">%Testing error by removing incomplete sessions</span></span></div><div style="font-size:10pt;font-family:Menlo,Monaco,Consolas,"Courier New",monospace"><span style="white-space:pre-wrap"><span style="color:rgb(0,128,19)">% x = percentage_ratio(3:58,:,:,:);</span></span></div><div style="font-size:10pt;font-family:Menlo,Monaco,Consolas,"Courier New",monospace"><span style="white-space:pre-wrap"><span style="color:rgb(0,128,19)">% size(x)</span></span></div><div style="font-size:10pt;font-family:Menlo,Monaco,Consolas,"Courier New",monospace"><span style="white-space:pre-wrap"><span style="color:rgb(0,128,19)">% index = index(3:58);</span></span></div><div style="font-size:10pt;font-family:Menlo,Monaco,Consolas,"Courier New",monospace"><span style="white-space:pre-wrap"><span style="color:rgb(0,128,19)">% Pindex = Pindex(3:58);</span></span></div><div style="font-size:10pt;font-family:Menlo,Monaco,Consolas,"Courier New",monospace"><span style="white-space:pre-wrap">BaselineData = percentage_ratio(index == 1, :, :, :);</span></div><div style="font-size:10pt;font-family:Menlo,Monaco,Consolas,"Courier New",monospace"><span style="white-space:pre-wrap">FrameData = percentage_ratio(index == 2, :, :, :);</span></div><div style="font-size:10pt;font-family:Menlo,Monaco,Consolas,"Courier New",monospace"><span style="white-space:pre-wrap">ShamData = percentage_ratio(index == 3, :, :, :);</span></div><div style="font-size:10pt;font-family:Menlo,Monaco,Consolas,"Courier New",monospace"></div><div style="font-size:10pt;font-family:Menlo,Monaco,Consolas,"Courier New",monospace"><span style="white-space:pre-wrap"><span style="color:rgb(0,128,19)">% Pindex(index == 1) == 1</span></span></div><div style="font-size:10pt;font-family:Menlo,Monaco,Consolas,"Courier New",monospace"></div><div style="font-size:10pt;font-family:Menlo,Monaco,Consolas,"Courier New",monospace"><span style="white-space:pre-wrap"><span style="color:rgb(0,128,19)">%Converts 4D array to timelock data for fieldtrip analysis</span></span></div><div style="font-size:10pt;font-family:Menlo,Monaco,Consolas,"Courier New",monospace"><span style="white-space:pre-wrap">[BDataP, BlayoutP] = permutation(BaselineData, Pindex, index == 1);</span></div><div style="font-size:10pt;font-family:Menlo,Monaco,Consolas,"Courier New",monospace"><span style="white-space:pre-wrap">[FDataP, FlayoutP] = permutation(FrameData, Pindex, index == 2);</span></div><div style="font-size:10pt;font-family:Menlo,Monaco,Consolas,"Courier New",monospace"><span style="white-space:pre-wrap">[SDataP, SlayoutP] = permutation(ShamData, Pindex, index == 3);</span></div><div style="font-size:10pt;font-family:Menlo,Monaco,Consolas,"Courier New",monospace"></div><div style="font-size:10pt;font-family:Menlo,Monaco,Consolas,"Courier New",monospace"><span style="white-space:pre-wrap"><span style="color:rgb(0,128,19)">% figure,plot(1:0.1:3.5, BDataP{14}.avg)</span></span></div><div style="font-size:10pt;font-family:Menlo,Monaco,Consolas,"Courier New",monospace"><span style="white-space:pre-wrap"><span style="color:rgb(0,128,19)">% figure,plot(1:0.1:3.5, FDataP{14}.avg)</span></span></div><div style="font-size:10pt;font-family:Menlo,Monaco,Consolas,"Courier New",monospace"><span style="white-space:pre-wrap"><span style="color:rgb(0,128,19)">% figure,plot(1:0.1:3.5, SDataP{14}.avg)</span></span></div><div style="font-size:10pt;font-family:Menlo,Monaco,Consolas,"Courier New",monospace"></div><div style="font-size:10pt;font-family:Menlo,Monaco,Consolas,"Courier New",monospace"></div><div style="font-size:10pt;font-family:Menlo,Monaco,Consolas,"Courier New",monospace"><span style="white-space:pre-wrap"><span style="color:rgb(0,128,19)">%configuration definition for permutation statistics</span></span></div><div style="font-size:10pt;font-family:Menlo,Monaco,Consolas,"Courier New",monospace"><span style="white-space:pre-wrap">cfg=[];</span></div><div style="font-size:10pt;font-family:Menlo,Monaco,Consolas,"Courier New",monospace"><span style="white-space:pre-wrap">cfg.method        = <span style="color:rgb(167,9,245)">'triangulation'</span>;</span></div><div style="font-size:10pt;font-family:Menlo,Monaco,Consolas,"Courier New",monospace"><span style="white-space:pre-wrap">cfg.layout = BlayoutP;</span></div><div style="font-size:10pt;font-family:Menlo,Monaco,Consolas,"Courier New",monospace"><span style="white-space:pre-wrap">neighbours = ft_prepare_neighbours(cfg);</span></div><div style="font-size:10pt;font-family:Menlo,Monaco,Consolas,"Courier New",monospace"></div><div style="font-size:10pt;font-family:Menlo,Monaco,Consolas,"Courier New",monospace"><span style="white-space:pre-wrap">cfg.method = <span style="color:rgb(167,9,245)">'montecarlo'</span>;       <span style="color:rgb(0,128,19)">% use the Monte Carlo Method to calculate the significance probability</span></span></div><div style="font-size:10pt;font-family:Menlo,Monaco,Consolas,"Courier New",monospace"><span style="white-space:pre-wrap">cfg.statistic = <span style="color:rgb(167,9,245)">'ft_statfun_depsamplesT'</span>;<span style="color:rgb(0,128,19)">% use dependent samples t statistic</span></span></div><div style="font-size:10pt;font-family:Menlo,Monaco,Consolas,"Courier New",monospace"><span style="white-space:pre-wrap">cfg.correctm = <span style="color:rgb(167,9,245)">'cluster'</span>;</span></div><div style="font-size:10pt;font-family:Menlo,Monaco,Consolas,"Courier New",monospace"><span style="white-space:pre-wrap">cfg.clusteralpha = 0.05;         <span style="color:rgb(0,128,19)">% alpha level of the sample-specific test statistic that will be used for thresholding</span></span></div><div style="font-size:10pt;font-family:Menlo,Monaco,Consolas,"Courier New",monospace"><span style="white-space:pre-wrap">cfg.clusterstatistic = <span style="color:rgb(167,9,245)">'maxsum'</span>; <span style="color:rgb(0,128,19)">% test statistic that will be evaluated under the permutation distribution.</span></span></div><div style="font-size:10pt;font-family:Menlo,Monaco,Consolas,"Courier New",monospace"><span style="white-space:pre-wrap">cfg.neighbours = neighbours;   <span style="color:rgb(0,128,19)">% definition of neighbours</span></span></div><div style="font-size:10pt;font-family:Menlo,Monaco,Consolas,"Courier New",monospace"><span style="white-space:pre-wrap">cfg.tail = 0;                    <span style="color:rgb(0,128,19)">%two-sided test</span></span></div><div style="font-size:10pt;font-family:Menlo,Monaco,Consolas,"Courier New",monospace"><span style="white-space:pre-wrap">cfg.clustertail = 0;</span></div><div style="font-size:10pt;font-family:Menlo,Monaco,Consolas,"Courier New",monospace"><span style="white-space:pre-wrap">cfg.alpha = 0.025;               <span style="color:rgb(0,128,19)">% alpha level of the permutation test</span></span></div><div style="font-size:10pt;font-family:Menlo,Monaco,Consolas,"Courier New",monospace"><span style="white-space:pre-wrap">cfg.numrandomization = 1000;      <span style="color:rgb(0,128,19)">% number of draws from the permutation distribution</span></span></div><div style="font-size:10pt;font-family:Menlo,Monaco,Consolas,"Courier New",monospace"></div><div style="font-size:10pt;font-family:Menlo,Monaco,Consolas,"Courier New",monospace"></div><div style="font-size:10pt;font-family:Menlo,Monaco,Consolas,"Courier New",monospace"><span style="white-space:pre-wrap"><span style="color:rgb(0,128,19)">%define design matrix</span></span></div><div style="font-size:10pt;font-family:Menlo,Monaco,Consolas,"Courier New",monospace"><span style="white-space:pre-wrap">Bsubj=size(BDataP,2);</span></div><div style="font-size:10pt;font-family:Menlo,Monaco,Consolas,"Courier New",monospace"><span style="white-space:pre-wrap">Ssubj=size(SDataP,2);</span></div><div style="font-size:10pt;font-family:Menlo,Monaco,Consolas,"Courier New",monospace"><span style="white-space:pre-wrap">Fsubj=size(FDataP,2);</span></div><div style="font-size:10pt;font-family:Menlo,Monaco,Consolas,"Courier New",monospace"></div><div style="font-size:10pt;font-family:Menlo,Monaco,Consolas,"Courier New",monospace"><span style="white-space:pre-wrap"><span style="color:rgb(0,128,19)">%Currently instead of using all participants, am just doing it for some</span></span></div><div style="font-size:10pt;font-family:Menlo,Monaco,Consolas,"Courier New",monospace"><span style="white-space:pre-wrap"><span style="color:rgb(0,128,19)">%as it'll cause errors when using everyones data</span></span></div><div style="font-size:10pt;font-family:Menlo,Monaco,Consolas,"Courier New",monospace"><span style="white-space:pre-wrap">cfg.design(1,:) = ([2:8 2:8]); <span style="color:rgb(0,128,19)">%Each number represents the time it happened</span></span></div><div style="font-size:10pt;font-family:Menlo,Monaco,Consolas,"Courier New",monospace"><span style="white-space:pre-wrap">cfg.design(2, :) = ([ones(1,7)*1 ones(1,7)*2]); <span style="color:rgb(0,128,19)">%Each number is the different independant variable</span></span></div><div style="font-size:10pt;font-family:Menlo,Monaco,Consolas,"Courier New",monospace"><span style="white-space:pre-wrap">cfg.uvar        = 1; <span style="color:rgb(0,128,19)">% row of design matrix that contains unit variable (in this case: subjects)</span></span></div><div style="font-size:10pt;font-family:Menlo,Monaco,Consolas,"Courier New",monospace"><span style="white-space:pre-wrap">cfg.ivar        = 2; <span style="color:rgb(0,128,19)">% row of design matrix that contains independent variable (the conditions)</span></span></div><div style="font-size:10pt;font-family:Menlo,Monaco,Consolas,"Courier New",monospace"></div><div style="font-size:10pt;font-family:Menlo,Monaco,Consolas,"Courier New",monospace"><span style="white-space:pre-wrap">[stat] = ft_timelockstatistics(cfg, SDataP{2:8}, FDataP{2:8});</span></div><div style="font-size:10pt;font-family:Menlo,Monaco,Consolas,"Courier New",monospace"><span style="white-space:pre-wrap;font-family:arial,sans-serif;font-size:10pt"><br></span></div><div style="font-size:10pt;font-family:Menlo,Monaco,Consolas,"Courier New",monospace"><span style="white-space:pre-wrap;font-family:arial,sans-serif;font-size:10pt"><br></span></div><div style="font-size:10pt;font-family:Menlo,Monaco,Consolas,"Courier New",monospace"><span style="white-space:pre-wrap;font-family:arial,sans-serif;font-size:10pt">This code is currently functioning, but not as intended. The variable  stat.stat  is giving a channel x  len(ratio data) array </span></div><div style="font-size:10pt;font-family:Menlo,Monaco,Consolas,"Courier New",monospace"><span style="white-space:pre-wrap;font-family:arial,sans-serif;font-size:10pt">which I assume is supposed to be the  probability between both conditions, but all values are 1, except two random </span></div><div style="font-size:10pt;font-family:Menlo,Monaco,Consolas,"Courier New",monospace"><span style="white-space:pre-wrap;font-family:arial,sans-serif;font-size:10pt">values that equal 0.23. I don't understand why I'm reciving these results as I assume it's impossible to recieve a </span></div><div style="font-size:10pt;font-family:Menlo,Monaco,Consolas,"Courier New",monospace"><span style="white-space:pre-wrap;font-family:arial,sans-serif;font-size:10pt">probability of 1 unless the data is exactly the same for each observation. Additionally, when I run the code it states:</span><br></div><div style="font-size:10pt;font-family:Menlo,Monaco,Consolas,"Courier New",monospace">Warning: the number of randomizations (1000) is larger than the maximum number of unique<br>permutations (128), better use cfg.numrandomization='all' <span style="white-space:pre-wrap;font-family:arial,sans-serif;font-size:10pt"><br></span></div><div style="font-size:10pt"><font face="arial, sans-serif">Even though I have 601 different trials/epochs for each class per subject. Can anyone identify if I have made any mistakes or point me in the direction required to analyse my data correctly. Any help would be appreciated.</font></div><div style="font-size:10pt"><font face="arial, sans-serif">Best</font></div><div style="font-size:10pt"><font face="arial, sans-serif">Merlin</font></div></div></div></div></div><div><br></div><div><br></div></div>
</blockquote></div>