Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

Many time series have periodograms that look quite noisy. As an example, consider the neuroscience time series that we looked at in the last lecture.

EEG Motor Movement Dataset

The following dataset was downloaded from https://physionet.org/content/eegmmidb/1.0.0/. The specific dataset details are here: https://physionet.org/content/eegmmidb/1.0.0/. The dataset consists of over 1500 one and two minute (64 channel) EEG recordings, obtained from 109 volunteers. We will pick data for just one subject (volunteer) and one of the EEG channels, and compare the data for eyes open vs eyes closed. A basic finding of cognitive neuroscience is that the power of occipital alpha-band (~10 Hz) brain waves is increased when peoples’ eyes are closed, rather than open (see, for example, the paper titled “Occipital alpha-band brain waves when the eyes are closed are shaped by ongoing visual processes” by Hohaia et al 2022).

For each individual subject (here we are using the data for the first subject), there are 64 time series datasets for “open-eyes” and again 64 time series datasets for “closed-eyes”. These 64 datasets correspond to the 64 channels which are different electrodes recording brain activity. We pick one of the channels, and compare the “open-eyes” and “closed-eyes” data.

Extracting EDF parameters from S001R01.edf...
Setting channel info structure...
Creating raw.info structure...
Reading 0 ... 9759  =      0.000 ...    60.994 secs...
<Info | 8 non-empty values
 bads: []
 ch_names: Fc5., Fc3., Fc1., Fcz., Fc2., Fc4., Fc6., C5.., C3.., C1.., ...
 chs: 64 EEG
 custom_ref_applied: False
 highpass: 0.0 Hz
 lowpass: 80.0 Hz
 meas_date: 2009-08-12 16:15:00 UTC
 nchan: 64
 projs: []
 sfreq: 160.0 Hz
 subject_info: <subject_info | his_id: X, sex: 0, last_name: X>
>
<Figure size 640x480 with 1 Axes>
Extracting EDF parameters from S001R02.edf...
Setting channel info structure...
Creating raw.info structure...
Reading 0 ... 9759  =      0.000 ...    60.994 secs...
<Info | 8 non-empty values
 bads: []
 ch_names: Fc5., Fc3., Fc1., Fcz., Fc2., Fc4., Fc6., C5.., C3.., C1.., ...
 chs: 64 EEG
 custom_ref_applied: False
 highpass: 0.0 Hz
 lowpass: 80.0 Hz
 meas_date: 2009-08-12 16:15:00 UTC
 nchan: 64
 projs: []
 sfreq: 160.0 Hz
 subject_info: <subject_info | his_id: X, sex: 0, last_name: X>
>
<Figure size 640x480 with 1 Axes>

There is a sampling rate associated with these datasets. This is the number of times per second that the data is obtained.

Sampling rate: 160.0 Hz
Sampling rate: 160.0 Hz

The length of these time series is 9760 (see below). This corresponds to 160 observations per second, for a total of 61 seconds.

[0.000000e+00 6.250000e-03 1.250000e-02 ... 6.098125e+01 6.098750e+01
 6.099375e+01]
[0.000000e+00 6.250000e-03 1.250000e-02 ... 6.098125e+01 6.098750e+01
 6.099375e+01]
9760 61.0

Our two datasets are:

Our main goal is to compare these two datasets and to highlight the main ways in which they are different.

<Figure size 640x480 with 2 Axes>
<Figure size 640x480 with 1 Axes>

It is obviously very hard to articulate the differences between the two time series just by looking at their plots. For such datasets, the basic tool is the Periodogram. Recall that the periodogram is given by:

I(j/n):=∣bj∣2n\begin{align*} I(j/n) := \frac{|b_j|^2}{n} \end{align*}

where bjb_j is given by the Discrete Fourier Transform. We plot the periodogram when j/nj/n lies between 0 and 1/21/2.

<Figure size 640x480 with 2 Axes>

The differences are more apparent from the periodograms. To see them better, we plot the periodograms on the log-scale.

<Figure size 1200x500 with 2 Axes>

Below we plot the log-periodograms in the same plot.

<Figure size 640x480 with 1 Axes>

There certainly are differences between the two periodograms. These differences can be seen better if we smooth these periodograms. For this, we use the model: Re(bj),Im(bj)∼i.i.dN(0,γj2)\text{Re}(b_j), \text{Im}(b_j) \overset{\text{i.i.d}}{\sim} N(0, \gamma_j^2) for j=1,…,mj = 1, \dots, m (here m=(n−1)/2m = (n-1)/2), where b0,…,bn−1b_0, \dots, b_{n-1} denote the DFT of the observed data yty_t. The parameters underlying this model are γ12,…,γm2\gamma_1^2, \dots, \gamma_m^2. The model can be written in terms of the periodogram I(j/n)I(j/n) as

I(j/n)=∣bj∣2n∼indf(j/n)ηjI(j/n) = \frac{|b_j|^2}{n} \overset{\text{ind}}{\sim} f(j/n) \eta_j

where ηj∼i.i.dExp(1)\eta_j \overset{\text{i.i.d}}{\sim} Exp(1). The mean of the periodogram f(j/n)f(j/n) is called the power of frequency j/nj/n. The relation between f(j/n)f(j/n) and γj\gamma_j is given by

f(j/n)=2γj2n    for j=1,…,m.f(j/n) = \frac{2 \gamma_j^2}{n} ~~~ \text{ for } j = 1, \dots, m.

If we treat f(j/n)f(j/n) as a function on [0,1/2][0, 1/2] (say by joining successive values by lines), we obtain the power spectral density function.

To estimate γj,j=1,…,m\gamma_j, j = 1, \dots, m in the spectrum model, we use the following estimators (below αj=log⁡γj\alpha_j = \log \gamma_j)

∑j=1m(nI(j/n)2e−2αj+2αj)+λ∑j=2m−1((αj+1−αj)−(αj−αj−1))2\sum_{j=1}^m \left( \frac{nI(j/n)}{2} e^{-2 \alpha_j} + 2 \alpha_j \right) + \lambda \sum_{j=2}^{m-1} \left((\alpha_{j+1} - \alpha_j) - (\alpha_j - \alpha_{j-1}) \right)^2

or

∑j=1m(nI(j/n)2e−2αj+2αj)+λ∑j=2m−1∣(αj+1−αj)−(αj−αj−1)∣.\sum_{j=1}^m \left( \frac{nI(j/n)}{2} e^{-2 \alpha_j} + 2 \alpha_j \right) + \lambda \sum_{j=2}^{m-1} \left|(\alpha_{j+1} - \alpha_j) - (\alpha_j - \alpha_{j-1}) \right|.

The estimate of αj\alpha_j can be converted to the power by

f(j/n)=EI(j/n)=2γj2n=2ne2αjf(j/n) = \mathbb{E} I(j/n) = \frac{2 \gamma_j^2}{n} = \frac{2}{n} e^{2 \alpha_j}
<Figure size 640x480 with 2 Axes>
<Figure size 1000x400 with 1 Axes>
<Figure size 1000x400 with 1 Axes>

The peak in the ‘eyes closed’ curve above can be computed as follows.

[0.06270492 0.1079918  0.24518443]
<Figure size 1000x400 with 1 Axes>

The peak corresponds to the frequency 0.06270492. To convert the frequency to Hertz, we multiply it by the sampling rate.

10.032786885245901

So the differences between the two smoothed periodogram estimates is mainly at frequency 10.0328 Hz. This is very close to the 10Hz Alpha rhythm which apparently exists when eyes are closed as opposed to eyes being open (see, for example, the first sentence in this paper “Occipital alpha-band brain waves when the eyes are closed are shaped by ongoing visual processes” by Hohaia et al 2022). The wiki page on the alpha wave (see Alpha wave) says that alpha waves are neural oscillations in the frequency range 8-12 Hz. We can see from the plot above that at 8 - 12 Hz, the estimated spectrum for the closed eyes data is higher than the spectrm for open eyes data.

<Figure size 640x480 with 1 Axes>

Application: Quake Vibration Dataset

This dataset is from the Mathworks (MATLAB) tutorial “Practical Introduction to Frequency-Domain Analysis” (see this link). From this matlab tutorial: Active Mass Driver (AMD) control systems are used to reduce vibration in a building under an earthquake. An active mass driver is placed on the top floor of the building and, based on displacement and acceleration measurements of the building floors, a control system sends signals to the driver so that the mass moves to attenuate ground disturbances. Acceleration measurements were recorded on the first floor of a three story test structure under earthquake conditions. Measurements were taken without the active mass driver control system (open loop condition), and with the active control system (closed loop condition).

dict_keys(['__header__', '__version__', '__globals__', 'gfloor1OL', 'gfloor1CL'])
(10000, 1)
(10000, 1)
<Figure size 1200x600 with 2 Axes>
<Figure size 1200x600 with 1 Axes>
<Figure size 1200x600 with 1 Axes>
<Figure size 1200x600 with 1 Axes>
<Figure size 1200x600 with 1 Axes>
<Figure size 1200x600 with 1 Axes>

There are three loops on the open loop spectrum and two on the closed loop spectrum. The control system reduces the overall power of the vibrations and gets rid of one harmonic component. In other words, the control system not only reduces the vibration but also brings it closer to a sinusoid.

The main point is that the differences between the two time series is much better summarized using their power spectra, compared to the raw data.