Summary
Event-related potentials (ERPs), measured using electroencephalography (EEG), are electrical brain potentials related to specific events, such as the presentation of visual stimuli. In this protocol, we describe steps for designing an ERP experimental task, measuring EEG, preprocessing EEG data in MATLAB, and exporting ERP data for statistical analyses. This protocol is intended to be applicable to common ERP experiments in cognitive neuroscience.
For complete details on the use and execution of this protocol, please refer to Pütz and colleagues.1
Subject areas: Behavior, Cognitive Neuroscience, Neuroscience
Graphical abstract

Highlights
-
•
Steps for planning ERP experiments with key considerations for experimental design
-
•
Procedures for recording EEG in the lab and monitoring data quality
-
•
Steps for EEG preprocessing with MATLAB example code
-
•
Guidance on identifying and handling common EEG artifacts
Publisher’s note: Undertaking any experimental protocol requires adherence to local institutional guidelines for laboratory safety and ethics.
Event-related potentials (ERPs), measured using electroencephalography (EEG), are electrical brain potentials related to specific events, such as the presentation of visual stimuli. In this protocol, we describe steps for designing an ERP experimental task, measuring EEG, preprocessing EEG data in MATLAB, and exporting ERP data for statistical analyses. This protocol is intended to be applicable to common ERP experiments in cognitive neuroscience.
Before you begin
Electroencephalography (EEG) is a widely used non-invasive neuroimaging technique that enables the measurement of brain activity through electrodes placed on the scalp.2 The EEG signal is measurable on a millisecond scale, making it a preferable methodology for cognitive neuroscientists to study the temporal characteristics of cognitive processes in the brain and the conditions under which they may vary. One of the most commonly studied EEG signals is the event-related potential (ERP), which reflects the averaged EEG activity measured in response to the presentation of a stimulus. ERPs can consist of both positive- and negative-going waves, and certain sub-parts of the ERPs (defined by parameters such as polarity, scalp distribution or timing) make up ERP components that reflect neurocognitive events of interest to the researcher. Obtaining high quality EEG data to study ERP components requires careful considerations about the experimental design, the circumstances of data collection, and data analysis, all of which can affect data quality and interpretability.
The purpose of this protocol is to give an overview of key elements of EEG data acquisition and analysis for ERP experiments in cognitive neuroscience. To do so, the protocol is based on and illustrated with two ERP component examples from Pütz and colleagues,1 namely the feedback-related negativity (FRN) and the late positive component (LPC) ERP components. Following the steps in this protocol will lead to the acquisition and analysis of high-quality EEG data for the study of these ERP components. In addition, with this protocol we aim to create a guidepost to further reading material and resources on each of the steps. Notably, most steps are also applicable to other research questions and ERP components than the ones introduced in Pütz and colleagues.1 The protocol is intended for students and researchers that are about to start their first EEG research project or that would like to refresh their knowledge on EEG data acquisition and analysis.
In Pütz and colleagues,1 participants were instructed to learn which one of four locations on a computer screen yielded more gain feedback than loss feedback than the other three when it was chosen. Participants had forty trials to achieve this task goal. Participants performed nine blocks of forty trials and the location that yielded the most gain feedback was randomly assigned to one of the four locations for each block. The aim of this study was to examine how the FRN and the LPC ERP components, both elicited by the presentation of feedback, change in their amplitude across the forty trials due to learning. The data were averaged over blocks.
Institutional permissions
All experimental procedures involving human participants need to be reviewed by the institution’s ethics committee. In the case of the research that this protocol is based on,1 this committee was the ethical committee of psychology of the University of Groningen. The committee needs to confirm that experiments are designed in accordance with the relevant regulatory standards and must approve the experiments before they can be conducted.
Design the experimental task
Timing: For first-time researchers, we estimate that this part can take up to 1 month to finalize
Here, we describe the steps required to design the experimental task and highlight key aspects that need to be considered when doing so.
-
1.
Define the research question and determine which ERP components you want to study in order to answer it.
Note: ERP components are typically related to the occurrence of specific events. For instance, the FRN and the LPC ERPs are typically found to be elicited by the presentation of feedback in learning tasks, and are therefore used to study how brain activity changes during learning.3 In contrast, sensory ERP components such as the N1 for auditory stimuli and the P100 for visual stimuli are elicited by the presentation of a sensory stimulus and are therefore the main target for studying sensory processing.4,5,6 Lastly, ERP components such as the N2pc have been found to vary depending on where participants focus their attention during a task, and have therefore been studied in the context of spatial attention.1,7,8 An extensive overview of event-related potential components sorted into their specific field of study is provided by Luck and Kappenman.9
Note: We suggest to focus on one question per experiment to ensure clarity in data interpretation and to minimize the possibility of confounding variables.
-
2.Design your experimental task using experiment software that allows precise timing of events, down to the millisecond level.
-
a.Define the trial sequence.
-
b.Design the stimulus screens that define your trial sequences.Note: We do not provide detailed instructions on how to program a computerized experimental task, as this will vary dependent on which software is used. In Pütz and colleagues,1 the software that the experiment was designed and presented in was “Presentation” and documentation on how to program an experiment can be found on their website.10 See materials and equipment for alternative (open-source) software with similar functional abilities.Note: In Pütz and colleagues,1 the stimulus screens were a “Bet” screen that participants used to place a high or low bet indicating their confidence in their location choice (with a “Bet choice” screen that highlighted participant’s choice), a “Location Stimulus” screen (followed by another “choice” screen that highlighted the location stimulus that participants chose), and a “Feedback” screen (see Figure 1).Note: Carefully consider the following when designing your stimulus screen durations: A change of screen implies a shift in sensory and cognitive input, potentially triggering brain activity that could obscure the ERP component of interest. For instance, the LPC ERP remains measurable for up to 1 second after feedback presentation. In Pütz and colleagues,1 the presentation of feedback is followed by a fixation screen and the onset of the next trial, and therefore the duration of the feedback screen and the fixation screen should amount to at least 1 second (i.e. 500 ms from the feedback screen plus at least 500 ms from the fixation screen) to provide sufficient time to analyze the LPC response to feedback information without overlapping ERP components from the next trial being introduced.Note: Counterbalance the presentation of stimulus properties that are not part of your research question, such as color or orientation. Ideally, your experimental conditions only differ in the properties that you want to measure.Note: We recommend to jitter the duration of fixation screens that precede the stimulus screens. The duration jitter can help to avoid creating implicit expectations regarding stimulus presentation and associated preparatory brain activity. It's also noteworthy that some EEG components (e.g., the P33 ERP) are sensitive to the frequency of sensory stimulus occurrences, which may impact your results.Note: In cases where the ERP is deemed extra sensitive to eye movements, eye tracking can be used in combination with EEG recordings to control for voluntary or involuntary eye movements. In addition, with regard to eye movements it should be mentioned that:
-
i.Stimuli that are presented on the screens should be placed as central as possible, since the central portion of your retina (i.e. the fovea) is specialized for detailed color vision.
-
ii.Centrally placed stimuli will also reduce the need to make eye movements, which can obscure the EEG data and can have serious confounding effects.
-
iii.Include fixation screens between relevant stimulus screens.Note: Fixation screens are empty screens with a cross or dot at the center. Participants can be instructed to keep their eyes focused on the cross or dot at the center of the screen, which prevents large eye movements during the experiment. These screens also help to separate the sensory events and cognitive processes that are elicited by the presentation of the stimulus screens. Moreover, fixation screens can also be useful for the baselining procedure because they do not contain meaningful cognitive or sensory input (see EEG Preprocessing).
-
i.
-
c.Run power analyses to determine the number of trials needed and the number of participants that need to be sampled.11,12Note: ERPs can differ widely in the number of trials that need to be averaged to obtain them, and the number of trials needed to observe an effect between experimental conditions. A demonstration on how statistical power in ERP studies is affected by factors such as sample size, trial numbers, and effect size, is provided by Boudewyn and colleagues.13Note: Apart from statistical parameters that can affect power calculations in ERP research, the data quality of the EEG is another important factor that plays into how many trials are eligible for statistical analyses later on. Measuring high-quality EEG data increases the signal-to-noise ratio of the data, leading to less variability between trials and thereby decreasing statistical variance. Therefore, we advise for the researcher to ensure that data quality remains high as early as during data collection by following the steps outlined in this protocol.
-
d.For every screen change and button press, make sure that the experimental task software sends an event output simultaneously to the EEG recording computer.Note: EEG Preprocessing Pipeline shows how these ‘event codes’ are used for data preprocessing and analysis.Note: We recommend to carefully plan ahead which event codes are required and when those have to be sent to the EEG during recording. For instance, in order to analyze how the FRN and LPC components differ in response to gain and loss feedback in Pütz and colleagues,1 two different event codes were needed to identify gains and losses which had to be sent at the exact moment when gain or loss feedback was presented to the participants. In the example scripts below, those event codes were ‘15’ and ‘16’. In addition, forty unique event codes were sent at the start of each trial to analyze how the ERP components change with trial number (the event codes counted from ‘51’ to ‘90’ in the example script below).
-
e.Verify timing accuracy of the event codes.Note: Event code accuracy can be tested with photodiodes placed on the monitor that participants use to view the experimental task. To do so, the photodiode needs to be added as an additional channel to the EEG set-up. Consult your local technician to help with the set-up. Then, run the experimental task while recording EEG with the photodiode channel. Event code timing can be assessed by checking the time difference between when an event code was sent to the EEG/photodiode recording and when the photodiode picked up changes in screen luminance (i.e., a screen change).
CRITICAL: Please be aware that event codes are crucial for synchronizing your EEG traces with events, requiring timing accuracy at the millisecond level. -
f.Determine how participants will provide a response (e.g., key press, key release) and program your experiment accordingly.
CRITICAL: The preparation of a specific motor response (e.g., left- or right hand button press) can affect your EEG measurements (see for instance, the lateralized readiness potential14 as an example for motor-EEG responses). If possible, counterbalance participant’s responses across conditions to avoid potential motor-related confounds in your EEG data. In Pütz and colleagues,1 button responses were counterbalanced by linking a button to a stimulus and not a screen location. As stimuli were randomly assigned to each location on every trial, participants pressed a different button each trial to choose the same screen location.Note: It is always advisable to pilot the experimental task in a few subjects without measuring EEG in order to ensure that the task runs smoothly on the experimental computer and that the task is comprehensible and accessible to someone unfamiliar with it. We also advise to pilot the experimental task in one or two subjects while measuring EEG to check whether the event codes sent by the experimental computer are stored correctly in the EEG file on the EEG recording computer.
-
a.
Figure 1.
Trial Sequence for the experiment conducted in Pütz and colleagues
Figure reprinted with permission from Pütz and colleagues.1
Preparation of the recording room
Timing: approximately 1 h
The following steps describe how to prepare the recording room and which documents to prepare before the participant arrives.
-
3.Prepare the experimental room for the EEG measurement.
-
a.Mark the floor where participant’s seat is situated, to be approximately 60 cm away from the experiment monitor, to ensure that the visual angle and therefore, all visual input is equal among all participants.
-
b.Ensure that the experiment room is sound attenuated and equally lit among all participants.
-
a.
Optional: Check the experimental monitor’s refresh rate using photodiodes. The monitor provides the main visual input used as events in your EEG study and its refresh rate and screen resolution influences how this information is presented and can therefore affect brain activity measured through the EEG. Notably, modern OLED or LCD monitors with high refresh rates enable better temporal precision and therefore provide a better choice than CRT monitors.15
-
4.Create Participant log-sheet.
-
a.Logs participant’s sex, age, handedness, and eye-sight.
-
b.Logs information about the recording procedure that might be useful during the data analysis and interpretation phase of the experiment (such as broken EEG channels, deviations from the experimental protocol, etc.).
-
a.
Note: Try to sample participants of the same handedness, as handedness has been found to modulate brain activity.16,17,18,19 Furthermore, motor cortex activity measurable with EEG during the experiment can differ between left- and right-handers, dependent on which hand is used to make a response.20
CRITICAL: Make sure that participants with impaired vision wear glasses and not contact lenses to minimize eye blinks. Contact lens wearers blink more often, because blinking facilitates tear exchange beneath the lens to avoid the sensation of dry eye.
Key resources table
| REAGENT or RESOURCE | SOURCE | IDENTIFIER |
|---|---|---|
| Software and algorithms | ||
| Presentation | Neurobehavioral Systems, Inc., Albany, CA | www.neurobs.com |
| MATLAB | MathWorks Inc., Natick, MA | www.mathworks.com |
| EEGLAB Package (MATLAB) | Delorme and Makeig21 | https://sccn.ucsd.edu/EEGLAB/index.php |
| FieldTrip Package (MATLAB) | Oostenveld et al.22 | http://FieldTriptoolbox.org |
| EEGo | ANT Neuro bv, Hengelo, The Netherlands | www.ant-neuro.com |
| Other | ||
| EEG recording computer | N/A | Any standard IBM compatible Windows 10 PC |
| Experiment presentation computer | N/A | Any standard IBM compatible Windows 10 PC |
| Button response device | Logitech Rumblepad | Any standard gamepad |
| EEG caps | WaveGuard EEG cap | www.ant-neuro.com |
| EEG amplifier | ANT EEGO64 | www.ant-neuro.com |
Materials and equipment
The researcher’s institution needs to have the necessary physical equipment to conduct traditional EEG experiments in cognitive neuroscience. Traditional EEG laboratories consist of an EEG recording computer, a computer that presents the experiment and sends event codes to the recording computer, EEG caps, response devices, and computer screens to present the experiment with. Consult your local technician if necessary to check the availability and functionality of the equipment.
Next, software for the design of computerized experiments, the recording of EEG data, and the analysis of EEG data is needed. The key resources table refers to software used for this protocol.
Alternative Open-Source Software: OpenSesame23 (design of computerized experiments, with tutorials provided on the website24); MNE25 (Python package for the analysis of EEG, with tutorials provided on the website26).
Note: If possible, use facial electrodes near the eyes to measure horizontal and vertical EOG to reliably detect eye movements and eye blinks27 or use EEG caps with electrodes located near the eye if facial electrodes will not be not feasible to use.
Step-by-step method details
Measurement of the EEG
Timing: An experiment can last for several hours, depending on factors such as the research question, the number of trials used, and the participant population (for instance, adults, children, or patients). However, we generally advise to not run the experiment for longer than 1 h without breaks to avoid effects of fatigue in participants and to avoid very long experimental tasks (>2 h) as this might seriously impact participant’s focus, motivation, and, consequently, their ability to perform the task correctly
The following section describes step-by-step what needs to be done once the participant arrives for the EEG measurement.
-
1.
Cap the participant with the EEG cap according to your EEG facility’s equipment standards.
Note: Companies that distribute EEG equipment also sometimes provide instructional videos on how to cap participants with their equipment.28
-
2.
Measure and reduce impedance levels of all electrodes to be below 5 Ohm.
CRITICAL: Check in the recording software which electrode(s) is(are) used as reference for the recording and which electrode is used as ground. If the live EEG shows high frequency noise in all channels, there might be a problem with the reference electrode(s). If impedance is high on the reference electrodes the data quality of all channels will suffer. In case linked mastoids will be used as reference, make sure that the impedance of both electrodes does not differ significantly, to ensure a balanced average.
-
3.
Set the sampling rate to 512 Hz, matching Pütz and colleagues1 settings.
Note: Sampling rates reflect the number of data points obtained per second and are important for determining the maximum frequency that can be extracted from the data for time-frequency analyses, see Nyquist Theorem.29 That frequency is always half of the sampling rate. The recommended sampling rate is 512 Hz (reflecting 512 data points per second of recorded EEG) but EEG software also usually provides sampling rates as low as 128 Hz (or even lower), if the recording sessions are long and the data files need to be smaller. Note that higher sampling rates increase the size of the data files, whereas lower sampling rates lead to cruder ERP shapes, as less data is available to plot them. Make sure to check the storage capacity on your EEG recording PC before measurements will start to prevent storage overload.
-
4.
Ensure that the recording software settings record the raw data, and that the software does not apply modifications to the live recording like online filtering.
-
5.Instruct participants in the experimental task.
-
a.Instruct the participant to avoid body movements during the experiment.
-
b.Instruct the participant to keep their eyes fixated centrally and to avoid large eye movements.
-
c.Instruct the participant on the experimental procedure and instructions.
-
a.
Note: Ensure that all participants receive the same set of instructions to avoid misunderstandings and to let everyone start on the same page.
Note: Body movements and eye movements, as well as eye blinks, introduce artifacts to your data. Instructing participants to sit still and avoid large eye movements can reduce the occurrence of artifacts. Wearing contact lenses increases the occurrence of eye blinks, so instruct participants with corrected eye-sight to wear their glasses instead. In addition, activating certain muscle groups such as the jaw muscles can create large high-frequency artifacts in the data, and we recommend to instruct participants to remain relaxed and not clench their jaw during the experiment.
CRITICAL: While there are various techniques to deal with bad quality data and to alleviate it, it should always be the highest priority to ensure that the data recorded during the recording session is of good quality to begin with. As discussed in Luck, no analysis or preprocessing technique can replace good data quality30!
-
6.
Run a practice session with the participant.
Note: EEG measurements are usually a novel environment for participants, and so is the specific experiment you are conducting. Let participants familiarize themselves with the set-up to reduce novelty.
Note: Practice sessions help eliminate learning effects during the experiment, as participants will be familiarized with the task once the actual experiment starts. Furthermore, misunderstandings in task instructions can be detected with practice sessions.
-
7.Start the recording session.
-
a.Make sure that your recording software records the EEG in the BrainVision format, which is the format that was used in Pütz and colleagues.1Note: When recording in the BrainVision format, your recordings will contain three separate files, with the file extensions .vhdr, .eeg, .vmk.
-
b.Use the Run-sheet during the recording to log information about unexpected events such as unintentional interruptions during task performance.
-
c.Regularly check the data quality of the online EEG recording during the session and note down any channels displaying low-quality data.Note: The troubleshooting section provides a list of common problems and solutions.
-
a.
EEG preprocessing pipeline
Timing: Running all code examples provided below with the data of one participant from a 1-h-long experiment takes around 35 min in total, excluding time to plot and inspect the data. Most of the time is spent on the ICA and filtering step. For a dataset of 20 participants, we suggest to plan in around 2 weeks for the preprocessing to be finalized
The following section provides step-by-step instructions of the EEG preprocessing pipeline, including MATLAB example code that was partially adapted from preprocessing scripts originally written by Dr. B. van den Berg (personal communication), which make use of the EEGLAB21 and FieldTrip22 toolboxes.
Note: In Pütz and colleagues,1 EEG preprocessing was done using inline code from the MATLAB toolbox EEGLAB21 whereas data binning and averaging was done with inline code from the MATLAB toolbox FieldTrip.22 EEGLAB also has a user interface (for a step-by-step guide, see their website31), but inline code was used instead for its greater flexibility in data preprocessing, specifically for when trial information is extracted and to average data over conditions or participants in FieldTrip. A detailed overview of individual steps can be found in Luck.32 For alternative software, see materials and equipment. Pernet and colleagues provide an overview of how these steps should be reported in your final manuscript and how they can affect data reproducibility.33
Optional: In order to familiarize yourself with the data, it is recommended to inspect the data of individual participants before you start analyzing it and after each preprocessing step.
-
8.
Download EEGLAB and FieldTrip from their respective websites and save them on your computer.
-
9.
Open MATLAB.
-
10.
Copy-paste the code snipped below and adjust the file path in ‘addpath’ to match the location on your computer where the downloaded EEGLAB folder is located.
-
11.
In the first argument in “pop_loadbv”, paste the file path where your EEG recording file is located.
-
12.
In the second argument in “pop_loadbv”, paste the file name of the recording file with the extension ‘.vhdr’.
-
13.
Run the code snipped to start EEGLAB and to run one participant’s data.
>% Add EEGLAB to the search path and start EEGLAB
>addpath('/home/username/path/to/downloaded_EEGLAB_folder');
>EEGLAB;
>% Load EEG data from BrainVision format (.vhdr, .eeg, .vmrk files)
>EEG = pop_loadbv('/home/username/path/to/eegdatafolder/', >'eegdatafile.vhdr');
-
14.Plot the raw EEG to inspect it for anomalies such as bad channels or artifacts:>% Plot raw EEG data for visual inspection (recommended to be performed>after each pre-processing step)>pop_eegplot(EEG); % Press ‘continue’ when prompted
-
a.In the drop-down menu at the top of the screen, click “Display -> Remove DC offset”.
-
b.Check for artifacts such as broken channels or high frequency noise. See troubleshooting for examples.
-
c.Upon observing artifacts in the raw data, consider the following, dependent on the type of artifact:
-
i.If the channel seems to be broken, consider removing the entire channel from the recording.
-
ii.If the data contains high-frequency noise, consider applying the appropriate filter settings (see step 18 below).
-
iii.If the raw data contains too many artifacts, or mainly consists of noise, consider removing the participant from the analyses.Note: Carefully consider how to deal with the artifacts. Some of them can be dealt with by filtering to the data or by applying algorithms such as independent component analysis (ICA).34 However, while these methods can alleviate the problem of noisy data, it is always best to record high quality data from the beginning! See troubleshooting for some common EEG anomalies and how to deal with them.
-
i.
-
a.
-
15.
Re-reference the data to the average reference.
>EEG = pop_reref(EEG, []);
Note: Re-referencing can be done after the recording is done (i.e., offline) without affecting the quality of the data (for more information on how referencing works, see Luck30).
Note: Be aware that activity from broken channels can contaminate all other electrodes when using the average reference. Either remove broken channels from the data or consider alternative references.
CRITICAL: The choice of the reference electrode(s) affects the EEG data measured at all other electrodes, and if the EEG signal recorded through the reference electrode contains noise, so will the signal from all other electrodes. That is because the EEG signal reflects the difference in electrical activity between individual electrodes and the reference electrode. Note down the reference channel that is used by the EEG recording software. In Pütz and colleagues1 that was a central channel (5Z, which corresponds to Cz in the standard 10-20 system). The channel that is ultimately used for the reference should include as little meaningful neural activity of interest as possible. While in Pütz and colleagues,1 the data were re-referenced to the average reference, an alternative and commonly used reference is the average of the electrodes placed above the mastoid bones behind the ear. If the reference used during recording is one of the channels you want to include into the analysis (as in Pütz and colleagues1), you can add this channel back to your data and re-reference your data to another reference. This can be accomplished under the average reference assumption (i.e. the assumption that the average of all electrodes is 0, see for procedure e.g., EEGLAB Wiki webpage31).
-
16.
Run Independent Component Analysis (ICA) implemented in EEGLAB to correct for eye blink- and eye movement artifacts.
Optional: The code below runs ICA on a copy of EEG data set that is epoched into trials, and has segments removed that contained a lot of noise (e.g., segments recorded during breaks where participants moved a lot), and that is band-pass filtered to remove high-frequency noise. Noisy data segments can impact the outcome of ICA and lead to noisy components, making it difficult to isolate independent components containing eye blinks and eye movements. Note that this epoching and filtering is NOT part of the official epoching and filtering steps of the preprocessing pipeline, but that these measures only serve to be able to better isolate components! The ICA results can be transferred to the original EEG dataset which is used for further pre-processing.
Note: ICA takes the longest time to run out of all preprocessing steps. If ICA is run in a loop for multiple participants, we recommend running the script overnight and saving the resulting data files.
>% Segment the data into trials, but save the segmented data under a different name >% to create a copy named ‘ICrun’
>event = {'15', '16'}; % select the event (‘15’ for losses, ‘16’ for gains)
>timewin = [-7, 2.5]; % Extract epochs from -7s to 2.5s around the feedback events
>% (encompassing the entire trial)
>ICrun = pop_epoch(EEG, event,timewin); % epoch the data
>% Apply bandpass filtering (1-30 Hz) to the epoched data
>ICrun = pop_eegfiltnew(ICrun, 1, 30);
>% run ICA on the epoched and filtered data
>ICrun = pop_runica(ICrun, 'extended', 0, 'icatype', 'runica');
>% Transfer ICA weights to the original data (which is yet to be
>% epoched and filtered)
>EEG.icaweights = ICrun.icaweights;
>EEG.icasphere = ICrun.icasphere;
>EEG.icawinv = ICrun.icawinv;
>EEG.icachansind = ICrun.icachansind;
-
17.Plot the results of the ICA as well as the raw EEG signal.>% Optional: Apply filtering (1-30 Hz) for clearer visualization>ICcheck = pop_eegfiltnew(EEG, 1, 30);>% Plot ICA components and raw EEG for manual inspection>pop_eegplot(ICcheck, 0); % ICA components, click “continue” when prompted>pop_eegplot(ICcheck, 1); % EEG signal, click “continue” when prompted
-
a.In the component window, in the drop-down menu at the top, choose to “Settings > Number of channels to display” and set the number to a lower number to improve visibility of the largest components.
-
b.Adjust the scale in the text box at the bottom to a larger number (e.g., 200, dependent on the component size) to improve visibility (see Figure 2).
-
c.Browse through the component window and check for eye blinks and eye movements. Figure 2 shows an example screenshot of both, where component 1 shows eye blinks and component 3 shows eye movements:
-
d.Use the raw EEG window (for an example screenshot, see Figure 3) to check whether the component times overlap with eye blinks in the EEG data:
-
e.Remove the components you identify as containing eye blinks and/or eye movements and plot an overlay of the EEG data before and after removal of the components.>ICcheck = pop_subcomp(ICcheck, [1 3],1);
-
f.In the pop-up that opens, click on “Plot single trials”.
-
g.In the window that opens (see the example screenshot in Figure 4), check whether removing your chosen components successfully removes eye blinks and eye movements from the data without affecting other parts of the EEG data.
-
h.Remove components from your EEG data.>EEG = pop_subcomp(EEG, [1 3]); % Example: removing components 1 and 3Note: There are multiple alternative ways to deal with eye-blink artifacts other than ICA. For instance, instead of correcting for eye blink artifacts, trials containing eye blinks can also be rejected from the analyses altogether. Identification of trials containing eye blinks and eye movement artifacts will benefit from recording the electrooculogram using electrodes placed above and below one of the eyes and at the outer canthi of both eyes.30Note: We suggest to plot the topographical maps of the ICA components to check the spatial location of the activity captured by the components. These maps might facilitate the identification of eye-related artifacts, since these often have a distinct frontal distribution.
-
a.
-
18.
Filter data using a bandpass Hamming windowed finite response filter (FIR) with the cut-off frequencies of 0.01 Hz (-6 dB at 0.005 Hz) and 30 Hz (-6 dB at 33.75 Hz).
>EEG = pop_eegfiltnew(EEG, 0.05, 30);
Note: Filters can affect ERP shapes. High-pass filters with a high cut-off frequency can affect the shape of ERPs, attenuating the amplitudes of large ERP components, introducing artificial peaks to the ERP shape, or change the timing of ERP effects.35,36 Low-pass filters with low cut-off frequencies can also change the peak and onset latencies of ERPs.35
-
19.
Segment the continuous EEG into distinct epochs ranging from – 7000 ms before the onset of the feedback screen to + 2000 ms after the onset of the feedback screen.
Note: Here we are creating epochs that match the length of the entire trial, which becomes important for extracting trial information based on event codes. The length of the epoch defined here does not affect your final ERP shape.
>event = {'15', '16'}; % The event codes you defined for feedback
>timewin = [-7, 2.5]; % The entire trial before and after feedback presentation
>EEG = pop_epoch(EEG, event, timewin); % epoch the continuous EEG
-
20.Create a ‘trial structure’, which contains event information about each trial that is important for creating averages over conditions and analyzing the ERP data. For the current protocol, this concerns trial number, relevant to examine learning over trials, and whether gain or loss feedback was presented.
-
a.Run the code below to loop through each epoch and extract event information of the feedback type and trial number, and store said information in a separate variable called ‘trialstructure’. This is the start of our trial structure.
-
a.
>% Initialize trial structure fields
>trialstructure.fbtype = zeros(length(EEG.epoch),1); % Store feedback event type
>trialstructure.trialNR = zeros(length(EEG.epoch),1); % Store trial number within the >learning set
>for ii = 1:length(EEG.epoch) % Loop through each epoch
> % Find, in the iith epoch, the index of the event where the latency is 0 (the >feedback onset).
> Idx = EEG.epoch(ii).event(cell2mat(EEG.epoch(ii).eventlatency) == 0);
> % Using the index, find the feedback event code in the
> % EEG.event list of events and store it in the trial structure.
> trialstructure.fbtype(ii) = str2double(EEG.event(Idx).type);
> % Identify trial number within the learning set by searching for the event code
> % from minus 4 seconds to minus 1 second before the event code for feedback was >sent.
> % The code was always a number between 51 and 90.
> tmp = cell2mat({EEG.event.latency}) > (EEG.event(Idx).latency - 4000) & ...
> cell2mat({EEG.event.latency}) < (EEG.event(Idx).latency - 1000);
> tmp = find(tmp & ismember({EEG.event.type}, {'51', '52', '53', '54', '55', '56', >'57', '58', '59', '60', '61', '62', '63', '64', '65', '66', '67', '68', '69', '70', >'72', '73', '74', '75', '76', '77', '78', '79', '80', '81', '82', '83', '86', '87', >'88', '89', '90'}));
>trialstructure.trialNR(ii)=str2double(EEG.event(tmp).type);
>end
Optional: If you want to extract more trial information than trial number and feedback type, paste the code snippet below into the for loop above and adjust the ‘event’ part in the variable name ‘Trial.event’ to match your desired additional trial event. In addition, change the numbers ‘100’ and ‘200’ to match your desired event codes (or add additional event codes), and adjust the time window parameters to match the approximate latencies when the event code was sent relative to feedback.
>tmp = cell2mat({EEG.event.latency}) > (EEG.event(Idx).latency - 4000) &
>cell2mat({EEG.event.latency}) < (EEG.event(Idx).latency - 1000); % Use the time
>window between -4000 ms to -1000 ms before the feedback onset
>tmp = find(tmp & ismember({EEG.event.type}, {'100','200'})); % extract whether event
>100 or 200 was sent in that time window
>Trial.event(ii)=str2double(EEG.event(tmp).type); % add the information to the trial
>structure
-
21.Baseline the EEG. The code example below performs the following steps:
-
a.In each epoch, calculate the mean voltage of the time-period before the onset of the feedback screen (i.e., - 500 ms period before feedback onset).
-
b.Subtract this mean voltage from the EEG activity after the feedback screen.
-
a.
>EEG = pop_rmbase(EEG, [-500 0]);
Note: During EEG recording, slow voltage drifts in the data may occur due to a variety of reasons unrelated to the experiment. The same ERP component measured at different time points in the experiment may therefore have different absolute amplitude values. Baselining is done to remove these slow voltage drifts.36 It is assumed that EEG activity measured in the baseline window consists of random activity unrelated to the cognitive process that is of interest, and that baselining does not affect the ERP. Therefore, it is crucial that the baseline window does not include systematic and meaningful EEG activity which may artificially change the shape of the ERP (such as anticipatory [motor] activity that is present in one condition but not in another).
-
22.
Convert the EEGLAB data to FieldTrip, add the trial structure that we generated in step 20 to the ‘data’ structure.
-
23.
Remove the EEGLAB folder from your paths in MATLAB and add the FieldTrip folder instead.
>data = EEGLAB2FieldTrip(EEG, 'preprocessing');
>data.trialstruct = Trial;
>rmpath('/home/username/path/to/EEGLAB_folder'); % remove EEGLAB from the paths, as >this sometimes causes errors
>addpath('/home/username/path/to/FieldTrip_folder'); % add FieldTrip to your paths
-
24.Detect and reject artifacts.
-
a.In each epoch, check whether there are amplitude values that exceed a pre-defined threshold of +/−120 μV.
-
b.If there are amplitude values above the threshold, mark the epoch as containing an artifact.
-
c.Add the artifact information obtained per epoch to the trial structure.
-
a.
Note: In Pütz and colleagues,1 the threshold value of +/−120 μV was based on previous work.7
>% Set artifact detection parameters
>threshold = 120; % Voltage threshold for artifact detection (μV)
>timeIntv = [-0.5 2]; % Time window for artifact detection (seconds)
>% Initialize artifact detection structure (0 = no artifact, 1 = artifact detected)
>data.trialstruct.artThresh = zeros(length(data.trial), 1);
>% Loop through all EEG channels (electrodes)
>for j = 1:length(data.label)
> % Loop through all trials (epochs)
> for tmpTrl = 1:length(data.trial)
> % Time interval for artifact detection within the trial
> tmpInt = data.time{tmpTrl} > timeIntv(1) & data.time{tmpTrl} < timeIntv(2);
> % Check if any value in the selected time window exceeds the threshold
> if (any(max(abs(data.trial{tmpTrl}(:, tmpInt))) > threshold))
> data.trialstruct.artThresh(tmpTrl) = 1; % Mark trial as containing >artifacts
> end
> end
>
> % Display artifact detection results for the current electrode
> disp(['Electrode ' (data.label(j)) ': Threshold of ' num2str(threshold) ' >detected ' num2str(sum(data.trialstruct.artThresh)) ' artifacts'])
>end
Note: While running a script to detect artifacts makes their detection faster and easier, it is strongly advised to check single-trial EEG data afterwards to check why trials are marked as artifacts and have to be removed. Also be aware that artifacts can occur systematically. For instance, participants might get impatient in later moments of the experiment, thereby move more and create more movement artifacts. If later in the recording session only one condition is measured, that condition will end up with less trials for the analyses. Removing those trials therefore introduces systematic variation in the data which can affect your results.
Note: Some artifacts can be linked to specific recording parameters, such as body movement or electrocardiographic (ECG) activity. See troubleshooting for a list of common artifacts and their potential sources. Several algorithms exist to mark and remove those artifacts during preprocessing, see Urigüen and colleagues34 for some examples.
-
25.Repeat steps 11 – 24 with all participants.
-
a.For each participant, save the FieldTrip ‘data’ variable, using that participant’s number in the filename to be able to trace them back.
-
b.In MATLAB, open the folder where you want your participant’s data to be saved into.
-
c.In the code snippet below, replace the ‘i’ in 'participantfile_' num2str(i) '.mat' with the participant number. This code snippet can be embedded in a loop where ‘i’ is the looping variable that loops through all participants.
-
a.
>save('participantfile_' num2str(i) '.mat','data');
Note: We advise to run the preprocessing steps in a loop for all participants, and to save the data of each participant after every preprocessing step (especially after running the ICA, as this step takes the longest to run).
-
26.Create the average ERPs elicited by the presentation of gain and loss feedback per participant using FieldTrip. The code snippet below does the following:
-
a.Loads each participant’s datafile that was saved in the previous step.
-
b.For each participant, creates a variable ‘cond’ that indexes, using the trial structure, which trials you want to average. For this protocol, we want to bin the following trials:
-
i.Gain trials which occurred in the first eight trials of the learning set and which were not marked as artifact trials (‘cond.earlygain’).
-
ii.Loss trials which occurred in the first eight trials of the learning set and which were not marked as artifact trials (‘cond.earlyloss’).
-
iii.Gain trials which occurred in the last eight trials of the learning set and which were not marked as artifact trials (‘cond.lategain’).
-
iv.Loss trials which occurred in the last eight trials of the learning set and which were not marked as artifact trials (‘cond.lateloss’).
-
i.
-
c.For each participant, loops through all conditions and create the grandaverage per condition, and saves the participant’s grandaverages in the variable ‘timelock’.
-
a.
>for i = 1:N
> load(['participantfile_' num2str(i) '.mat'])
> cond.earlygain =ismember(data.trialstruct.trialNR, 51:58) & >ismember(data.trialstruct.fbtype,16) & ismember(data.trialstruct.artThresh, 0);
> cond.earlyloss =ismember(data.trialstruct.trialNR, 51:58) & >ismember(data.trialstruct.fbtype,15) & ismember(data.trialstruct.artThresh, 0);
> cond.lategain = ismember(data.trialstruct.trialNR, 83:90) & >ismember(data.trialstruct.fbtype,16) & ismember(data.trialstruct.artThresh, 0);
> cond.lateloss = ismember(data.trialstruct.trialNR, 83:90) & >ismember(data.trialstruct.fbtype,15) & ismember(data.trialstruct.artThresh, 0);
>
> fn = fieldnames(cond);
> for icond = 1:length(fn)
> cfg = [];
> cfg.trials = cond.(fn{icond}); % select trials that satisfy the condition
> cfg.latency = [-0.5 2]; % average -0.5s before to 2s after feedback >presentation
> timelock.(fn{icond}){i} = ft_timelockanalysis(cfg,data);
> end
>end
-
27.
Create the average across all participants per condition and store them in the variable ‘FeedbackERP’.
>fn = fieldnames(timelock);
>for icond = 1:length(fn);
> cfg = [];
> cfg.latency = [-0.5 2.];
> FeedbackERP.(fn{icond}) = ft_timelockgrandaverage(cfg, timelock.(fn{icond}){:})
>end
-
28.
Plot the average ERP signal of frontal channels evoked by feedback presentation (i.e., the FRN, depicted in Figure 5) using the variable ‘FeedbackERP’.
>cfg = [];
>cfg.xlim = [-0.5 2]; % X-axis limits (time)
>cfg.ylim = [-3 7]; % Y-axis limits (amplitude)
>cfg.channel = {'2Z','3Z','4Z','3L','4L','3R','4R'}; % which channels to average for >plotting
>% What the ERP lines should look like:
>cfg.linewidth = 2;
>cfg.linestyle = {'-' '-' ':' ':'};
>cfg.linecolor=[50/255 86/255 183/255;
> 250/255 120/255 0/255;
> 50/255 86/255 183/255;
> 250/255 120/255 0/255];
>% plot the four conditions:
>ft_singleplotER(cfg,FeedbackERP.earlygain,FeedbackERP.earlyloss,FeedbackERP.lategain>,FeedbackERP.lateloss);
>% Add figure title, axis labels and formatting, and legend
>title('feedback presentation');xlabel('time (ms)'); ylabel('amplitude (uV)');
>legend({'early gain',' early loss','late gain','late loss'}, 'location','southeast')
>set(gca,'Ytick',-10:1:10)
>set(gca,'Xtick',-0.5:0.1:2)
-
29.
Plot the average ERP signal of parietal channels evoked by feedback presentation (i.e., the LPC, depicted in Figure 5) using the variable ‘FeedbackERP’.
>cfg = [];
>cfg.xlim = [-0.5 2]; % X-axis limits (time)
>cfg.ylim = [-3 10]; % Y-axis limits (amplitude)
>cfg.channel = {'4Z','5Z','6Z','5L','6L','5R','6R'}; % which channels to average for >plotting
>% What the ERP lines should look like:
>cfg.linewidth = 2;
>cfg.linestyle = {'-' '-' ':' ':'};
>cfg.linecolor=[50/255 86/255 183/255;
> 250/255 120/255 0/255;
> 50/255 86/255 183/255;
> 250/255 120/255 0/255];
>% plot the four conditions:
>ft_singleplotER(cfg,FeedbackERP.earlygain,FeedbackERP.earlyloss,FeedbackERP.lategain>,FeedbackERP.lateloss);
>% Add figure title, axis labels and formatting, and legend
>title('feedback presentation');xlabel('time (ms)'); ylabel('amplitude (uV)');
>legend({'early gain','early loss','late gain','late loss'}, 'location','southeast')
>set(gca,'Ytick',-10:0.5:10)
>set(gca,'Xtick',-0.5:0.1:2)
-
30.Export the ERP data as a .csv file for statistical analyses.
-
a.Define, for each ERP, the time window of interest (TOI) and the region of interest (ROI).>LPCTOI = [0.4 0.8];>LPCROI = {'4Z' '5R' '5L' '6Z''5Z' '6L' '6R'};>FRNTOI = [0.24 0.34];>FRNROI = {'2Z','3Z','4Z','3L','4L','3R','4R'};
-
b.Loop through each trial and average the amplitudes for both the FRN and LPC within their respective time windows of interest (TOIs) and regions of interest (ROIs, i.e., the electrode channels).
-
c.Store the averaged amplitudes in two separate variables in the trial structure, and export the trial structure for statistical analyses.>% initialize FRN and LPC trial structure variables>data.trialstruct.FRN = zeros(length(data.trial),1);>data.trialstruct.LPC = zeros(length(data.trial),1);>for tmpTrl = 1:length(data.trial)> LPCInt = data.time{tmpTrl} > LPCTOI(1) & data.time{tmpTrl} < LPCTOI(2); % LPC TOI> LPCiR = find(ismember(data.label,LPCROI)); % find LPC ROI> >data.trialstruct.LPC(tmpTrl)=squeeze(mean(mean(data.trial{tmpTrl}(LPCiR,LPCInt),1),2)); % average>> FNRInt = data.time{tmpTrl} > FRNTOI(1) & data.time{tmpTrl} < FRNTOI(2); % FRN TOI> FRNiR = find(ismember(data.label,FRNROI)); % find FRN ROI> >data.trialstruct.FRN(tmpTrl)=squeeze(mean(mean(data.trial{tmpTrl}(FRNiR,FNRInt),1),2)); % average>>end>writetable(struct2table(data.trialstruct), 'trialstructure.csv','Delimiter',',' )Note: The regions and time windows (ROIs and TOIs, respectively) selected here were determined based on previous work and known characteristics of each ERP. Always consult the literature on your ERP of interest to gain an overview of which ROIs and which TOIs are most often used to analyze the ERP component you are interested in analyzing. Pilot experiments or cross-validation procedures can help if you are unsure about whether the ROIs and TOIs reported in the literature translate to your set-up or if they are undetermined or variable.
-
a.
Figure 2.
EEGLAB window displaying the first eleven components resulting from running ICA in one participant
(1) Components. (2) A component containing lateral eye movement artifacts. (3) A component containing an eye blink artifact. (4) Buttons used for scrolling through the components in time. The box allows for manual time entry (in seconds). (5) Buttons used for adjusting the scale for better visualization. The box allows for manual scale entry.
Figure 3.
EEGLAB window displaying raw EEG data, to be compared to the previous figure to determine whether components match the occurrence of eye artifacts
(1) EEG channels. (2) Lateral eye movement artifacts that match in time and shape with the lateral eye movement artifacts displayed in component 3 of Figure 2. (3) Eye blink artifact matching in time and shape with the eye blink artifact displayed in component 1 of Figure 2. (4) Buttons used for scrolling through the EEG in time. The time shown here matches the time in Figure 2. (5) Buttons used for adjusting the scale for better visualization. The box allows for manual scale entry.
Figure 4.
EEGLAB window popping up when running “pop_subcomp” with the third argument set to 1, which plots the raw EEG before (blue traces) and after (red traces) component removal
The enlarged portion of the image shows that removing component 1 and 3 removes eye blink and eye movement artifacts fairly well without affecting the rest of the EEG.
Figure 5.
ERP shapes obtained by following the steps described in the protocol
Top: The Feedback-related negativity component in response to gain and loss feedback during the first and last eight trials of every learning set. Bottom: The Late Positive Component in response to gain and loss feedback during the first and last eight trials of every learning set. Figure reprinted and adapted with permission from Pütz and colleagues.1
Expected outcomes
With the time-windows defined in the epoching procedure of this protocol, the ERP shapes should look similar to the ones illustrated in Figure 2. Note that these are adapted figures of Figure 2 of Pütz and colleagues1 to match this protocol’s epoching steps.
Quantification and statistical analysis
ERPs analyzed in Pütz and colleagues,1 were quantified based on the average amplitude in a given time-window of the time-locked ERP (depicted in Figure 2 as the black boxes). To determine the FRN amplitude, the frequently reported latencies of FRN peak values in the literature were used as a guide. These typically range between 200 and 300 ms after feedback onset.7,37 First, the average FRN waveform over all trials and participants was created, and the latency of the maximum peak value occurring within this 200 – 300 ms time-window was determined. Based on this value, the analysis window was then set ranging from −50 ms before the maximum peak latency to +50 ms after the maximum peak latency. In Pütz and colleagues,1 the average of the maximum peak value in the FRN time-window across participants occurred at 290 ms. The average amplitude value of the FRN for every trial and participant was subsequently extracted from the ROIs between 240 ms and 340 ms after the presentation of feedback. For the LPC, the analysis window was determined entirely based on previous work in the literature, because the LPC is not characterized by amplitude peaks that could be used to as a guide.3,38 Here, amplitude values from 400 to 800 ms after the presentation of feedback were averaged from the regions of interest for the LPC. Next, the average amplitude values for every ERP were treated as a continuous variable in the statistical tests. Notably, alternative approaches exist, such as regression ERPs39 and more advanced techniques like generalized additive models.40 In addition, consult Luck30 for a list of potential alternative approaches.
Limitations
This protocol is applicable to most EEG experiments conducted in human participants for cognitive neuroscientific research. However, deviations may need to be applied dependent on the research question and event-related potential of interest. Always consult the literature to obtain an overview on how a given ERP is measured and analyzed.
Troubleshooting
This section lists common artifacts in EEG and is illustrated with examples for most of them. These artifacts should be checked for when first inspecting the raw data, a step that is part of the EEG preprocessing pipeline of this protocol. We recommend visiting https://www.learningeeg.com/artifacts41 for more example illustrations of artifacts.
Problem 1: Power line noise (50/60 Hz noise)
Power line noise is noticeable as oscillatory high-frequency noise at around 50 Hz (in Europe) or 60 Hz (USA) in all channels (see Figure 6 for an illustration). It can be detected by plotting the raw data or the frequency spectrum of the data.
Figure 6.
EEGLAB window displaying power line noise in all electrodes
Power line noise is visible as rhythmic high frequency activity.
Potential solution
Power Line noise is caused by the equipment set-up to be in close proximity to electrical devices, improper grounding, or interference from power sources (for instance, a phone charging nearby or lab equipment).
Make sure to position your setup away from any source of electrical interference. Replace the ground electrode. Power line noise can be alleviated by applying a notch or low – pass filter during preprocessing.
Problem 2: Electrode pop or drift
Electrode pop or drift is noticeable as either sudden, sharp spikes or gradual drifting in one/a few or all electrodes during the recording. Figure 7 provides a visual example of electrode drift.
Figure 7.
EEGLAB window displaying continuous EEG with electrode drift in two channels, highlighted with the black box
Potential solution
Re-apply the electrode gel or saline, as it might have dried out. Alternatively, check that no cables are moved accidentally (e.g., because the participant moves around a lot). Also check that everything is properly plugged in.
Problem 3: Muscle artifacts (electromyographic or EMG activity)
Muscle artifacts occur in the form of high-frequency noise that is typically seen in frontal and temporal channels during the recording, as shown in Figure 8. EMG activity will generally be less pronounced at central electrode sites.
Figure 8.
EEGLAB window displaying continuous EEG with muscle artifacts visible in some channels
The artifact highlighted in the black box most likely stem from clenching of the jaw, as it is most pronounced in the electrodes in proximity to the jaw muscles.
Potential solution
Muscle artifacts are caused by muscle activity due to, for example, as clenching the jaw, raising the eyebrows or wrinkling the forehead. Kindly ask your participant to relax these muscles and to refrain from head movements.
Problem 4: Body movement artifacts
Movement artifacts occur in the form of irregular, large fluctuations in the EEG signal typically observable in all recording channels (visualized in Figure 9).
Figure 9.
EEGLAB window displaying continuous EEG with movement artifact
Potential solution
Movement artifacts occur because participants move around, like shifting their position, adjusting the head, or moving limbs. Therefore, kindly ask your participant to sit still during the recording. Provide an adjustable chair to optimize the participant’s comfort and consider using a chinrest to minimize head movements.
Problem 5: Eye movements and blinks (electrooculographic or EOG artifacts)
Eye movement artifacts are recognizable as slow, large-amplitude waves, especially affecting frontal electrodes or sudden step-like changes in amplitude. Figure 10 provides an example of continuous EEG with lateral eye movement artifacts, and Figure 11 provides an example of continuous EEG with horizontal eye movement artifacts.
Figure 10.
EEGLAB window displaying continuous EEG with lateral eye movements highlighted in the black box
Figure 11.
EEGLAB window displaying continuous EEG with eye blink artifacts highlighted in the black boxes
Potential solution
Eye movement artifacts are typically caused by blinking or lateral eye movements, which produce electrical activity near the eye electrodes (if present in your equipment set-up). Kindly ask your participant to be aware that blinking causes artifacts. To minimize eye movements, use fixation points in your experimental task or let participants know when blinking is allowed. Wearing contact lenses can lead to more blinking, so ask participants to bring their corrective glasses if needed.
Problem 6: Electrocardiogram artifact (heartbeat interference)
ECG artifacts are visible as periodic spikes that align with the heartbeat frequency, usually detectable in temporal electrodes that touch the bare skin, and especially electrodes near the neck. Figure 12 provides some examples of ECG artifacts in the continuous EEG recording.
Figure 12.
EEGLAB window displaying continuous EEG with ECG artifacts highlighted in the black boxes
Potential solution
Adjust the positioning of the EEG cap. ECG artifacts can be detected and removed in preprocessing with established methods (e.g. see Urigüen and Garcia-Zapirain34).
Problem 7: Pulse artifact
Pulse artifacts are visible as rhythmic oscillations in the signal that correspond to the pulse rate.
Potential solution
Pulse artifacts are caused by electrodes placed over blood vessels, which can pick up pulsatile blood flow. Adjust the positioning of the EEG cap slightly.
Problem 8: Sweat artifact
Sweat artifacts are visible as slow drifts in the baseline of the signal during recording.
Potential solution
Sweat artifacts are caused by increased sweating, which can lead to impedance changes between the electrode and skin. Re-apply electrode gel and re-check impedance in all electrodes.
Problem 9: Breathing artifacts
Breathing artifacts are visible as low-frequency oscillations in the EEG signal.
Potential solution
Breathing artifacts are movement artifacts caused by deep or irregular breathing that affects overall body posture and movement. Check on your participant and kindly ask them to remain still during the experiment.
Problem 10: Cable or electrode lead artifacts
Cable or electrode lead artifacts are characterized by sudden spikes or large swings in the signal due to mechanical disturbances.
Potential solution
Check your equipment set-up. Cable or electrode lead artifacts are caused by movement of electrode leads, often from poor cable management or mechanical disturbances.
Problem 11: High electrode impedance
High electrode impedance is visible as a reduced signal quality or frequent disconnections in the recorded EEG signal.
Potential solution
Re-check whether your impedance levels are acceptable (i.e. below 5 Ohm) in your recording software. High impedance is usually caused by poor electrode-to-skin contact, often due to insufficient conductive gel or dry skin.
Resource availability
Lead contact
Further information and requests for resources should be directed to and will be fulfilled by the lead contact, Monicque Lorist (m.m.lorist@rug.nl).
Technical contact
Technical questions on executing this protocol should be directed to and will be answered by the technical contact, Mark Span (m.m.span@rug.nl).
Materials availability
This study did not generate new unique reagents.
Data and code availability
The data supporting the current protocol are not publicly available because participants did not give their explicit consent to do so. Codes supporting the current protocol have not been deposited in a public repository but are available from the corresponding author upon request.
Acknowledgments
We would like to credit Dr. B. van den Berg for providing the original MATLAB code that formed the basis for the example code presented in this manuscript.
Author contributions
C.P. and M.L. developed the outline of the protocol, and C.P. wrote the protocol and formatted it to match the formatting guidelines. M.S. provided additional key steps and input. All authors provided feedback and helped shape the final version of the protocol.
Declaration of interests
The authors declare no competing interests.
References
- 1.Pütz C., van den Berg B., Lorist M.M. Dynamic modulation of neural feedback processing and attention during spatial probabilistic learning. iScience. 2022;25 doi: 10.1016/j.isci.2022.104302. [DOI] [PMC free article] [PubMed] [Google Scholar]
- 2.Cohen M.X. Where Does EEG Come From and What Does It Mean? Trends Neurosci. 2017;40:208–218. doi: 10.1016/j.tins.2017.02.004. [DOI] [PubMed] [Google Scholar]
- 3.Glazer J.E., Kelley N.J., Pornpattananangkul N., Mittal V.A., Nusslock R. Beyond the FRN: Broadening the time-course of EEG and ERP components implicated in reward processing. Int. J. Psychophysiol. 2018;132:184–202. doi: 10.1016/j.ijpsycho.2018.02.002. [DOI] [PubMed] [Google Scholar]
- 4.Paiva T.O., Almeida P.R., Ferreira-Santos F., Vieira J.B., Silveira C., Chaves P.L., Barbosa F., Marques-Teixeira J. Similar sound intensity dependence of the N1 and P2 components of the auditory ERP: Averaged and single trial evidence. Clin. Neurophysiol. 2016;127:499–508. doi: 10.1016/j.clinph.2015.06.016. [DOI] [PubMed] [Google Scholar]
- 5.Barry R.J., De Blasio F.M., Rushby J.A., MacDonald B., Fogarty J.S., Cave A.E. Stimulus intensity effects and sequential processing in the passive auditory ERP. Int. J. Psychophysiol. 2022;176:149–163. doi: 10.1016/j.ijpsycho.2022.03.005. [DOI] [PubMed] [Google Scholar]
- 6.Page J.W., Duhamel P., Crognale M.A. ERP evidence of visualization at early stages of visual processing. Brain Cogn. 2011;75:141–146. doi: 10.1016/j.bandc.2010.11.001. [DOI] [PubMed] [Google Scholar]
- 7.Van Den Berg B., Geib B.R., San Martín R., Woldorff M.G. A key role for stimulus-specific updating of the sensory cortices in the learning of stimulus–reward associations. Soc. Cogn. Affect. Neurosci. 2019;14:173–187. doi: 10.1093/scan/nsy116. [DOI] [PMC free article] [PubMed] [Google Scholar]
- 8.Kiss M., Jolicœur P., Dell’Acqua R., Eimer M. Attentional capture by visual singletons is mediated by top-down task set: New evidence from the N2pc component. Psychophysiology. 2008;45:1013–1024. doi: 10.1111/j.1469-8986.2008.00700.x. [DOI] [PMC free article] [PubMed] [Google Scholar]
- 9.Luck S.J., Kappenman E.S., editors. The Oxford Handbook of Event-Related Potential Components. Oxford University Press; 2012. [Google Scholar]
- 10.Neurobehavioral Systems Inc. Presentation software. https://neurobs.com/
- 11.Faul F., Erdfelder E., Buchner A., Lang A.G. Statistical power analyses using G∗Power 3.1: Tests for correlation and regression analyses. Behav. Res. Methods. 2009;41:1149–1160. doi: 10.3758/BRM.41.4.1149. [DOI] [PubMed] [Google Scholar]
- 12.Lakens D., Caldwell A.R. Simulation-based power analysis for factorial analysis of variance designs. Adv. Methods Pract. Psychol. Sci. 2021;4 doi: 10.1177/2515245920951503. [DOI] [Google Scholar]
- 13.Boudewyn M.A., Luck S.J., Farrens J.L., Kappenman E.S. How many trials does it take to get a significant ERP effect? It depends. Psychophysiology. 2018;55:e13049. doi: 10.1111/psyp.13049. [DOI] [PMC free article] [PubMed] [Google Scholar]
- 14.Smulders F.T.Y., Miller J.O. Oxford University Press; 2011. The Lateralized Readiness Potential at. [DOI] [Google Scholar]
- 15.Dimigen O., Stein A. A high-speed OLED monitor for precise stimulation in vision , eye-tracking , and EEG research. 2024. [DOI]
- 16.Ocklenburg S., Friedrich P., Schmitz J., Schlüter C., Genc E., Güntürkün O., Peterburs J., Grimshaw G. Beyond frontal alpha: investigating hemispheric asymmetries over the EEG frequency spectrum as a function of sex and handedness. Laterality. 2019;24:505–524. doi: 10.1080/1357650X.2018.1543314. [DOI] [PubMed] [Google Scholar]
- 17.Tomasi D., Volkow N.D. Associations between handedness and brain functional connectivity patterns in children. Nat. Commun. 2024;15:2355. doi: 10.1038/s41467-024-46690-1. [DOI] [PMC free article] [PubMed] [Google Scholar]
- 18.Kim J., Lee K., Lee E. N100, N200, and P300 auditory event-related potentials depending on handedness and response tasks such as button pressing and mental counting. Audiol. Speech Res. 2020;16:314–320. doi: 10.21848/ASR.200059. [DOI] [Google Scholar]
- 19.McAssey M., Brandt T., Dieterich M. EEG analysis of the visual motion activated vection network in left- and right-handers. Sci. Rep. 2022;12:19566–19613. doi: 10.1038/s41598-022-21824-x. [DOI] [PMC free article] [PubMed] [Google Scholar]
- 20.Schmitz J., Packheiser J., Birnkraut T., Hinz N.A., Friedrich P., Güntürkün O., Ocklenburg S. The neurophysiological correlates of handedness: Insights from the lateralized readiness potential. Behav. Brain Res. 2019;364:114–122. doi: 10.1016/j.bbr.2019.02.021. [DOI] [PubMed] [Google Scholar]
- 21.Delorme A., Makeig S. EEGLAB: An open source toolbox for analysis of single-trial EEG dynamics including independent component analysis. J. Neurosci. Methods. 2004;134:9–21. doi: 10.1016/j.jneumeth.2003.10.009. [DOI] [PubMed] [Google Scholar]
- 22.Oostenveld R., Fries P., Maris E., Schoffelen J.M. FieldTrip: Open source software for advanced analysis of MEG, EEG, and invasive electrophysiological data. Comput. Intell. Neurosci. 2011;2011 doi: 10.1155/2011/156869. [DOI] [PMC free article] [PubMed] [Google Scholar]
- 23.Mathôt S., Schreij D., Theeuwes J. OpenSesame: An open-source, graphical experiment builder for the social sciences. Behav. Res. Methods. 2012;44:314–324. doi: 10.3758/s13428-011-0168-7. [DOI] [PMC free article] [PubMed] [Google Scholar]
- 24.Mathôt S. OpenSesame. https://osdoc.cogsci.nl/4.0/
- 25.Gramfort A., Luessi M., Larson E., Engemann D.A., Strohmeier D., Brodbeck C., Goj R., Jas M., Brooks T., Parkkonen L., Hämäläinen M. MEG and EEG data analysis with MNE-Python. Front. Neurosci. 2013;7:267. doi: 10.3389/fnins.2013.00267. [DOI] [PMC free article] [PubMed] [Google Scholar]
- 26.MNE Developers MNE-Python. https://mne.tools/stable/index.html
- 27.Pegg S., Dao A., Venanzi L., Hill K., Kujawa A. The impact of electrode selection for ocular correction on the reward positivity and late positive potential components in adolescents. Psychophysiology. 2024;61:e14497. doi: 10.1111/psyp.14497. [DOI] [PMC free article] [PubMed] [Google Scholar]
- 28.Ant Neuro GmbH Ant Neuro Academy. https://academy.ant-neuro.com/
- 29.Weiergräber M., Papazoglou A., Broich K., Müller R. Sampling rate, signal bandwidth and related pitfalls in EEG analysis. J. Neurosci. Methods. 2016;268:53–55. doi: 10.1016/j.jneumeth.2016.05.010. [DOI] [PubMed] [Google Scholar]
- 30.Luck S.J. The MIT Press; 2014. An Introduction to the Event-Related Potential Technique. [Google Scholar]
- 31.Makeig S., Delorme A. EEGlab Wiki. https://eeglab.org/
- 32.Luck S.J. Applied Event-Related Potential Data Analysis (LibreTexts) 2022. [DOI]
- 33.Pernet C., Garrido M.I., Gramfort A., Maurits N., Michel C.M., Pang E., Salmelin R., Schoffelen J.M., Valdes-Sosa P.A., Puce A. Issues and recommendations from the OHBM COBIDAS MEEG committee for reproducible EEG and MEG research. Nat. Neurosci. 2020;23:1473–1483. doi: 10.1038/s41593-020-00709-0. [DOI] [PubMed] [Google Scholar]
- 34.Urigüen J.A., Garcia-Zapirain B. EEG artifact removal - State-of-the-art and guidelines. J. Neural. Eng. 2015;12 doi: 10.1088/1741-2560/12/3/031001. [DOI] [PubMed] [Google Scholar]
- 35.Tanner D., Morgan-Short K., Luck S.J. How inappropriate high-pass filters can produce artifactual effects and incorrect conclusions in ERP studies of language and cognition. Psychophysiology. 2015;52:997–1009. doi: 10.1111/psyp.12437. [DOI] [PMC free article] [PubMed] [Google Scholar]
- 36.Tanner D., Norton J.J.S., Morgan-Short K., Luck S.J. On high-pass filter artifacts (they’re real) and baseline correction (it’s a good idea) in ERP/ERMF analysis. J. Neurosci. Methods. 2016;266:166–170. doi: 10.1016/j.jneumeth.2016.01.002. [DOI] [PubMed] [Google Scholar]
- 37.Holroyd C.B., Coles M.G.H. The neural basis of human error processing: Reinforcement learning, dopamine, and the error-related negativity. Psychol. Rev. 2002;109:679–709. doi: 10.1037/0033-295X.109.4.679. [DOI] [PubMed] [Google Scholar]
- 38.Pornpattananangkul N., Nusslock R. Motivated to win: Relationship between anticipatory and outcome reward-related neural activity. Brain Cogn. 2015;100:21–40. doi: 10.1016/j.bandc.2015.09.002. [DOI] [PMC free article] [PubMed] [Google Scholar]
- 39.Smith N.J., Kutas M. Regression-based estimation of ERP waveforms: I. The rERP framework. Psychophysiology. 2015;52:157–168. doi: 10.1111/psyp.12317. [DOI] [PMC free article] [PubMed] [Google Scholar]
- 40.Mulder K., Bosch L.t., Boves L. Interspeech 2016: 17th Annual Conference of the International Speech Communication Association INTERSPEECH 08-12-Sept. 2016. Comparing different methods for analyzing ERP signals; pp. 1373–1377. [DOI] [Google Scholar]
- 41.Valentine D. Artifacts. https://www.learningeeg.com/artifacts
Associated Data
This section collects any data citations, data availability statements, or supplementary materials included in this article.
Data Availability Statement
The data supporting the current protocol are not publicly available because participants did not give their explicit consent to do so. Codes supporting the current protocol have not been deposited in a public repository but are available from the corresponding author upon request.

Timing: For first-time researchers, we estimate that this part can take up to 1 month to finalize










