The Go/NoGo experiment is a classical test in cognitive psychology, tracing its origins to the mid-20th century. It was designed to measure a participant's ability to control impulsive responses. In this task, participants are trained to respond to specific stimuli ("Go" stimuli) and withhold their response to other stimuli ("NoGo" stimuli). The test's simplicity yet effective measure of impulse control made it a staple in cognitive and clinical research, especially concerning conditions like ADHD and disorders related to impulse control.
As psychological testing transitioned to digital platforms, the Go/NoGo experiment was no exception. Today, you can participate in a Go/NoGo test online, harnessing the efficiency and accessibility of modern technology.
Why is the Go/NoGo test popular? Its simplicity and efficacy in measuring impulse control have cemented its reputation as a reliable cognitive measure. Its adaptability to various research questions and populations ensures its continued use in diverse research contexts.
/* initialize jsPsych */
var jsPsych = initJsPsych({
on_finish: function() {
jsPsych.data.displayData();
}
});
/* create timeline */
var timeline = [];
/* preload images */
var preload = {
type: jsPsychPreload,
images: ['img/blue.png', 'img/orange.png']
};
timeline.push(preload);
/* define welcome message trial */
var welcome = {
type: jsPsychHtmlKeyboardResponse,
stimulus: "Welcome to the experiment. Press any key to begin."
};
timeline.push(welcome);
/* define instructions trial */
var instructions = {
type: jsPsychHtmlKeyboardResponse,
stimulus: `
<p>In this experiment, a circle will appear in the center
of the screen.</p><p>If the circle is <strong>blue</strong>,
press the letter F on the keyboard as fast as you can.</p>
<p>If the circle is <strong>orange</strong>, do not press a key.</p>
<div style='width: 700px;'>
<div style='float: left;'><img src='img/blue.png'></img>
<p class='small'><strong>Press the F key</strong></p></div>
<div style='float: right;'><img src='img/orange.png'></img>
<p class='small'><strong>Do not press a key</strong></p></div>
</div>
<p>Press any key to begin.</p>
`,
post_trial_gap: 2000
};
timeline.push(instructions);
/* define trial stimuli array for timeline variables */
var test_stimuli = [
{ stimulus: "img/blue.png", correct_response: 'f'},
{ stimulus: "img/orange.png", correct_response: null}
];
/* define fixation and test trials */
var fixation = {
type: jsPsychHtmlKeyboardResponse,
stimulus: '<div style="font-size:60px;">+</div>',
choices: "NO_KEYS",
trial_duration: function(){
return jsPsych.randomization.sampleWithoutReplacement([250, 500, 750, 1000, 1250, 1500, 1750, 2000], 1)[0];
},
data: {
task: 'fixation'
}
};
var test = {
type: jsPsychImageKeyboardResponse,
stimulus: jsPsych.timelineVariable('stimulus'),
choices: ['f'],
data: {
task: 'response',
correct_response: jsPsych.timelineVariable('correct_response')
},
trial_duration: function(){
return jsPsych.randomization.sampleWithoutReplacement([3000, 2000], 1)[0];
},
on_finish: function(data){
data.correct = jsPsych.pluginAPI.compareKeys(data.response, data.correct_response);
}
};
/* define test procedure */
var test_procedure = {
timeline: [fixation, test],
timeline_variables: test_stimuli,
repetitions: 3,
randomize_order: true
};
timeline.push(test_procedure);
/* define debrief */
var debrief_block = {
type: jsPsychHtmlKeyboardResponse,
stimulus: function() {
var trials = jsPsych.data.get().filter({task: 'response'});
var correct_trials = trials.filter({correct: true});
var accuracy = Math.round(correct_trials.count() / trials.count() * 100);
var rt = Math.round(correct_trials.select('rt').mean());
return `<p>You responded correctly on ${accuracy}% of the trials.</p>
<p>Your average response time was ${rt}ms.</p>
<p>Press any key to complete the experiment. Thank you!</p>`;
}
};
timeline.push(debrief_block);
/* start the experiment */
jsPsych.run(timeline);
The demo above was created using the jsPsych
library—a powerful tool for building behavioral experiments in a web browser. This library provides a flexible framework for designing a wide variety of cognitive tests, making it a favorite among researchers and educators.
What's even more exciting is that this demo is hosted using Cognition. Cognition offers a seamless platform to create, run, and manage online experiments, relieving users of the complexities related to web hosting, data storage, and security.
Inspired by what you've seen? Ready to dive into the world of online experiments? With Cognition, you can run and share your experiments online effortlessly. Whether you're a seasoned researcher or just curious about cognitive tests, Cognition is here to simplify the journey.