Question Regarding Baseline Correction in Time-Frequency Analysis of Auditory MMN Data
10 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Hi all,
I am currently working with auditory MMN data where each stimulus lasts for 300 ms with an interval of 500 ms. I plan to perform time-frequency analysis using epochs from -300 ms to 500 ms to investigate theta-band brain activity. In the time-frequency analyses, the signal was processed with a series of complex Morlet wavelets.
However, I have encountered an issue with baseline correction when performing wavelet transform. Given that the lowest frequency of interest is around 4 Hz (which corresponds to a period of 250 ms), baseline correction requires including at least one full cycle of this frequency. But in wavelet transform, Edge Effects of Windows would result in losing one cycle data.
Given this situation, does this mean that my data might not be suitable for time-frequency analysis? Are there alternative approaches or solutions for baseline correction in this scenario?
Any advice or suggestions would be greatly appreciated.
Thank you!
Best regards,
Elaine
2 comentarios
Star Strider
el 7 de Sept. de 2024
What baseline needs to be corrected?
What sort of tiime-frequency analysis are you planning to do? (What function or functions are you intending to use?)
Respuestas (1)
William Rose
el 8 de Sept. de 2024
Editada: William Rose
el 8 de Sept. de 2024
[Edit: fix spelling errors]
I understand that you want to do time-frequency analysis on EEG data evoked by auditory stimuli. Each stimulus lasts for 300 ms and there is a 500 ms gap between stimuli. You chop up the EEG data into 800 ms long epochs, starting 300 ms before each stimulus. You are investigating the mismatch negativity response. Perhaps you are investigating the ability of wavelet time-frequency analysis (wavelet TFA) to estimate the presence, or relative magnitude, of the MMN response. You want to include frequencies as low as 4 Hz in your analysis. You want to remove baseline variation, but you are concerned that removal of baseline variation will affect the frequencies of interest in the signal.
I recommend that you do a linear detrend of the time domain signal in each epoch, to remove the mean and linear trend, if any, from the baseline. Then apply a 1.5 Hz Butterworth high pass filter to the signal, to attenuate any remaining baseline variations at frequencies of 1.5 Hz and lower. This will not affect a 4 Hz component too much. I realize that in theory, a high pass Butterworth also removes the mean value and linear trend. In practice, you are likely to get better results if you detrend, and then apply a high pass filter. You can demonstrate this with synthetic signals.
You make two statements which I do not fully understand.
1."Given that the lowest frequency of interest is around 4 Hz (which corresponds to a period of 250 ms), baseline correction requires including at least one full cycle of this frequency."
I don't understand why "baseline correction requires including one full cycle". Any kind of frequency analysis requires at least one full cycle of the lowest frequency being analyzed, and the analysis will be more reliable if more than one full cycle is measured. I do understand that if you correct too much for possible baseline variation, you may reduce important low frequency components in your signal. Your epoch duration is 800 ms, which is more than 3 cycles of a 4 Hz signal. There are 500 ms (2 full cycles of 4 Hz) from stimulus onset to end of epoch. I think you are OK. More on that below.
2. "But in wavelet transform, Edge Effects of Windows would result in losing one cycle data."
I do not know enough about wavelet transforms to know if this is true. When you divide the signal into epochs with 800 ms duration, you are, in effect, applying an 800 ms long rectangular window to the signal. If you were doing Fourier analysis, the low frequencies in the spectrum would be 1.25, 2.5, 3.75, 5.0,... Hz, and I would not put much faith in the spectrum estimates at 1.25 and 2.5 Hz, due to the rectangular window edge effects and the presence of only one or two cycles in the epoch. But the wavelet transform is different; it uses logarithmically spaced frequencies, and the lowest frequency in the cwt() is higher than 1/(epoch duration). See examples below.
Matlab's cwt() includes the optional argument cwt(..., ExtendSignal=1) or cwt(..., ExtendSignal=0). The Matlab help says "If ExtendSignal is false, the signal is extended periodically. Extending the signal symmetrically can mitigate boundary effects." The Help also says the default is 1. I recommend experimenting with simulated data to understand the effect of this option on your data.
The frequencies in the CWT depend on what wavelet you select for analysis. I recommend the Morlet wavelet ("amor"), since it give the lowest low frequency of the three options. The actual lowest and highest frequencies also depend on the sampling rate. The frequencies do not depend on the ExtendSignal option value.
Example:
Te=0.8; % epoch duration (s)
Fs=1000; % sampling rate (Hz)
N=Te*Fs; % epoch duration (samples)
x=randn(1,N); % signal for analysis
[cw,f]=cwt(x,'amor',Fs); % compute cwt and vector of frequencies
disp(f([1,2,end-2,end-1,end])') % display highest and lowest freqs
[cw,f]=cwt(x,'morse',Fs);
disp(f([1,2,end-2,end-1,end])')
[cw,f]=cwt(x,'bump',Fs);
disp(f([1,2,end-2,end-1,end])')
You can see from the results above that the lowest frequency is lower (3.54 Hz), and the spacing is finer, with the "amor" (Morlet) wavelet family. If you change the sampling rate (Fs), you will notice other changes.
2 comentarios
William Rose
el 8 de Sept. de 2024
@Elaine, Thank you fo the additional information and links. You have educated me. I now think the situation regarding edge effects and baseline is even worse than you have stated, and that your protocol will not allow you to investigate frequencies as low as 4 Hz.
I now understand that, when you say you want to remove baseline variation, the way you do this is by measuring the power spectrum (using the cwt) before each stimulus, and comparing the baseline spectrum to the power spectrum after stimulus onset. My answer above was for removing low frequency drift from the signal, and does not address the duration of baseline required to do spectrum estimation at baseline.
The website you cited says here that the Morlet wavelet with 1 Hz center frequency has a FWHM of 3 s. Therefore a Morlet wavelet with 4 Hz center frequency has a FWHM of 0.75 s, and edge effects occur when one is withing half of the FWHM, i.e. within about 0.38 s, for a Morlet wavelet with 4 Hz center frequency. Does the wavelet transform (wt) returned by Matlab's [wt,f]=cwt() utilize a wavelet with 4 Hz center frequency to compute the 4 Hz value in the wt? I assume it does, but I am not 100% sure. Assuming it does, then you want 0.38 s on either side of your baseline estimation window, and the duration of the baseline estimation window should be at least 0.75 s, if you want to estimate frequencies as low as 4 Hz. Therefore th total pre-stimulus period would be (at least) 1.50 s = 0.38+0.75+0.37. You divide your epochs so that the pre-stimulus period is 0.30 s. Therefore, following the arithmetic above, the lowest frequency in the baseline spectrum which you should attempt to estimate is 20 Hz. (For a 20 Hz Morlet wavelet, FWHM=3 s/20= 0.15 s. YOu need 0.075 s on each side plus 0.15 in the middle = 0.30 s total baseline duraiton, which is what you have.)
Ver también
Categorías
Más información sobre Continuous Wavelet Transforms en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!