Getting debrief block to analyze only the certain responses #2516
-
Hi. So my experiment is asking people to answer trivia questions, and then they report their confidence in their answers.
Here is the code. I need some way for it to filter and analyze only responses that the participant reported __% confidence in:
and here is the link to the experiment : https://alskuvye1v.cognition.run/ |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Hi @rbruno1, to do this, it helps to have some way of linking the response that you're scoring (the trivia question answer) with the confidence rating, since these two responses are stored as separate trials. What I would do is edit your confidence rating trial so that it also stores the response accuracy from the previous trial. This will make it easier to get accuracy summaries for the different confidence ratings. I think one way to do this is by making the var AnimalsTrials = {
timeline: [
{
type: jsPsychHtmlButtonResponse,
stimulus: jsPsych.timelineVariable('stimulus'),
choices: ['True', 'False'],
data: {
task: 'response',
correct_response: jsPsych.timelineVariable('correct_response')
},
on_finish: function(data){
//data.correct = jsPsych.pluginAPI.compareKeys(data.response, data.correct_response);
// NOTE: compareKeys is just for scoring keyboard responses
data.correct = data.response == data.correct_response;
}
},
{
type: jsPsychHtmlButtonResponse,
stimulus: ["How confident are you in your answer?"],
choices: ["55%", "65%", "75%", "85%", "95%"],
data: function() {
// get the response accuracy from the last trial and store it in the data for this trial
var correct = jsPsych.data.getLastTrialData().values()[0].correct;
return {task: 'confidence', correct: correct};
},
}
]
}; Then, in your debrief block, you can filter the confidence rating trials based on the responses, and get the previous trial's response accuracy from that same data: var debrief_block = {
type: jsPsychHtmlKeyboardResponse,
stimulus: function() {
var trials_55 = jsPsych.data.get().filter({task: "confidence", response: 1});
// ...
// 'correct' is the response accuracy from the previous trial (trivia question)
var correct_trials_55 = trials_55.filter({correct: true});
// ...
}
}; Does that solution work for you? |
Beta Was this translation helpful? Give feedback.
Hi @rbruno1, to do this, it helps to have some way of linking the response that you're scoring (the trivia question answer) with the confidence rating, since these two responses are stored as separate trials. What I would do is edit your confidence rating trial so that it also stores the response accuracy from the previous trial. This will make it easier to get accuracy summaries for the different confidence ratings. I think one way to do this is by making the
data
parameter for the confidence rating trial into a function: