Professional Documents
Culture Documents
06 Harmonic Regr
06 Harmonic Regr
Harmonic Regression
Overview
1. Example: periodic data
xt = A cos(2πωt + φ) + wt
Notation alert! Many books (including the ones I learned from) write the
sinusoids using the angular frequency notation that embeds the 2π
into the frequency as λ = 2πω. Thus, the sinusoidal model would look
like
xt = A cos(λt + φ) + wt
Notice that β12 + β22 = A2 . The sum of the squared regression coef-
ficients is the squared amplitude of the hidden sinusoid. This sum is
also, as we’ll see, proportional to the regression sum-of-squares asso-
ciated with this pair of variables.
What if the background is not white noise? Least squares provides good
estimates (i.e., efficient) of β1 and β2 if wt in the regression yt =
β1 cos 2πωt + β2 sin 2πωt + wt forms a stationary process. The expla-
nation goes back to our comparison of OLS and GLS: OLS is fully
efficient if the regression variable is an eigenvector of the covariance
matrix of the process. Sinusoids at the Fourier frequences (next sec-
tion) are just that – for any stationary process (asymptotically).
Note that the first column is all 1’s (ω0 = 0) and the last column
alternates ±1 (ωn/2 = 12 ). (There’s no sine term at ω0 or ωn/2 since
Statistics 910, #6 4
0 ... 0 0 n
where the weights on A0 and An/2 differ since there is no sine term at
these frequencies. Thus
ej = (0 . . . 0 1j 0 0 . . . 0)0 .
P
Thus we can write X = t Xt et . The harmonic model uses a different
orthogonal basis, namely the sines and cosines associated with the
Fourier frequencies. The “saturated” harmonic regression
n/2−1
X
t
Xt = b0 + bn/2 (−1) + (b2j cos(2πωj t) + b1j sin(2πωj t))
j=1
n−1
1X
Dj = yt exp(−i2πωj t)
n
t=0
n−1
1 X
= yt (cos 2πωj t − i sin 2πωj t)
n
t=0
1
= (b2j − ib1j )
2
√
Note: SS define the DFT using a divisor n rather than n; R defines
the DFT with no divisor.
One can exploit this symmetry to obtain the transform of two real-
valued series at once from one application of the FFT.
Inversion We can recover the original data from the inverse transform,
X 1 XX
Dj exp(i2πωj t) = ys exp(i2πωj t − i2πωj s)
n s
j j
1X X
= ys exp(i2πωj (t − s))
n s
j
= yt
P
since j exp(i2πωj (t − s)) = 0 for s 6= t, and otherwise is n. Using the
matrix form, multiplying both sides by F gives Y = F D immediately.
Thus, once we understand how the DFT behaves for some simple series,
we can understand it for any others that are sums of these simple cases.
yt = 1, t = 0, 1, ..., m − 1, yt = 0, t = m, m + 1, ..., n − 1,
m
then |Dj | = n Dm (2πωj ) .
Periodic function. Suppose that the input data yt is composed of
K repetitions of the sequence of H points xt so that n = KH.
Then the DFT of yt is
1 X −i2πωj t
Dy,j = yt e
n t
K−1 H−1
1 X X 2πj
= xh e−i KH (h+kH)
KH
k=0 h=0
1 X −i 2πjk 1 X 2πjh
= e K xh e−i KH
K H
k h
1 X 2πjh
= DK (2πj/K) xh e−i KH
H
( h
0 for j 6= 0, K, 2K, . . . , (H − 1)K.
=
Dx,` for j = `K.