How to smooth frequency spectrum of time series?

Viewed 494

I tried to reproduce Watson's spectrum plot from these set of slides (PDF p. 30, p.29 of the slides), that came from this data of housing building permits.

Watson achieves a very smooth spectrum curve in which it is very easy to tell the peak frequencies. When I tried to run a FFT on the data, I get a really noisy spectrum curve and I wonder if there is an intermediate step that I am missing.

I ran the fourier analysis on python, using scipy package fftpack as follows:

from scipy import fftpack

fs = 1 / 12 # monthly
N = data.shape[0]
spectrum = fftpack.fft(data.PERMITNSA.values)
freqs = fftpack.fftfreq(len(spectrum)) #* fs

plt.plot(freqs[:N//2], 20 * np.log10(np.abs(spectrum[:N//2])))

Could anyone help me with the missing link?

The original data is:

original data

Below is the Watson's spectrum curve, the one I tried to reproduce:

target spectrum

And these are my results:

my results

1 Answers

The posted curve doesn't look realistic. But there are many methods to get a smooth result with a similar amount of "curviness", using various kinds of resampling and/or plot interpolation.

One method I like is to chop the data into segments (windows, possibly overlapped) roughly 4X longer than the maximum number of "bumps" you want to see, maybe a bit longer. Then window each segment before using a much longer (size of about the resolution of the final plot you want) zero-padded FFT. Then average the results of the multiple FFTs of the multiple windowed segments. This works because a zero-padded FFT is (almost) equivalent to a highest-quality Sinc interpolating low-pass filter.

Related