Time Series and Spectral Analysis Part V. Spectral Analysis: Sonia - Gouveia@ua - PT
Time Series and Spectral Analysis Part V. Spectral Analysis: Sonia - Gouveia@ua - PT
Time Series and Spectral Analysis Part V. Spectral Analysis: Sonia - Gouveia@ua - PT
Sónia Gouveia
( sonia.gouveia@ua.pt )
stae 2021
Figures from Brockwell and Davies (2016) and Shumway and Stoffer (2010).
Slide 4 of 20
Some ideas
Cyclic dynamics are the rule rather than the exception, as many data show such
temporal pattern…
The cosine parameters, 𝑎𝑘 , and sine parameters, 𝑏𝑘 , convey the degree to which the
respective functions are correlated with the data. This regression model is a finite
Fourier series for a discrete time series.
Slide 8 of 20
Note that
• there are no degrees of freedom for error, because the number of coefficients equals
the length of the time series (𝑛);
• the intercept term 𝑎0 is just the mean of the time series;
• the lowest possible frequency is one cycle or 2𝜋 radians per record length, which is
2𝜋/𝑛 per sampling interval (𝑘 = 1);
• a general frequency, in this representation, is 𝑘 cycles per record length or 2𝜋𝑘/𝑛
radians per sampling interval.
• the highest frequency is 0.5 cycles per sampling interval (𝑘 = 𝑛/2) corresponding
to 𝜋 radians per sampling interval.
Slide 9 of 20
Nyquist frequency
𝑛/2−1
2𝜋𝑘𝑡 2𝜋𝑘𝑡
𝑥𝑡 = 𝑎0 + 𝑎𝑘 cos + 𝑏𝑘 sin + 𝑎𝑛/2 cos 2𝜋0.5𝑡
𝑛 𝑛
𝑘=1
Many time series are of a variable that is continuous in time but is sampled to give a
time series at discrete time steps.
The frequency resolution and frequency range are determined by the sampling interval
(Δ𝑡) and record length 𝑛 :
• the sampling interval (or sampling rate) constrains the highest frequency possible to
detect (also known as the Nyquist frequency),
• the length of the time series determines the lowest frequency possible to distinguish.
In general, the sampling frequency is 𝑓𝑠 = 1/Δ𝑡 and the Nyquist frequency becomes
𝑓𝑠 /2. For example, if 𝑥𝑡 is sampled every week (Δ𝑡 = 1 ⇒ 𝑓𝑠 /2 = 0.5) then it is not
possible to detect cycles less than 1/0.5 = 2 weeks in length.
Slide 10 of 20
Periodogram
The periodogram quantifies the contributions of the individual frequencies to the time
series regression and is defined as
𝑃𝑘 = 𝑎𝑘2 + 𝑏𝑘2
where 𝑃𝑘 is the periodogram value at frequency 𝑘 (for 𝑘 = 1, … , 𝑛/2 ). The
periodogram is calculated through the fast Fourier transform algorithm (FFT).
• The periodogram values can be interpreted in terms of variance of the data at the
respective frequency or period.
• If a large correlation (sine or cosine coefficient) is identified then there is a strong
periodicity of the respective frequency (or period) in the data.
delta_t=1
t = seq(0,100,by=delta_t)
x = cos(2*pi*t/16) + 0.75*sin(2*pi*t/5)
par(mfrow=c(1,2))
plot(t,x,'l')
stats::spectrum(x, log="no")
Slide 11 of 20
Spectral densities
Suppose that 𝑋𝑡 is a zero-mean stationary process with ACVF 𝛾𝑋 satisfying
σ∞
ℎ=−∞ 𝛾𝑋 ℎ < ∞. The spectral density of 𝑋𝑡 is the function
∞
1
𝑋 𝜔 = 𝛾𝑋 ℎ 𝑒 −𝑖ℎ𝜔 , −∞ ≤ 𝜔 ≤ ∞
2𝜋
ℎ=−∞
Spectrum estimation
The spectrum estimation methods can be classified as:
• Parametric methods
Based on parametric models of a time series e.g. autoregressive moving average
(ARMA) models. The model parameters are first estimated from the data and then the
spectrum is obtained considering the estimated model. It is a model-driven approach.
• Nonparametric methods
It is a data-driven approach based on the discrete Fourier transform. Includes many
algorithms including the periodogram method and the Welch method (averaged
periodogram).
stae 2021
stae 2021
stae 2021
𝜙 = 0.7 𝜙 = −0.7
stae 2021
𝜃 = 0.7
𝜃 = −0.7
stae 2021
stae 2021
stae 2021
4. References
stae 2021
References
• Brockwell P.J. and Davies R.A. (2016), Introduction to Time Series and Forecasting (3rd ed), Springer
Texts in Statistics. (https://link.springer.com/content/pdf/10.1007%2F978-3-319-29854-2.pdf)