-
It's not clear to me how to implement a staircase procedure with jsPsych. I know that I can use loop, like this. var block = {
type: "RDK",
choices: ['z', 'm'],
correct_choice: "z",
coherence: 0.6,
coherent_direction: [0],
};
var loop_node = {
timeline: [block],
loop_function: function(data){
if (data.values()[0].correct === true)
return false;
console.log(data.values()[0].correct);
return true;
}
}
timeline.push(loop_node); Inside the loop function I would set my condition for convergence, but how to change the content of block? In particular coherence value? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
You can set the coherence parameter to be a function that returns the current value of the staircase: var block = {
type: "RDK",
choices: ['z', 'm'],
correct_choice: "z",
coherence: function(){
return staircase_coherence;
},
coherent_direction: [0],
}; If you define this value globally then you can update it in the If you want to avoid a global variable then you can compute the coherence directly in the function that returns it. |
Beta Was this translation helpful? Give feedback.
-
Hi @dokato, I just wanted to jump in to let you know about some JavaScript libraries for staircase procedures, in case you're interested. I've used both of these with jsPsych in the same way that Josh describes (i.e. using functions as parameters, where the function returns the difficulty level for the current trial). |
Beta Was this translation helpful? Give feedback.
You can set the coherence parameter to be a function that returns the current value of the staircase:
If you define this value globally then you can update it in the
loop_function
.If you want to avoid a global variable then you can compute the coherence directly in the function that returns it.