jeudi 4 mai 2017

creating raondom order of trials with a specific restriction

Im trying to make a random order of trials with a specific restriction on only for 'level2' in GNG factor.

I usually use data structure for making a experimental design. There are 2 factors, GNG and SOA.

GNG    = 3; % + single go / dual: go, nogo
SOA    = 3; % 0, 400, 800ms 
REP    = 4; % duplicate

bTRIAL = SOA * GNG  % the number of trials on each block   
nTRIAL = SOA * GNG * REP; % total number of trials

data.cGNG = 0:(nTRIAL-1);
data.cGNG(mod(xIndex, GNG)==0)=1; % go
data.cGNG(mod(xIndex, GNG)==1)=2; % nogo
data.cGNG(mod(xIndex, GNG)==2)=3; % go only 

data.cSOA = 0:(nTRIAL-1);
data.cSOA(mod(fix(xIndex/GNG), SOA)==0) =1; % soa1
data.cSOA(mod(fix(xIndex/GNG), SOA)==1) =2; % soa2

% shuffle       
data.xOrder = Shuffle(1:nTRIAL); % randomization I use 'data.xOrder' as a trial. 

I usually use data.xOrder for each trials. e.g., data.xOrder(1) is the 1st trial. In this experiment, I have 3 conditions in ' GNG' factors, and not to repeat the 'condition 2' more than once(2-2-2 (x), 2-2 (ok)) in any given consecutive trial.

let's suppose

[data.xOrder' data.cGNG' data.cSOA'] is for experimental design, 
   24         **2**             1    % trial 1
   31         **2**             3    % trial 2
   2          **2**(wrong!)     1    % trial 3 
   3           1                2    % trial 4 
   7           1                3    % trial 5 
   20          1 (ok)           2    % trial 6 
   13          3                2    % trial 7 
    ...         ...            ...      ... 

I shoud make a restriction not to repeat level2 more than 2 * I don't want to make level2 repeat more than 2, but any repetition in level 1 or 3 is ok.

I don't know how to make a restriction when I shuffle trials.

thanks for helping me !




Aucun commentaire:

Enregistrer un commentaire