Part 4
Part 4
⊲ MATH11131
analysis
Part 4: Frequency
Frequency analysis
Ioannis Papastathopoulos
School of Mathematics, University of Edinburgh
1 / 24
MATH11131 Part 4: Frequency
analysis
⊲ Frequency analysis
Motivation
Lutenizing hormone data
Periodogram
Example: Sine wave with white noise
Example: Sine wave with white noise
AR(1), 0.9
AR(1), -0.9
Example
Comments
Reminder: Multivariate normal
distribution
Analysis of variance
Spectral analysis of variance Frequency analysis
Properties of the periodogram
A trigonometric lemma
Reminder: Basic definitions
Spectrum
Examples
Comments
Spectral distribution
Example
Scaling
Frequency domain analysis
2 / 24
Motivation
As we can write
the right-hand side of (1) is equivalent to any sinusoidal function with frequency ω.
3 / 24
Lutenizing hormone data
100
Comments
3.5
Reminder: Multivariate normal
distribution
Analysis of variance
Spectral analysis of variance
80
Properties of the periodogram 3.0
A trigonometric lemma
Reminder: Basic definitions
Fourier Series
60
Spectrum
Examples
2.5
lh
Comments
Spectral distribution
40
Example
Scaling
2.0
20
1.5
0
0 10 20 30 40 0 10 20 30 40
Time Time
4 / 24
Periodogram
5 / 24
Example: Sine wave with white noise
2
Comments
1
Reminder: Multivariate normal
distribution
0
Analysis of variance
−2 −1
Spectral analysis of variance
Properties of the periodogram
A trigonometric lemma
Reminder: Basic definitions 0 100 200 300 400 500
Spectrum
Examples Index
Comments
Spectral distribution
Series: x
Example
Raw Periodogram
Scaling
Frequency domain analysis
1e+01
spectrum
1e−01
1e−03
frequency
bandwidth = 0.000577
6 / 24
Example: Sine wave with white noise
2
Reminder: Multivariate normal
distribution
0
Analysis of variance
Spectral analysis of variance
−2
Properties of the periodogram
A trigonometric lemma
Reminder: Basic definitions 0 100 200 300 400 500
Spectrum
Examples Index
Comments
Spectral distribution
Series: x
Example
Raw Periodogram
Scaling
1e+02
Frequency domain analysis
spectrum
1e+00
1e−02
frequency
bandwidth = 0.000577
7 / 24
AR(1), 0.9
4
Reminder: Multivariate normal
2
distribution
Analysis of variance
−2
Spectral analysis of variance
Properties of the periodogram
A trigonometric lemma
−6
Reminder: Basic definitions
Spectrum 0 100 200 300 400 500
Examples
Time
Comments
Spectral distribution
Example Series: x
Scaling Raw Periodogram
Frequency domain analysis
1e+01
spectrum
1e−03
frequency
bandwidth = 0.000577
8 / 24
AR(1), -0.9
2 4 6
Example: Sine wave with white noise
AR(1), 0.9
⊲ AR(1), -0.9
Y
Example
−2
Comments
Reminder: Multivariate normal
−6
distribution
Analysis of variance
Spectral analysis of variance 0 100 200 300 400 500
Properties of the periodogram
Time
A trigonometric lemma
Reminder: Basic definitions
Spectrum Series: x
Examples Raw Periodogram
Comments
Spectral distribution
1e+01
Example
spectrum
Scaling
Frequency domain analysis
1e−03
frequency
bandwidth = 0.000577
9 / 24
Example
3.5
1.00
AR(1), -0.9
⊲ Example
3.0
Comments
0.20
spectrum
Reminder: Multivariate normal
2.5
lh
distribution
Analysis of variance
0.05
2.0
Spectral analysis of variance
Properties of the periodogram
0.01
1.5
A trigonometric lemma
Reminder: Basic definitions
Spectrum 0 10 20 30 40 0.1 0.2 0.3 0.4 0.5
Examples Time frequency
Comments bandwidth = 0.00601
Spectral distribution
Example Series: lh
Scaling
100
1.0
Frequency domain analysis
0.8
80
Fourier Series
0.6
60
0.4
40
0.2
20
0.0
0
Time frequency
10 / 24
Comments
Low frequency variation (trend) appears at the left of the periodogram, and high
MATH11131 Part 4: Frequency
analysis
frequency variation (rapid oscillations) appears at the right.
Frequency analysis
Motivation
The rationale for considering only the frequencies ω = 2πj/n is that
Lutenizing hormone data
Periodogram
Example: Sine wave with white noise
n
X m
X
Example: Sine wave with white noise
AR(1), 0.9
yt2 = I(0) + 2 I(j/n) + I(1/2), (2)
AR(1), -0.9
Example
t=1 j=1
⊲Reminder:
Comments
Multivariate normal
distribution with I(1/2) Pincluded only if n is even. Thus the periodogram decomposes the total
Analysis of variance
Spectral analysis of variance variability yt2 of the data into components associated with each of these frequencies,
Properties of the periodogram
A trigonometric lemma plus one for the grand mean I(0) = nȳ 2 which we ignore because it is not periodic.
Reminder: Basic definitions
Spectrum
Examples The rationale for plotting the log periodogram is that the periodogram ordinates are
Comments
Spectral distribution (roughly) exponentially distributed, and the log-transformation is variance-stabilising for
Example
Scaling the exponential distribution. A rough significance scale for the log-periodogram is shown
Frequency domain analysis
by the vertical line on its right.
The cumulative periodogram provides a visual test of whether the series white noise.
We compare Cr with its expected value r/m: a large value of the
Kolmogorov-Smirnov statistic D = max|Cr − r/m| suggests that the underlying
series is not white noise. The test involves seeing whether the cumulative periodogram
falls outside a diagonal band, whose width determines the size of the test.
11 / 24
Reminder: Multivariate normal distribution
Definition 2. Let µ = (µ1 , . . . , µn )T ∈ Rn and Σ be n × n positive definite matrix with
MATH11131 Part 4: Frequency
analysis
elements σjk . Then we say that the random vector X = (X1 , . . . , Xn )T with density
Frequency analysis
Motivation 1 1 T −1 n
Lutenizing hormone data
f (x; µ, Σ) = n/2 1/2
exp − (x − µ) Σ (x − µ) , x, µ ∈ R ;
Periodogram
Example: Sine wave with white noise
(2π) |Σ| 2
Example: Sine wave with white noise
AR(1), 0.9
AR(1), -0.9 has a multivariate normal distribution with expectation vector µn×1 and covariance
Example
Comments matrix Σn×n .
Reminder: Multivariate normal
⊲ distribution
Analysis of variance Some facts:
Spectral analysis of variance
Properties of the periodogram
A trigonometric lemma
the distribution is determined by its mean and covariances
Reminder: Basic definitions
Spectrum
Examples
Comments
E(Xj ) = µj , var(Xj ) = σjj , cov(Xj , Xk ) = σjk , j 6= k
Spectral distribution
Example
Scaling and Xi independent of Xj ⇒ σjk = 0;
Frequency domain analysis
iid
if X1 , . . . , Xn ∼ N (µ, σ 2 ), then Xn×1 = (X1 , . . . , Xn )T ∼ Nn (µ1n , σ 2 In );
linear combinations of normal variables are normal:
12 / 24
Analysis of variance
ind −1/2 T
in an obvious notation, and Zj ∼ N (dj qj µ, σ 2 ).
This implies that Zj2 have independent non-central σ 2 χ21 distributions, with
non-centrality parameters δj = (qjT µ)2 /(dj σ 2 ). In particular, if qjT µ = 0, i.e., the jth
column of Q is orthogonal to the mean vector µ, then Zj2 ∼ σ 2 χ21 .
Different choices of Q will give different decompositions of the variation in Y .
13 / 24
Spectral analysis of variance
Write stj = sin(tωj ), ctj = cos(tωj ), ωj = 2πj/n, for j = 1, . . . , m = n/2 ,
MATH11131 Part 4: Frequency
analysis
t = 1, . . . , n. Then Lemma 1 tells us that the columns of the n × n matrix
Frequency analysis
1 s11 c11 s12 c12 · · · s1m c1m
Motivation
Lutenizing hormone data
Periodogram 1 s21 c21 s22 c22 · · · s2m c2m
Example: Sine wave with white noise
Example: Sine wave with white noise
Q= .
1 .. .
.. .
.. .
.. .
..
,
AR(1), 0.9
AR(1), -0.9
Example
1 sn1 cn1 sn2 cn2 · · · snm cnm
Comments
Reminder: Multivariate normal
distribution
Analysis of variance are orthogonal (and therefore span Rn ), and QT Q = diag(n, n/2, . . . , n/2) = D, say.
⊲ Spectral analysis of variance With this choice of Q, we have
Properties of the periodogram
A trigonometric lemma
Reminder: Basic definitions ( n )2 ( n )2
Spectrum
2 X 2 X
Examples
Comments Z12 = nȲ 2 , Z2j
2
= Yt sin(ωj t) 2
Z2j+1 = Yt cos(ωj t)
Spectral distribution n t=1 n t=1
Example
Scaling
Frequency domain analysis 2 2
so I(j/n) = (Z2j + Z2j+1 )/2, etc., and this leads to the decomposition (2), i.e.,
n
X m
X
Yt2 = I(0) + 2 I(j/n) + I(1/2),
t=1 j=1
14 / 24
Properties of the periodogram
Frequency analysis
Theorem 1. If Y1 , . . . , Yn ∼ N (µ, σ 2 ), then all the periodogram ordinates are independent,
Motivation
Lutenizing hormone data
and
Periodogram
Example: Sine wave with white noise (a) I(1/n), . . . , I(m/n) are exponential random variables with mean σ 2 ;
Example: Sine wave with white noise
AR(1), 0.9
AR(1), -0.9
Example
(b) if n is even, I(1/2) ∼ σ 2 χ21 ; finally,
Comments
Reminder: Multivariate normal
distribution
Analysis of variance
(c) the cumulative periodogram ordinate
Spectral analysis of variance
⊲ Properties of the periodogram Pr
A trigonometric lemma j=1 I(j/n)
Reminder: Basic definitions Cr = Pm , r = 1, . . . , m,
l=1 I(l/n)
Spectrum
Examples
Comments
Spectral distribution
Example
has a beta(r, m − r) distribution, and so has mean and variance r/m, r(m − r)/m
Scaling
Frequency domain analysis
Part (a) says that Gaussian white noise has a flat spectrum. In fact the assumption of
Gaussianity is needed only for the independence, and the spectrum of non-Gaussian white
noise is flat.
15 / 24
A trigonometric lemma
Lemma 1.(a) Let ωj = 2πj/n, for n ∈ N and positive integer j < n/2, and write
MATH11131 Part 4: Frequency
ct = cos(tωj ), st = sin(tωj ). Then
analysis
Frequency analysis n n n n n
Motivation
X X X X X
Lutenizing hormone data
Periodogram
ct = st = st ct = 0, s2t = c2t = n/2.
Example: Sine wave with white noise t=1 t=1 t=1 t=1 t=1
Example: Sine wave with white noise
AR(1), 0.9
AR(1), -0.9
Example
(b) If ω1 = 2πj1/n, ω2 = 2πj2 /n for positive integers j1 6= j2 < n/2, and we write
Comments
Reminder: Multivariate normal
ckt = cos(tωk ), skt = sin(tωk ) for k = 1, 2, then
distribution
Analysis of variance
Spectral analysis of variance
n
X n
X n
X
Properties of the periodogram
⊲ A trigonometric lemma s1t s2t = s1t c2t = c1t c2t = 0.
Reminder: Basic definitions
t=1 t=1 t=1
Spectrum
Examples
Comments
Spectral distribution
(c) If n is odd, and we write
stj = sin(tωj ), ctj = cos(tωj ), ωj = 2πj/n, for
Example
Scaling
j = 1, . . . , m = n/2 , t = 1, 2, . . . , n, then the columns of the n × n matrix
Frequency domain analysis
···
1 s11 c11 s12 c12 s1m c1m
1 s21 c21 s22 c22 ··· s2m c2m
Q=
1 .. .. .. .. .. ,
. . . . .
1 sn1 cn1 sn2 cn2 ··· snm cnm
16 / 24
Reminder: Basic definitions
17 / 24
Spectrum
The spectrum provides a convenient summary of the second-order properties of the process
in a single function, and also shows the effect of linear operations on the series very simply.
18 / 24
Examples
19 / 24
Comments
The form of the spectrum suggests that
MATH11131 Part 4: Frequency
analysis
R 1/2
We easily see that −1/2 f (ω)dω = γ0 .
The spectrum need not exist.
20 / 24
Spectral distribution
Theorem 2 (No proof).(a) The numbers {γh }h∈Z are the autocovariance function of a
MATH11131 Part 4: Frequency stationary random sequence iff there exists a unique bounded function F defined on
analysis
Frequency analysis
[− 12 , 12 ] such that F (−1/2) = 0, F is right-continuous and non-decreasing, with
Motivation
Lutenizing hormone data
symmetric increments about zero, and
Periodogram
Example: Sine wave with white noise
Z
e2πihudF (u), h ∈ Z.
Example: Sine wave with white noise
AR(1), 0.9 γh =
AR(1), -0.9
(−1/2,1/2]
Example
Comments
Reminder: Multivariate normal
distribution The function F is called the spectral distribution of γh , and its derivative, if it exists,
Analysis of variance
Spectral analysis of variance called the spectral density function, or spectrum.
is P
Properties of the periodogram
A trigonometric lemma (b) If h |γh |< ∞, then f exists.
Reminder: Basic definitions
Spectrum (c) A function f (ω) defined on [−1/2, 1/2] is the spectrum of a stationary process if and
Examples R 1/2
Comments
⊲ Spectral distribution
only if f (ω) = f (−ω), f (ω) ≥ 0, and −1/2 f (ω)dω < ∞.
Example
Scaling
Frequency domain analysis The symmetric increments property means that if 0 ≤ a < b ≤ 1/2, then
F (b) − F (a) = F (−a) − F (−b).
The interpretation of F is that F (ω2) − F (ω1) measures the variation accounted for by
fluctuations in frequency in the interval (ω1 , ω2 ).
Part (c) of the theorem suggests how we may construct covariance functions with
desired properties—by choosing f , which may be any scaled density function.
21 / 24
Example
22 / 24
Scaling
23 / 24
Frequency domain analysis
24 / 24