roboticslab-uc3m / questions-and-answers

A place for general debate and question&answer
https://robots.uc3m.es/developer-manual/appendix/repository-index.html
2 stars 0 forks source link

Randomization problems with JsPsych #97

Closed nefestekin closed 1 year ago

nefestekin commented 1 year ago

As a newcomer to this platform, I have limited experience with jsPsych. Please forgive me in advance if my question seems unconventional or if it should have been directed elsewhere.

I’m currently facing difficulties with randomizing the trials in my experiment. Specifically, I’m designing a study where participants are asked to rate 45 audio stimuli across six adjective pairs, and I want to ensure that the trials within each pair are kept separate. This means that the experiment will consists of 45 x 6 trials. While I have successfully randomized the audio stimuli within each adjective group, I’ve been unable to find a way to randomize all the trials in the experiment.

I tried using jsPsych.randomization.shuffle, and it looked something like this:

    var trial_order = jsPsych.randomization.shuffle([adjective_1, adjective_2, adjective_3...])

    timeline.push(trial_order)

But, it gives the following error:

Trial level node is missing the "type" parameter.

Currently my code looks something like this, and I do not understand what might cause such problem:

var jsPsych = initJsPsych();
var timeline = [];

var adjective_1 = {
timeline: [ 
    {type: jsPsychAudioSliderResponse,
     stimulus: jsPsych.timelineVariable('audio'),
     labels: ['Rough', '2', '3', '4', '5', '6', 'Smooth'],},
     min: "1",
     max: "7",
     slider_start: "4",
     slider_width: "800" }
],

timeline_variables: [
{audio: 'sound/audio1.mp3'},
{audio: 'sound/audio2.mp3'},
        ...
{audio: 'sound/audio45.mp3'},
],

randomize_order: true
};

My code follows a similar pattern for the rest of the adjective pairs and they are labelled as adjective_1, adjective_2, adjective_3, and goes on like this. They are basically the same except for the labels. Currently, there is randomization of the audios for each adjective pair, but I want the adjectives and audios to be completely randomized, and I do not know how to address this issue.

I tried to be as much elaborate and open as possible to convey my problem. Some of the things may seem redundant, or some may be missing. Nevertheless, can you think of any solutions to this problem or can you notify if there is something I'm missing?

PeterBowman commented 1 year ago

Hello, @nefestekin. This repository is intended for solving internal issues related to the roboticslab-uc3m organization, therefore I'm going to close this one as out of topic, sorry!