tricky randomization and block breaking #1052
-
Hello everyone! I have a question about randomization and block breaking. In my experiment, I have 72 sets of sentences as critical items and 120 filler items. For each set of the critical sentences, there are 6 conditions (i.e., 1a, 1b, 1c, 1d, 1e, 1f for set #1, and 2a, 2b, 2c, 2d, 2e, 2f for set #2,... all the way to 72a, 72b,... for set#72). Fillers are just 120 random sentences, so no condition differences for fillers. I'd like to counterbalance these 72 sets of critical sentences among my participants in 6 experimental lists that contain only one version of each sentence, so each experimental list will contain 192 sentences (72 critical + 120 fillers) and will be divided into 3 blocks (64 sentences per block). Right now I am kinda doing it manually by myself, but I was just wondering if there are some plugins that can save me a lot of time and trouble. I am stuck when I tried to write a randomization command and a block-breaking command that might work for this tricky situation. Any suggestions on how I can approach this? Thanks! |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 12 replies
-
Hi @viviantic! Sorry for the delay in responding to your question. Would you still like some help with this? If so could you share the way that you've structured your trial data? E.g. something like this: var trial_info = [
{condition: '1a', set: '1', type: 'critical', filler_number: 'NA'},
{condition: '1b', set: '1', type: 'critical', filler_number: 'NA'},
...
{condition: '2a', set: '2', type: 'critical', filler_number: 'NA'},
{condition: '2b', set: '2', type: 'critical', filler_number: 'NA'},
...
{condition: 'NA', set: 'NA', type: 'filler', filler_number: '1'},
{condition: 'NA', set: 'NA', type: 'filler', filler_number: '2'}
]; Of course it doesn't need to be set up this way - this is just an example. And could you also explain how you're setting up your experiment, e.g. using timeline variables or a loop, or share your code? Thanks! |
Beta Was this translation helpful? Give feedback.
-
Hi @viviantic, I think your general approach to this makes sense. One problem with the way you've set this up is that, in your The way I might do this is (1) randomize the For your break with the countdown timer, you could use an html-keyboard-response trial, and use the trial's on_load function to store the current time remaining and update the text with that value after every second using JavaScript's setInterval function. You'd need to remember to clear the interval once the time is up. Here's how it might look: var main_stimuli = stimuli_subset.concat(filler_stimuli);
var main_stimuli_rand = jsPsych.randomization.shuffle(main_stimuli);
// set up the break screen
var timedbreak = {
type: 'html-keyboard-response',
stimulus: '<div><p>Time for a 60 second break!</p><p>The task will move on when the time below reaches 0.</p><div id="timer">60 seconds left</div>',
trial_duration: 61000,
on_load: function() {
var sec_left = 60;
var timer_interval = setInterval(function() {
sec_left--;
document.getElementById("timer").innerHTML = sec_left.toString() + " seconds left";
if (sec_left == 0) {
clearInterval(timer_interval);
}
}, 1000);
}
};
// define all the trial objects that you'll use in the blocks: fixation, main task, main question, feedback
// using jsPsych.timelineVariable() for any parameters that come from the main_stimuli array
// set up block 1 and add it to the main timeline
var block1 = {
timeline: [fixation, main_task, main_question, feedback],
timeline_variables: main_stimuli_rand.slice(0,64); // first chunk of your randomized trial array - remember that indexing starts at 0
};
timeline.push(block1);
// add a break to the main timeline
timeline.push(timedbreak);
// set up block 2 with the next chunk of main_stimuli_rand as the timeline_variables array and add this block to the main timeline
// then add another break to the main timeline
// etc. |
Beta Was this translation helpful? Give feedback.
Hi @viviantic! Sorry for the delay in responding to your question. Would you still like some help with this? If so could you share the way that you've structured your trial data? E.g. something like this:
Of course it doesn't need to be set up this…