<<

The Periodogram

• Recall: the discrete n   −1/2 X −2πiω t d ωj = n xte j , j = 0, 1, . . . , n − 1, t=1

• and the periodogram     2

I ωj = d ωj , j = 0, 1, . . . , n − 1,

• where ωj is one of the Fourier frequencies j ω = . j n

1 Sine and Cosine Transforms

• For j = 0, 1, . . . , n − 1, n   −1/2 X −2πiω t d ωj = n xte j t=1 n n −1/2 X   −1/2 X   = n xt cos 2πωjt − i × n xt sin 2πωjt t=1 t=1     = dc ωj − i × ds ωj .

    • dc ωj and ds ωj are the cosine transform and sine trans- form, respectively, of x1, x2, . . . , xn.

   2  2 • The periodogram is I ωj = dc ωj + ds ωj .

2 Sampling Distributions

• For convenience, suppose that n is odd: n = 2m + 1.

• White noise: orthogonality properties of sines and cosines mean that dc(ω1), ds(ω1), dc(ω2), ds(ω2),..., dc(ωm), ds(ωm) 1 2 have zero mean, variance 2σw, and are uncorrelated.

• Gaussian white noise: dc(ω1), ds(ω1), dc(ω2), ds(ω2),...,  1 2  dc(ωm), ds(ωm) are i.i.d. N 0, 2σw .

  1 2 2 • So for Gaussian white noise, I ωj ∼ 2σw × χ2.

3 • General case: dc(ω1), ds(ω1), dc(ω2), ds(ω2),..., dc(ωm), ds(ωm) have zero mean and are approximately uncorrelated, and h  i h  i 1   var dc ωj ≈ var ds ωj ≈ 2fx ωj ,   where fx ωj is the function.

• If xt is Gaussian,    2  2 Ix ωj dc ωj + ds ωj = approximately 2 1   1   ∼ χ2, 2fx ωj 2fx ωj

and Ix(ω1), Ix(ω2),..., Ix(ωm) are approximately indepen- dent.

4 Spectral ANOVA

• For odd n = 2m + 1, the inverse transform can be written m 2 X h        i xt − x¯ = √ dc ωj cos 2πωjt + ds ωj sin 2πωjt . n j=1

• Square and sum over t; orthogonality of sines and cosines implies that n m   X 2 X  2  2 (xt − x¯) = 2 dc ωj + ds ωj t=1 j=1 m X   = 2 I ωj . j=1

5 ANOVA table:

Source df SS MS

ω1 2 2I(ω1) I(ω1) ω2 2 2I(ω2) I(ω2) . . . . ωm 2 2I(ωm) I(ωm) P 2 Total 2m = n − 1 (xt − x¯)

6 Hypothesis Testing

• Consider the model   xt = A cos 2πωjt + φ + wt.

• Hypotheses:

– H0 : A = 0 ⇒ xt = wt, white noise;

– H1 : A > 0, white noise plus a sine wave.

• Note: no in either case.

7 • Two cases:

– ωj known: use   I ωj F = j −1 P   (m − 1) j06=j I ωj0

which is F2,2(m−1) under H0.

– ωj unknown: use max(F1,F2,...,Fm), or equivalently n   o max I ωj , j = 1, 2, . . . , n κ = −1 P   m j I ωj and ( " (m − 1 − log m)#) P(κ > ξ) ≈ 1 − exp −m exp −ξ . m − ξ

8 Example: the Southern Oscillation Index

• Using SAS: proc spectra program and output.

• Using R:

par(mfcol = c(2, 1)) # Use fft() to calculate the periodogram directly; note that # frequencies are expressed in cycles per year, and the # periodogram values are similarly scaled by 12: freq = 12 * (0:(length(soi) - 1)) / length(soi) plotit = (freq > 0) & (freq <= 6) soifft = fft(soi) / sqrt(length(soi)) plot(freq[plotit], Mod(soifft[plotit])^2 / 12, type = "l") # Use spectrum(); override some defaults to make it match: spectrum(soi, log = "no", fast = FALSE, taper = 0, detrend = FALSE)

9