Shared Scripts, Data, Stimuli, Files, and Demos

NBack_Classic Run Experiment

NBack_Classic

Jerry van Veen

No comments yet
 




Comments

No comments yet

If you are a registered user and signed in, you can here copy this script and its stimuli to your own account, where you can edit it and change it in any way you want.

It is absolutely free to register (no credit card info asked!). You can then instantly copy this experiment with one click and edit it, change its accompanying texts, its landing page, stimuli, etc. Invite your colleagues, friends, or students to check out your experiment. There is no limit on how many people can do your experiment, even with a free account.

The catch? There is no catch! Just keep in mind that with a free account, you cannot collect data. For teaching that is usually not a problem. For research, prepaid data collection (unlimited subjects) starts as low as €10.00 for a 10-day period.

 
main.style("body-background-color","black");
main.style("background-color","black");
main.style("color", "white");
main.style("font-size","80%");

var i, 
    e,
    current,
    last,
    correct_b0 = 0,
    incorrect_b0 = 0,
    missed_b0 = 0,
    correct_b1 = 0,
    incorrect_b1 = 0,
    missed_b1 = 0,
    correct_b2 = 0,
    incorrect_b2 = 0,
    missed_b2 = 0,
    
    // pseudorandomized stimuli: 24 per block
    b0 = ['1.png','3.png','4.png','6.png','2.png','6.png','3.png','5.png','2.png','3.png','6.png','3.png','6.png','5.png','4.png','6.png','1.png','5.png','4.png','4.png','3.png','1.png','6.png','4.png'],
    b1 = ['2.png','3.png','2.png','3.png','6.png','5.png','3.png','3.png','4.png','5.png','6.png','4.png','6.png','6.png','1.png','1.png','3.png','5.png','3.png','6.png','3.png','3.png','2.png','2.png'],
    b2 = ['3.png','5.png','1.png','5.png','1.png','2.png','6.png','3.png','3.png','4.png','2.png','5.png','6.png','2.png','6.png','6.png','5.png','3.png','5.png','1.png','6.png','1.png','6.png','4.png'];

preload("1.png");
preload("2.png");
preload("3.png");
preload("4.png");
preload("5.png");
preload("6.png");

instruction("Welcome! 
" + "
" + "You are invited to participate in a research study about visual working memory. " + "Participation in this study is voluntary and can be stopped whenever you please. " + "All data will be recorded anonymously.
" + "
" + "By clicking OK, you agree to participate in this experiment.","OK","Informed Consent"); select("Please select your gender?",['male','female','other'],"gender"); input("Please fill in your age?","age"); text("The experiment consists of three different tasks:
" + "0-back, 1-back, 2-back
" + "
" + "In all tasks a string of images will be shown one by one. " + "Prior to each task you will be instructed for that particular task.
" + "
" + "Press space to continue"); awaitkey("SPACE"); clear(); var l = main.addblock("center","bottom",45,45) text("0-back",200).align("center"); await(2000); clear(); text("In this task images will be presented one by one. " + "For each time you see the image shown below, press the 'S-key'
" + "In case of a different image, press the 'L-key'
" + "
" + "Press space to continue"); l.setimage("3.png") awaitkey("SPACE"); main.removeblock(l); clear(); text("The task begins now. Good luck! "); await(2000); clear(); // 0back for (i = 0; i < b0.length; ++i) { setimage(b0[i]); e = awaitkey('s,l',1000); if (e.key === "l") { await(1000 - e.RT); } else { await(1000 - e.RT); } if (b0[i] === '3.png' && e.key === 's') { ++correct_b0; logtrial(1,"z-correct"); } if (b0[i] != '3.png' && e.key === 'l') { ++correct_b0; logtrial(1,"z-correct"); } if (b0[i] === '3.png' && e.key === 'l') { ++incorrect_b0; logtrial(1,"z-incorrect"); } if (b0[i] === '3.png' && e.key === 's') { ++incorrect_b0; logtrial(1,"z-incorrect"); } if (e.type === "timeout") { ++missed_b0; logtrial(1,"z-missed"); } logtrial(e.RT, "z-RT") clear(); text("+"); await(750); clear(); } log(correct_b0, "z-total_correct") log(incorrect_b0, "z-total_incorrect") log(missed_b0, "z-total_missed") // 1back text("1-back",200).align("center"); await(2000); clear(); text("In this task images will be presented one by one. " + "For each time the presented image is the same as the previous image, press the 'S-key'
" + "In case of a different image, press the 'L-key'
" + "
" + "Press space to continue"); awaitkey("SPACE"); clear(); text("The task begins now. Good luck! "); await(2000); clear(); for (i = 0; i < b1.length; ++i) { setimage(b1[i]); current = b1[i]; e = awaitkey('s,l',1000); if (e.key === "l") { await(1000 - e.RT); } else { await(1000 - e.RT); } if (current === b1[i-1] && e.key === 's') { ++correct_b1; logtrial(1,"1-correct"); } if (current === b1[i-1] && e.key === 'l') { ++incorrect_b1; logtrial(1,"1-incorrect"); } if (current != b1[i-1] && e.key === 's') { ++incorrect_b1; logtrial(1,"1-incorrect"); } if (current != b1[i-1] && e.key === 'l') { ++correct_b1; logtrial(1,"1-correct"); } if (e.type === "timeout") { ++missed_b1; logtrial(1, "1-missed") } await(1000 - e.RT) logtrial(e.RT, "1-RT") clear(); text("+"); await(750); clear(); } log(correct_b1, "1-total_correct") log(incorrect_b1, "1-total_incorrect") log(missed_b1, "1-total_missed") // 2back text("2-back",200).align("center"); await(2000); clear(); text("In this task images will be presented one by one. " + "For each time the presented image is the same as the image before the previous image, press the 'S-key'
" + "In case of a different image, press the 'L-key'
" + "
" + "Press space to continue"); awaitkey("SPACE"); clear(); text("The task begins now. Good luck! "); await(2000); clear(); for (i = 0; i < b2.length; ++i) { setimage(b2[i]); current = b2[i]; e = awaitkey('s,l',1000); if (e.key === "l") { await(1000 - e.RT); } else { await(1000 - e.RT); } if (current === b2[i-2] && e.key === 's') { ++correct_b2; logtrial(1,"2-correct"); } if (current === b2[i-2] && e.key === 'l') { ++incorrect_b2; logtrial(1,"2-incorrect"); } if (current != b2[i-2] && e.key === 's') { ++incorrect_b2; logtrial(1,"2-incorrect"); } if (current != b2[i-2] && e.key === 'l') { ++correct_b2; logtrial(1,"2-correct"); } if (e.type === "timeout") { ++missed_b2; logtrial(1, "2-missed") } await(1000 - e.RT) logtrial(e.RT, "2-RT") clear(); text("+"); await(750); clear(); } log(correct_b2, "2-total_correct") log(incorrect_b2, "2-total_incorrect") log(missed_b2, "2-total_missed") text("Thank you for Participating!
" + "
" + "Below are the amount of correct trials out of the total 24 images per block
" + "0-back:"+ correct_b0 +"
" + "1-back:"+ correct_b1 +"
" + "2-back:"+ correct_b2); await(10000) clear() text("The aim of the current experiment was to measure visual working memory, with increased workload for each block." + "We measured both RT and Accuracy" + "The 2back test is experienced hard and scores are therefore often low, so don't feel bad!") await(10000) clear()

Data inspection is forthcoming!

In the mean time, authors may download their own data and make it available as an Excel file. Check out the 'Stimuli and Files' tab.

Click on a category to view the stimuli and files

You can download the files shown here by clicking on the file names or image. Note that you cannot link directly to the images, sounds, videos, etc. shown here from other web pages; the link will go stale in about one hour and will no longer work after that.

Related Experiments