Randomizing trials from separate timelines #1894
-
Hi there! In my task, I show a video and ask a question afterwards. I would like a second question to pop up for a specific subset of video stimuli. What I have done is create two different timelines, and I am trying to intermix and randomize the trials from the conditions. I don't know if this is the best way to do what I want, and I would appreciate any help possible! Here are the two timelines that I have, but I'm not sure how to create a structure that would combine the individual trials from each timeline. var test_procedure = { var full_length_procedure = { |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Hi @goyals4848, I'm not entirely sure, but I don't think there's an easy way to intermix trials from two separate timelines. What I would do instead is create a single // create your test_stim array that contains all of your trial info
// each object contains all of the trial parameters, as well as a 'show_second_question' property that can be true or false
var test_stim = [
{stimulus: '1', show_second_question: true},
{stimulus: '2', show_second_question: false}
// etc.
];
// define all of the parts of your trial procedure...
// conditional node that will go in your procedure timeline
var emotion_intensity_conditional = {
timeline: [emotion_intensity],
conditional_function: function() {
// the variable name you use in the timelineVariable function here should correspond to whatever flag you create in the trial data,
// where the value is true if the second question should be shown and false if not
if (jsPsych.timelineVariable('show_second_question')) {
return true;
} else {
return false;
}
}
};
var test_procedure = {
timeline: [fixation, play_video, response, emotion_intensity_conditional],
timeline_variables: test_stim,
randomize_order: true // if necessary
} If you're using a version of jsPsych before 6.3.0, then you'll need to include the second |
Beta Was this translation helpful? Give feedback.
Hi @goyals4848, I'm not entirely sure, but I don't think there's an easy way to intermix trials from two separate timelines. What I would do instead is create a single
timeline_variables
array that contains all of your trials, and add a flag to the trial objects indicating whether or not the second question should be presented. That way, you can add a conditional node in your procedure's timeline that checks whether or not the second question should be presented for that particular trial - if so, present the second question, otherwise skip it. It would look something like this: