 # The Periodogram Sample covariance between X and sin(2πωt + φ) is 1

```The Periodogram
Sample covariance between X and sin(2πωt +
φ) is
−1
−1
1 TX
1 TX
¯
Xt sin(2πωt + φ) − X
sin(2πωt + φ)
T t=0
T t=0
Use identity sin(θ) = (eiθ − e−iθ )/(2i) and formulas for geometric sums to compute mean.
When ω = k/T for an integer k, not 0, we find
PT −1
that t=0 sin(2πωt + φ) = 0.
So sample covariance is simply
−1
1 TX
Xt sin(2πωt + φ) .
T t=0
For these special ω we can also compute
TX
−1
sin2(2πωt + φ) = T /2.
t=0
249
So correlation between X and sin(2πωt + φ) is
1 PT −1 X sin(2πωt + φ)
t
t=0
T
q
sx 1/2
P
¯ 2/T .
where s2
is
sample
variance
(Xt − X)
x
Adjust φ to maximize this correlation.
The sine can be rewritten as
cos(φ) sin(2πωt) + sin(φ) cos(2πωt)
so choose coefficients a and b to maximize correlation between X and
a sin(2πωt) + b cos(2πωt)
subject to the condition a2 + b2 = 1.
Correlations are scale invariant so drop condition on a and b and maximize the correlation
between X and the linear combination of sine
and cosine.
Problem solved by linear regression.
cients given by (M T M )−1M T X:
Coeffi250
M is T by 2 design matrix full of sines and
cosines.
Get M T M = T2 IT ×T ; regression coefficients are
−1
2 TX
Xt sin(2πωt)
a=
T t=0
and
−1
2 TX
b=
Xt cos(2πωt) .
T t=0
Covariance between X and best linear combination is


T
−1
T
−1

X
1 X
a
Xt sin(2πωt) + b
Xt cos(2πωt)


T
t=0
t=0
= (a2 + b2)/2.
But in fact
2
TX
−1
1
2
2
Xt exp(2πωti)
a +b =
T t=0
ˆ
is modulus of DFT X(ω)
divided by T .
251
Defn: Periodogram is function
2
ˆ
|X(ω)|
Some periodogram plots:
ˆ vs frequency for sunspots minus mean
• |X|
0
10000
Power
20000
30000
Raw Periodogram
0.0
0.1
0.2
0.3
0.4
0.5
Frequency (Cycles per Year)
Notice peak at frequency slightly below 0.1 cycles per year as well as peak at frequency close
to 0.03.
252
Plot only for frequencies from 1/12 to 1/8
which should include the largest peak.
0
10000
Power
20000
30000
Raw Periodogram for Sunspots
0.090
0.095
0.100
0.105
0.110
0.115
Frequency (Cycles per Year)
Notice: picture clearly piecewise linear.
Actually using DFT: computes sample spectrum only at frequencies of form k/T (in cycles
per point) for integer values of K.
There are only about 10 points on this plot.
253
Same plot against period (= 1/ω) shows peaks
just below 10 years and just below 11.
0
10000
Power
20000
30000
Raw Periodogram for Sunspots
8.5
9.0
9.5
10.0
10.5
11.0
11.5
Period (Years)
254
DFT can be computed very quickly at special
frequencies but to see structure clearly near a
ˆ
peak need to compute X(ω)
for a denser grid
of ω.
Use S-Plus function
transform<- function(x, a, b, n = 100)
{
f <- seq(a, b, length = n)
nn <- 1:length(x)
args <- outer(f, nn, "*") * 2 * pi
cosines <- t(cos(t(args)) * x)
sines <- t(sin(t(args)) * x)
one <- rep(1, length(x))
((cosines %*% one)^2
+ (sines %*% one)^2)/length(x)
}
to compute lots of values for periods between
8 and 12 years.
255
300000
200000
100000
0
Power
400000
500000
Plot of Spectrum vs Period for Sunspots
9
10
11
12
Period (Years)
256
Periodogram for CO2 above Mauna Loa: Linear trend removed by linear regression.
Note peaks at periods of 1 year and 6 months.
Peaks show clear annual cycle.
Annual cycle not simple sine wave – contains
overtones: components whose frequency is integer multiple of basic frequency of 1 cycle per
year.
257
0
10
20
Power
30
40
50
Power Spectrum against Period
CO2 Conc above Mauna Loa detrended
0.5
1.0
1.5
Period (Years)
258
Now a detail of this image:
0
200
Power
400
600
Detail of Mauna Loa Spectrum
Detrended
0.2
0.4
0.6
0.8
1.0
1.2
Period (Years)
259
Periodogram of various generated series which
have exact sinusoidal components.
First a pure sine wave with no noise.
Middle panel: periodogram.
ˆ
Lower panel: log10(|X(ω)|)
∗ 10.
Apparent waves: round off error log(≈ 0).
-1.0
-0.5
0.0
0.5
1.0
Pure Sine Wave at 0.04 cycles per point
200
400
600
800
1000
100
0
50
Power
150
200
0
0.0
0.1
0.2
0.3
0.4
0.5
0.4
0.5
FRequency
-50
-100
spectrum
0
Series: s1
Raw Periodogram
0.0
0.1
0.2
0.3
frequency
bandwidth= 0.000281909 , 95% C.I. is ( -5.87588 , 17.5667 )dB
260
Same series plus N(0,1) white noise.
Note: much harder to see perfect sine wave in
data but periodogram shows presence of sine
wave quite clearly.
-2
0
2
Pure Sine Wave at 0.04 cycles per point plus noise
200
400
600
800
1000
100
0
50
Power
150
0
0.0
0.1
0.2
0.3
0.4
0.5
0.4
0.5
FRequency
0
-10
-20
-30
spectrum
10
20
Series: s1 + noi
Raw Periodogram
0.0
0.1
0.2
0.3
frequency
bandwidth= 0.000281909 , 95% C.I. is ( -5.87588 , 17.5667 )dB
261
The sum of three sine waves.
-2
-1
0
1
2
Pure Sine Waves at 0.04, 0.05 and 0.24 cycles per point
200
400
600
800
1000
100
0
50
Power
150
200
0
0.0
0.1
0.2
0.3
0.4
0.5
0.4
0.5
FRequency
-50
-100
spectrum
0
Series: s1 + s2 + s3
Raw Periodogram
0.0
0.1
0.2
0.3
frequency
bandwidth= 0.000281909 , 95% C.I. is ( -5.87588 , 17.5667 )dB
262
Now add N(0,1) white noise. Periodogram still
picks out each of component.
The sum of three sine waves.
-4
-2
0
2
4
Pure Sine Wave at 0.04, 0.05 and 0.24 cycles per point plus noise
200
400
600
800
1000
100
0
50
Power
150
200
0
0.0
0.1
0.2
0.3
0.4
0.5
0.4
0.5
FRequency
0
-10
-20
spectrum
10
20
Series: s1 + s2 + s3 + noi
Raw Periodogram
0.0
0.1
0.2
0.3
frequency
bandwidth= 0.000281909 , 95% C.I. is ( -5.87588 , 17.5667 )dB
263
Multiply sine wave by damping exponential.
Signal gone ≈ quarter of way through series.
Periodogram peak still at 0.04 cycles per point.
-1.0
-0.5
0.0
0.5
Exponentially Damped Sine Wave at 0.04 cycles per point
200
400
600
800
1000
Power
0.0
0.2
0.4
0.6
0.8
0
0.0
0.1
0.2
0.3
0.4
0.5
0.4
0.5
FRequency
-150
spectrum
-100
-50
0
Series: sig * s1
Raw Periodogram
0.0
0.1
0.2
0.3
frequency
bandwidth= 0.000281909 , 95% C.I. is ( -5.87588 , 17.5667 )dB
264
With noise added can still see effect. But compare the scales on the middle plots between all
these series.
-0.5
0.0
0.5
1.0
Exponentially Damped Sine Wave at 0.04 cycles per point plus noise/4
200
400
600
800
1000
0.6
0.0
0.2
0.4
Power
0.8
1.0
0
0.0
0.1
0.2
0.3
0.4
0.5
0.4
0.5
FRequency
-20
-30
spectrum
-10
0
Series: sig * s1 + noi/4
Raw Periodogram
0.0
0.1
0.2
0.3
frequency
bandwidth= 0.000281909 , 95% C.I. is ( -5.87588 , 17.5667 )dB
265
Exponentially damped sine wave plus two sine
waves with N(0,1/16) noise.
Only two peaks visible in raw periodogram.
On logarithmic scale: hump on left of peak at
0.05 which is peak at 0.04.
Raw scale can make small secondary peaks invisible.
-2
-1
0
1
2
Exponentially Damped Sine Wave at 0.04 plus sine waves
at 0.05 and 0.24 cycles per point plus noise/4
200
400
600
800
1000
100
0
50
Power
150
0
0.0
0.1
0.2
0.3
0.4
0.5
0.4
0.5
FRequency
sig * s1 + s2 + s3 + noi/4
Raw Periodogram
-10
-20
-30
-40
spectrum
0
10
20
Series:
0.0
0.1
0.2
0.3
frequency
bandwidth= 0.000281909 , 95% C.I. is ( -5.87588 , 17.5667 )dB
266
Behaviour of DFT when sinusoid present.
Xt = A cos(2πθt + φ) + Yt
where Y is mean 0 stationary series with spectrum fY .
ˆ
ˆ (ω)+A
X(ω)
=Y
X
√
cos(2πθt+φ) exp(2πωti)/ T
Use complex exponentials to do sum.
X
cos(2πθt + φ) exp(2πωti)
=
X
exp(2πi((ω + θ)t + φ))
+
X
exp(2πi((ω − θ)t − φ))
267
For α not an integer:
X
exp(2παti) =
1 − exp(2παT i)
1 − exp(2παi)
while for α an integer the sum is T .
So: at ω = θ periodogram gets bigger as T
grows:
2 ∼ T 2 /T = T
ˆ
|X(ω)|
For other ω not too close to θ periodogram
does not grow with T .
268
Properties of the Periodogram
The discrete Fourier transform
−1
1 TX
ˆ
X(ω)
=√
Xt exp(2πωti)
T t=0
is periodic with period 1 because all the exponentials have period 1. Moreover,
ˆ − ω) =
X(1
−1
1 TX
ˆ
√
Xt exp(−2πωti) exp(2πti) = X(ω)
T t=0
so periodogram satisfies
2
ˆ − ω)|2 = |X(ω)|
ˆ
|X(1
.
So periodogram symmetric around ω = 1/2.
Called Nyquist or folding frequency.
269
(Value is always 1/2 in cycles per point; usually
converted to cycles per time unit like year or
day.)
Similarly power spectral density fX given by
fX (ω) =
∞
X
CX (h) exp(2πhωi)
−∞
is periodic with period 1 and satisfies
fX (−ω) = fX (ω)
which is equivalent to
fX (1 − ω) = fX (ω) .
270
``` # Embry-Riddle Aeronautical University Jacobs MA 243 Final Examination (Sample) 