Alternating Block (Factorial) Design with Random Sampling from Video List: Help Needed!!!! #3378
Replies: 1 comment
-
Hi Linda, I checked your code and it looks really impressive for someone new to coding in jsPsych :) There are probably other solutions as well, but in your case I would approach the problem by not using the jsPsych timeline variable but by adding the trials explicitly in a nested for loop: let videos = {
'self' : jsPsych.randomization.shuffle(["a.mp4", "b.mp4", "c.mp4", "d.mp4"]),
'other': jsPsych.randomization.shuffle(["1.mp4", "2.mp4", "3.mp4", "4.mp4"])
}
let blocks = ["self", "other"];
let experimentalTrials = [];
for (let i = 0; i < 2; ++i){
for(let block_type of blocks){
// Sample N stimuli
for(let stimulusIndex = 0; stimulusIndex < 2; ++stimulusIndex){
// Sample a stimulus
let stimulus = videos[block_type].pop();
// Run the continuous rating task
let continuous_rating = {
type: jsPsychVideoRatingContinuous,
stimulus: stimulus
}
}
// Add block type specific trial
if (block_type == "self"){
} else {
}
}
} In the code above I have a data structure that holds all your videos per block type in randomized order. In the nested for loop I loop over both block types and sample two stimuli from that respective list and create the trial. At this point you can also do something specific depending on the block type (you just need to adjust the numbers in the loops when working with more stimuli). To counterbalance the order of block types you will need a way to decide which block order to use on a specific run of the experiment. You could do this complete at random, e.g.: ìf(Math.random() < 0.5){
blocks = ["self", "other"];
} else {
blocks = ["other", "self"];
} Some hosting platforms can inject a number into your jsPsych code which you can use to decide which order to use, or you could even use two separate versions for the counterbalacing. Hope this is useful somehow! Good luck with your experiment! |
Beta Was this translation helpful? Give feedback.
-
Good evening jsPsych experts,
I am brand new to coding in jsPsych, and I am in the process of coding my first experiment using the software. My goal is to program an experiment with the following features:
I've tried several approaches to no avail. This is what I have so far that runs reliably, but it only shows the different videos in a random sequence without regard for the blocking design that I'm interested in. While I've programmed different screens for the post-continuous video-rating questions into the experiment, I haven't incorporated them into the actual timeline since I don't know how to properly manipulate them. Here is what I have so far that works reliably:
videx4.txt
Here is what I have that more closely approximates my attempt to get at the design I need that is not running:
videx4_not.working.txt
For your reference, I am using an exciting new plugin that @wj-mitchell has pitched in a separate thread for continuous video ratings, which you can reference here.
Any help you may be able to offer or resources you could point me to would be sincerely appreciated.
Kind regards,
Linda
Beta Was this translation helpful? Give feedback.
All reactions