Description Usage Arguments Value Author(s) See Also Examples
smooth time series with FFT
1 |
x |
Numerical vector |
sd |
Standard deviation. Determines degree of smoothing. Use negative value to return original x. |
keepNA |
Logical: keep NA values? For computation, NAs will be
interpolated with
|
quiet |
Logical. Suppress warnings about all-NA vectors? DEFAULT: FALSE |
... |
Further arguments passed to |
Smoothed vector
Berry Boessenkool, berry-b@gmx.de, Aug 2017
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | x <- cumsum(rnorm(200))
plot(x, type="l")
lines(smoothFFT(x, sd=1), col=4)
lines(smoothFFT(x, sd=4), col=2)
x[105:111] <- NA
plot(x, type="l")
lines(smoothFFT(x, sd=3), col=4, lwd=2)
lines(smoothFFT(x, sd=3, keepNA=FALSE), col=2, lty=3)
x <- seas$Koeln["gev","RP.50",,3]
plot(x, type="l")
lines(smoothFFT(x, sd=4), col=4)
lines(smooth.spline(x,spar=0.45), col=2)
x <- x[1:100]
plot(x, type="l")
lines(smoothFFT(x, sd=3), col=4) # works better for seasonal data, I guess
lines(smooth.spline(x,spar=0.45), col=2)
smoothFFT(c(42,NA,NA,NA,NA)[-1], 2)
stopifnot(all(x == smoothFFT(x, -1)))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.