You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Thank you in advance for reading my question. I am creating a word-cue memory experiment where participants have to recall memories in response to words, and if they recall a memory within the time limit (16 seconds), they are asked some further questions about that memory. Within each trial I want to implement conditional branching, firstly so that participants only see subsequent questions if they recall a memory, and where some of these questions are only shown after a particular response. I have created a figure to demonstrate one trial:
I have tried to create a series of conditional functions which evaluate whether participants respond (i.e., press a certain key) and then activate the next question of that branch. This logic seems to work with just one conditional function (so if no response is made after 16 seconds, the next trial begins), see code:
/* define trial stimuli array for timeline variables */vartest_stimuli=[{stimulus: '<div style="font-size:60px;">Aunt</div>'},{stimulus: '<div style="font-size:60px;">Drum</div>'},{stimulus: '<div style="font-size:60px;">Morning</div>'},{stimulus: '<div style="font-size:60px;">Shower</div>'},{stimulus: '<div style="font-size:60px;">Window</div>'},];/* define fixation and test trials */varfixation={type: jsPsychHtmlKeyboardResponse,stimulus: '<div style="font-size:60px;">+</div>',choices: "NO_KEYS",trial_duration: 1000,data: {task: 'fixation'}};varWordCue={type: jsPsychHtmlKeyboardResponse,stimulus: jsPsych.timelineVariable('stimulus'),choices: [" "],trial_duration: 16000,response_ends_trial: true,name: 'Memory'};/* Conditional function to evaluate whether participant responds . */functioncheck_trial_null(data){vardata=jsPsych.data.get().last(1).values()[0];if(jsPsych.pluginAPI.compareKeys(data.response,' ')){returntrue;}else{returnfalse;};};varRT={type: jsPsychSurveyMultiChoice,name: 'RetrievalType',questions: [{prompt: "<b>How did your memory come to mind?</b>",options: ["1: It popped into my mind by itself.","2: I had to actively search to find the memory.","3: I don't know/not sure."],required: true,},]};/* Conditional procedure */varRT_conditional={timeline: [RT],conditional_function: check_trial_null//the conditional function in question};/*define test procedure */vartest_procedure={timeline: [fixation,WordCue,RT_conditional],timeline_variables: test_stimuli,randomize_order: true};timeline.push(test_procedure);/* start the experiment */jsPsych.run(timeline);
I have tried to use the same logic to add additional conditional functions, but if no response is made after 16 seconds, there is a blank screen and the experiment doesn't move on to the next trial. However, the branching seems to be working fine if responses are made, see code:
/* define trial stimuli array for timeline variables */vartest_stimuli=[{stimulus: '<div style="font-size:60px;">Aunt</div>'},{stimulus: '<div style="font-size:60px;">Drum</div>'},{stimulus: '<div style="font-size:60px;">Morning</div>'},{stimulus: '<div style="font-size:60px;">Shower</div>'},{stimulus: '<div style="font-size:60px;">Window</div>'},];/* define fixation and test trials */varfixation={type: jsPsychHtmlKeyboardResponse,stimulus: '<div style="font-size:60px;">+</div>',choices: "NO_KEYS",trial_duration: 1000,data: {task: 'fixation'}};varWordCue={type: jsPsychHtmlKeyboardResponse,stimulus: jsPsych.timelineVariable('stimulus'),choices: [" "],trial_duration: 16000,response_ends_trial: true,name: 'Memory'};/* Conditional function to evaluate whether participant responds . */functioncheck_trial_null(data){vardata=jsPsych.data.get().last(1).values()[0];if(jsPsych.pluginAPI.compareKeys(data.response,' ')){returntrue;}else{returnfalse;};};varRT={type: jsPsychSurveyMultiChoice,name: 'RetrievalType',questions: [{prompt: "<b>How did your memory come to mind?</b>",options: ["1: It popped into my mind by itself.","2: I had to actively search to find the memory.","3: I don't know/not sure."],required: true,},]};/* Conditional function to evaluate whether participant responds . */functioncheck_trial_direct(data){vardata=jsPsych.data.getLastTrialData().values()[0];varanswer_Q1=data.response.Q0;if(answer_Q1=="1: It popped into my mind by itself."){returntrue;}else{returnfalse;};};/* Conditional function to evaluate whether participant responds . */functioncheck_trial_generative(data){vardata=jsPsych.data.getLastTrialData().values()[0];varanswer_Q2=data.response.Q0;if(answer_Q2=="2: I had to actively search to find the memory."){returntrue;}else{returnfalse;};};/* Conditional function to evaluate whether participant responds . */functioncheck_trial_unsure(data){vardata=jsPsych.data.getLastTrialData().values()[0];varanswer_Q3=data.response.Q0;if(answer_Q3=="3: I don't know/not sure."){returntrue;}else{returnfalse;};};varDirectR={type: jsPsychSurveyMultiChoice,name: 'DirectRetrieval_FollowUp',questions: [{prompt: 'Was this the very first thing that came to mind?',options: ["Yes","No"],required: true,},]};/* Conditional function to evaluate whether participant responds . */functioncheck_trial_directN(data){vardata=jsPsych.data.getLastTrialData().values()[0];varanswer_Q4=data.response.Q0;if(answer_Q4=="No"){returntrue;}else{returnfalse;};};/* Conditional function to evaluate whether participant responds . */functioncheck_trial_directY(data){vardata=jsPsych.data.getLastTrialData().values()[0];varanswer_Q5=data.response.Q0;if(answer_Q5=="Yes"){returntrue;}else{returnfalse;};};varGenerativeR={type: jsPsychSurveyText,name: 'GenerativeRetrieval_FollowUp',questions: [{prompt: 'How did you search for this memory?',rows: 10,columns: 100,required: true,},]};varDirectR2={type: jsPsychSurveyText,name: 'DirectRetrieval_FollowUp2',questions: [{prompt: 'What came to your mind first?',rows: 10,columns: 100,required: true,},]};varMem={type: jsPsychSurveyText,name: 'MemoryDescription',questions: [{prompt: 'Please type a short description of your memory...',rows: 10,columns: 100,required: true,},]};/* Next trial */varNextTrial={type: jsPsychHtmlButtonResponse,stimulus: ` <p>Press the button to begin the next trial.</p> `,choices: ['Next Trial']};/* Conditional procedure */varRT_conditional={timeline: [RT],conditional_function: check_trial_null//the conditional function in question};/* Conditional procedure */vardirect_conditional={timeline: [DirectR],conditional_function: check_trial_direct//the conditional function in question};/* Conditional procedure */vardirect2_conditional={timeline: [DirectR2,Mem],conditional_function: check_trial_directN//the conditional function in question};/* Conditional procedure */vargenerative_conditional={timeline: [GenerativeR,Mem],conditional_function: check_trial_generative//the conditional function in question};/* Conditional procedure */varunsure_conditional={timeline: [Mem],conditional_function: check_trial_unsure//the conditional function in question};/* Conditional procedure */vardirect3_conditional={timeline: [Mem],conditional_function: check_trial_directY//the conditional function in question};/*define test procedure */vartest_procedure={timeline: [fixation,WordCue,RT_conditional,direct_conditional,direct2_conditional,generative_conditional,unsure_conditional,direct3_conditional,NextTrial],timeline_variables: test_stimuli,randomize_order: true};timeline.push(test_procedure);/* start the experiment */jsPsych.run(timeline);
I would appreciate any suggestions of how I may be able to accomplish this and anything I could change. Thank you very much! :)
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hi,
Thank you in advance for reading my question. I am creating a word-cue memory experiment where participants have to recall memories in response to words, and if they recall a memory within the time limit (16 seconds), they are asked some further questions about that memory. Within each trial I want to implement conditional branching, firstly so that participants only see subsequent questions if they recall a memory, and where some of these questions are only shown after a particular response. I have created a figure to demonstrate one trial:
I have tried to create a series of conditional functions which evaluate whether participants respond (i.e., press a certain key) and then activate the next question of that branch. This logic seems to work with just one conditional function (so if no response is made after 16 seconds, the next trial begins), see code:
I have tried to use the same logic to add additional conditional functions, but if no response is made after 16 seconds, there is a blank screen and the experiment doesn't move on to the next trial. However, the branching seems to be working fine if responses are made, see code:
I would appreciate any suggestions of how I may be able to accomplish this and anything I could change. Thank you very much! :)
Beta Was this translation helpful? Give feedback.
All reactions