Reply To: Pseudoranomization

PennController for IBEX Forums Support Pseudoranomization Reply To: Pseudoranomization


I think there is a misunderstanding about the identity and interactions of the different elements in PCIbex.

Tables and columns are never randomized: tables are static pieces of data, typically in the form of CSV files, used to generate trials using the Template command.

What ends up randomized are the trials themselves in the running order, on the basis of their labels. You define the running order using the Sequence command and by referring to trial labels inside it, optionally filtering the correspondingly-labeled trials using various functions like the pre-built function randomize, or the custom function randomizeNoMoreThan in this case.

For example, using the table from your message, this bit of code would make sure you don’t have more than two consecutive trials labeled con nor more than two consecutive trials labeled inc (I had to extract those labels from your trialtype column, since each of the values it contains are already unique within each group):

Sequence( randomizeNoMoreThan(anyOf("con","inc"),2) )

Template( row =>
  // keep only 'inc' or 'con' as the label
  newTrial( row.trialtype.replace(/^.*(inc|con).*$/,"$1") ,
  .log( "type"     , row.trialtype )
  .log( "group"    , row.Group )
  .log( "flanker"  , row.Flanker )
  .log( "sentence" , row.Stim )
  .log( "CorrectResponse" , row.Response )

To be clear, whenever you run the experiment, you will only see 8 trials, either all from the rows where Group is A, or all from the rows where Group is B. Three of those 8 trials are labeled “inc” and the other five are labeled “con,” based on trialtype. The trial generated from the row where trialtype is “filler” will not be run because its label is neither “inc” nor “con” (and because we used anyOf("con","inc"))

If you only want to prevent more than two consecutive trials generated from rows with the exact same value in trialstype then your table already gives you that because, as I said earlier, each value in that column is unique within its Group. If you want to prevent series of three-or-more trials generated from rows whose trialstype value contains the same AM/UA prefix and/or the same inc/con affix, then we’ll need to modify the randomizeNoMoreThan function, because right now it only tests for exact matches between trials’ labels

Hopefully my message made some points clearer, but please ask any questions you still have