PennController for IBEX › Forums › Support › Pick combined with randomizeNoMoreThan
- This topic has 2 replies, 2 voices, and was last updated 2 years, 8 months ago by aliona.
-
AuthorPosts
-
January 18, 2022 at 2:52 pm #7675alionaParticipant
Dear Jeremy,
I have been using the Pick function to have my items presented in 3 blocks separated by 2 breaks. The critical and the filler items are well randomized, but sometimes they appear in long sequences of same-answer trials for the post-sentence question (e.g., 4-5 with a ‘yes’-answer followed by 4-5 with a ‘no’-answer).
Is there a way I could combine the Pick function and maybe randomizeNoMoreThan function to specify that I don’t want to have, say, more than 3 same-answer trials regardless of whether they’re critical or filler (which is specified in a column called “match” with “yes” and “no” values in it)?
Thanks in advance for your help!
AlionaP.S: here are my Pick function and sequence just in case.
function Pick(set,n) { assert(set instanceof Object, "First argument of pick cannot be a plain string" ); n = Number(n); if (isNaN(n) || n<0) n = 0; this.args = [set]; this.runSet = null; set.remainingSet = null; this.run = arrays => { if (this.runSet!==null) return this.runSet; const newArray = []; if (set.remainingSet===null) { if (set.runSet instanceof Array) set.remainingSet = [...set.runSet]; else set.remainingSet = arrays[0]; } for (let i = 0; i < n && set.remainingSet.length; i++) newArray.push( set.remainingSet.shift() ); this.runSet = [...newArray]; return newArray; } } function pick(set, n) { return new Pick(set,n); } critical = randomize("critical") fillers = randomize("filler");
PennController.Sequence("demographics","etc", rshuffle(pick(critical,8),pick(fillers,11)),"break", rshuffle(pick(critical,8),pick(fillers,11)),"break", rshuffle(pick(critical,8),pick(fillers,11)), "etc");
- This topic was modified 2 years, 8 months ago by aliona.
January 18, 2022 at 7:19 pm #7680JeremyKeymasterHi Aliona,
The
Sequence
command and the related functions only care about the trials’ labels: if you yes-answer and no-answer trials share the same labels, you won’t be able to control their distribution. I suggest you include the yes/no bit of information in the trials’ labels, eg"critical-yes"
/"critical-no"
and"filler-yes"
/"filler-no"
The
pick
function will pick the N next trials from a set: when you dopick(critical,8)
andcritical
was set torandomize("critical")
, it will pick 8 trials from a randomized set of all the trials labeled “critical”. Then you pass that torshuffle
, so those 8 trials will be interspersed with trials labeled “filler” in the order in which they were picked fromcritical
You could do that, in which case two critical-yes trials would always be separated by a critical-no, a filler-yes and a filler-no trial:
criticalyes = randomize("critical-yes") criticalno = randomize("critical-no") fillersyes = randomize("filler-yes") fillersno = randomize("filler-no") Sequence("demographics","etc", rshuffle(pick(criticalyes,4),pick(fillersyes,6),pick(criticalno,4),pick(fillersno,5)),"break", rshuffle(pick(criticalyes,4),pick(fillersyes,5),pick(criticalno,4),pick(fillersno,6)),"break", rshuffle(pick(criticalyes,4),pick(fillersyes,6),pick(criticalno,4),pick(fillersno,5)), "etc")
Don’t forget to add
-yes
/-no
to your trials’ labels, and make sure the5
/6
match the number of different types of trials you have (I went with 17 filler-yes trials and 16 filler-no trials, for a total of 33 filler trials)Jeremy
January 19, 2022 at 2:30 pm #7685alionaParticipantHi Jeremy,
it worked out perfectly! Thanks for the help.
Aliona
-
AuthorPosts
- You must be logged in to reply to this topic.