The Periodogram • Recall: the Discrete Fourier Transform D Ωj = N Xte , J = 0
Total Page:16
File Type:pdf, Size:1020Kb
The Periodogram • Recall: the discrete Fourier transform 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 spectral density 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¯ = p 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 autocorrelation 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.