Skip to content

Alternating trial types sampling from separate variable sets #3257

Answered by Shaobin-Jiang
veracityx asked this question in Q&A
Discussion options

You must be logged in to vote

I would suggest not relying on the randomize_order parameter but randomizing the stimulus yourself:

var main_timeline = {
  timeline: [repeat_trial_1, repeat_trial_2, describe_trial],
  timeline_variables: Array(repeat_stimuli.length), // preset the number of repetitions
  on_timeline_start: function () {
    let shuffled_repeat_stimuli = jsPsych.randomization.shuffle(repeat_stimuli);
    let shuffled_describe_stimuli = jsPsych.randomization.shuffle(describe_stimuli);
    this.timeline_variables = shuffled_repeat_stimuli.map((value, index) =>
      Object.assign({}, value, shuffled_describe_stimuli[index]),
    );
  },
};

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@veracityx
Comment options

Answer selected by veracityx
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants