| ts_fil_fft | R Documentation |
Frequency-domain low-pass smoothing using the Fast Fourier Transform (FFT), reflected boundary padding, and a smooth cosine roll-off.
ts_fil_fft(threshold = 0.9, pad_pct = 0.25, taper_pct = 0.15)
threshold |
Cumulative non-constant spectral energy threshold to retain. Larger values keep more frequency components. |
pad_pct |
Fraction of the series length used for reflected boundary padding. |
taper_pct |
Width of the cosine transition band relative to the cutoff index. |
The implementation ignores the constant component when selecting the cutoff. This prevents a large mean level from dominating the energy criterion and collapsing the output into an almost flat series. It keeps the lowest frequencies that explain the requested share of non-constant spectral energy, applies a cosine roll-off after the cutoff to reduce ringing, and reconstructs the original-length series after removing the reflected boundary padding.
A ts_fil_fft object.
J. W. Cooley and J. W. Tukey (1965). An algorithm for the machine calculation of complex Fourier series. Math. Comput.
# Frequency-domain smoothing via FFT low-pass reconstruction
# Load package and example data
library(daltoolbox)
library(tspredit)
x <- seq(0, 4 * pi, length.out = 128)
y <- sin(x) + 0.25 * sin(12 * x)
# Fit FFT-based filter and reconstruct the low-frequency signal
filter <- ts_fil_fft()
filter <- daltoolbox::fit(filter, y)
yhat <- transform(filter, y)
# Compare original vs frequency-smoothed series
plot_ts_pred(y = y, yadj = yhat)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.