
Baseline correction of neural and other signals
Check out github.com for code related to this tutorial.
Baseline correction: Background
Electroencephalography (EEG) and magnetoencephalography (MEG) signals (among others) might drift over time and different EEG/MEG channels might exhibit such drifts and/or DC (direct current) offsets differently. These drifts and offsets can be due to sweating and skin conductance or other noise sources. In order to investigate the neural response to an event one would thus like to remove these "uninteresting" signals.
The term baseline correction in electroencephalography (EEG) and magnetoencephalography (MEG) refers to the procedure of relativizing the brain signal of interest with respect to a control (baseline) signal (commonly shortly before a stimulus event). It is a very common procedure for the analysis of time-domain data (e.g., event-related potentials; ERPs) or time-frequency data (i.e., power obtained from spectral decomposition using, for example, wavelet convolution or Fourier transformation). However, in particular for time-frequency data, there is no consensus on which baseline correction should be used. For time-domain signals, the 'absolute' baseline is commonly used.
Types of baseline corrections
For an additional approach see Grandchamp & Delorme (2011). For time-domain signals, the absolute baseline is the most common correction and should be the default. For time-frequency data, there is not yet a consensus in the literature, although decibel baseline is often considered the most appropriate because it reduces skew in the distribution of power values (see simulations below). However, recent work highlights that the decibel baseline is negatively biased (see "Decibel baseline: a downward bias" below; Kinley et al. 2026). If you would like to express power changes in decibels, use the mean-log-ratio baseline instead. Please also see Urbach & Kutas (2006) who have commented on the potential problems using baseline corrections.
In some cases one might be able to replace the time-domain baseline correction by using a high-pass filter with a strong DC (direct current) suppression. Papers making use of this approach are, for example, Maess et al. (2006) or Herrmann et al. (2014).
Common types of baseline corrections are (in Matlab syntax, X being the signal and B the baseline; B typically reflects the mean across a baseline time window, whereas X individual time points; this is the issue mean-log-ratio addresses):
Absolute baseline:
-
range: [-inf inf]
-
formula: X - B
Relative baseline:
-
range: [0 inf]
-
formula: X / B
Relative chance (relchange):
-
range: [-1 inf]
-
formula: (X - B) / B
Decibel baseline (only for power):
-
range: [-inf inf]
-
formula: 10*log10(X / B)
Mean-log-ratio baseline (only for power):
- range: [-inf inf]
- formula: 10*log10(X) - mean(10*log10(Btime))
where Btime are the signal values within the baseline time window
Baseline correction: Distributions
Baseline corrections might introduce skewed data distributions. The "relative" baseline and the "relchange" baseline appear to be particularly prone to introduce skewed (non-Gaussian) data distributions. This might affect data plotting and statistics: linear plotting and parametric statistics might be inappropriate. For the following simulations, the power in the baseline time window (-1 to 0 sec.) relative to the power in the time window of interest (0 to 1 sec.) is linearly changed for 1702 power time courses. For half of the time courses, the mean baseline power is larger than the mean power for the time window of interest. For the other half, the mean baseline power is smaller. Four example time courses (out of 1702) are shown on the left.

On the right, the mean baseline-corrected power is plotted for the 1702 power time courses (separately for each baseline). The mean baseline-corrected power of the four time courses (displayed on the left) are color-coded. The blue and green dots are of particular interest (a large power decrease relative to the baseline [blue] vs. a large power increase relative to the baseline [green]). Although the change for the blue and green time courses are of similar magnitude, the mean baseline-corrected power for the relative and relchange baselines lead to drastic magnitude differences. This is because if the mean baseline power is large relative to the power in the time window of interest, the baseline-corrected power is squeezed into a small range (0 to 1 for relative; -1 to 0 for relchange). This simple simulation shows that depending on the type of baseline correction, the distribution of baseline-corrected power values can be skewed (for further simulations on this see next the section). In this regard, the 'absolute' and 'decibel' baseline corrections have better properties than the 'relative' and 'relchange' baseline corrections. The same holds for the mean-log-ratio baseline, which has the same distribution shape as the decibel baseline.
Baseline correction: Distributions might depend on variance
For additional simulations on distributional changes introduced by baseline corrections, you might be interested in this document which is based on this simulation script. Some of the simulation results are reproduced here:

The plots above show distributions (histograms) of power values for different baseline correction types. The histograms are based on a signal distribution (N=100000; Gaussian noise, with a mean of 10) and a baseline distribution (N=100000; Gaussian noise, with a mean of 5). Standard deviations (relative to the mean; for details see the matlab script) for the distributions were varied (SDx - signal; SDb - baseline). The plots above reflect the changes in the distribution depending on the standard deviations. In particular the power values for relative and relchange baselines can have very skewed distributions after the correction.
Baseline correction: Single trials vs. average
Depending on the research question, single trials or the average across trials might be analyzed. Importantly, baseline correction will produce different results depending on the stage at which the correction is applied (except for the "absolute" baseline). Baseline correction can be applied on single trials before trials are averaged, or trials are averaged first and baseline correction is applied on the averaged signal.
The comparison between the "baseline first" (baseline correction on single trials and then average across trials) versus "baseline second" (average across trials followed by baseline correction) approaches is shown in the following example (Matlab syntax). In the example, X contains two trials (rows) and four time points (columns). The average across the first two of the time points are considering the baseline. Xm is the average across trials, and Bm the baseline for the trial average.
Example code:
X = [1 2 3 4; 4 5 6 7] % two trials with 4 time samples; rows = trials
Xm = mean(X,1) % across-trial average
B = mean(X(:,[1 2]),2) % mean of first 2 time samples = baseline
B = repmat(B,1,size(X,2)) % in matlab, B needs to have the same dimensions as X
Bm = mean(B,1) % baseline for across-trial average
Blog = mean(10*log10(X(:,[1 2])),2) % mean of log values of first 2 samples = log baseline
Blog = repmat(Blog,1,size(X,2))
Bmlog = mean(10*log10(Xm([1 2]))) % log baseline for across-trial average
% 'absolute' baseline
mean(X – B) == Xm-Bm % same
% 'relative' baseline
mean(X ./ B) ~= Xm./Bm % different
% 'relchange' baseline
mean((X-B) ./ B) ~= (Xm-Bm)./Bm % different
% 'decibel' baseline (this baseline is defined only for power)
mean(10*log10(X ./ B)) ~= 10*log10(Xm./Bm) % different
% 'mean-log-ratio' baseline (log first, then absolute baseline; only for power)
mean(10*log10(X) - Blog) ~= 10*log10(Xm) - Bmlog % different
Decibel baseline: a downward bias
The decibel baseline takes the logarithm of the average baseline power, but the logarithm of each individual time point in the time window of interest. These two are not comparable: averaging first and then taking the logarithm gives a larger number than taking the logarithm first and then averaging (Jensen's inequality). For example, for the values 1, 10, and 100, the ordinary average is 37, whereas the average in log space corresponds to 10. Because power values are skewed (mostly modest values with occasional large bursts), individual time points tend to fall below the baseline average, and the decibel baseline indicates a decrease in power even when nothing has changed.
The bias is largest for single trials (about -2.5 dB per time point for exponentially distributed power and a long baseline window). It becomes smaller when trials are averaged before the baseline correction (roughly -0.1 dB for 20 trials and -0.02 dB for 100 trials in the same setting), but it is systematic. It can therefore become statistically significant across participants, and it can differ between conditions or groups that differ in the number of trials or in noise levels. Kinley et al. (2026) demonstrate the bias with simulated and real EEG data.
The fix is simple: take the logarithm first and then subtract the baseline mean (mean-log-ratio baseline). The mean-log-ratio baseline keeps the advantages of the decibel baseline (units in dB, reduced skew). Like the decibel baseline, it assumes that baseline and signal power are related multiplicatively.
A quick check on your own data: after baseline correction, the mean within the baseline time window should be 0 dB. For the decibel baseline it is negative, and its value is an estimate of the bias.
Script
A MATLAB script for computing the different types of baseline correction can be found here.