Tapering • The periodogram works well with data containing only Fourier frequencies: w = rnorm(128, sd = 0.01); x5 = cos(2*pi*(5/128)*(1:128)) + w; x6 = cos(2*pi*(6/128)*(1:128)) + w; par(mfcol = c(3, 1), mar = c(2, 2, 1, 1)); spectrum(x5, taper = 0, ylim = c(1e-7, 1e2)); spectrum(x6, taper = 0, ylim = c(1e-7, 1e2)); • It doesn’t work so well with other frequencies: x5h = cos(2*pi*(5.5/128)*(1:128)) + w; spectrum(x5h, taper = 0, ylim = c(1e-7, 1e2)); 1
• One solution is to taper the data: spectrum(x5h, taper = 0.5, ylim = c(1e-7, 1e2)) • This works by multiplying the data by a data window : par(mfcol = c(3, 1), mar = c(2, 2, 1, 1)); plot(tapr(rep(1, 128), 0.25)); plot(x5h); plot(tapr(x5h, 0.25)); • The data window modifies a fraction of the data at each end of the series, to make the data more nearly continuous when it is wrapped. 2
• Tapering makes the main peak wider, but much reduces side lobes . • To see the side lobes, make the periodogram graphs on a finer grid of frequencies: par(mfcol = c(2, 1), mar = c(2, 2, 1, 1)); spectrum(x5h, taper = 0.0, ylim = c(1e-7, 1e2), pad = 896) spectrum(x5h, taper = 0.5, ylim = c(1e-7, 1e2), pad = 896) • The default in R’s spectrum (or spec.pgram , which does the work) is to taper 10% at each end of the data. 3
Recommend
More recommend