I am new to programming and am currently trying to use jsPsych to create a browser-based behavior experiment.
In my experiment, participants first complete a "pre-trial" in which they rate various pictures:
var scale_1 = ["Do not enjoy", "Neutral", "Enjoy"];
var pre_trial = {
timeline: [{
type: 'survey-likert',
preamble: jsPsych.timelineVariable('image'),
questions: [{labels: scale_1, prompt: "The prompt"}]
}],
timeline_variables: [
{image: 'image address'},
{image: 'image address'},
{image: 'image address'}
]
};
Then, I use the ratings to divide the images into two conditions, A and B. This division process uses matching such that, ultimately, the images that received a "Do not enjoy" rating are evenly distributed between Condition A and Condition B, as are the images rated "Neutral" and the ones rated "Enjoy."
Unfortunately, I cannot figure out how to perform this matching procedure. I have tried many different combinations of various JavaScript and jsPsych functionalities, such as pop( )
, splice( )
, concat( )
, jspsych.data.get( ).select('response')
, and many more. However, all of them have failed.
Does anyone here have experience with matched condition assignment in jsPsych, or any idea about how to do it? If so, would you please consider sharing your ideas here? I know that there is a GitHub forum dedicated to jsPsych, but I figured I would ask my question here as well since I am struggling so much to find the answer.
I think maybe you can divide your whole experiment into four parts: pretrial, do-not-enjoy, neutral, enjoy.
In the pretrial, there are only pretrial and the function of jumping to the page depending on the answer participants give.
The last three parts are the same, they can distribute the participants into condition A or condition B randomly. (And depends on the platform you host, you can pass an url parameter to the second part to link the data)