Remove Polynomial Trend
detrend
removes the polynomial trend of order p
from the data
x
.
detrend(x, p = 1)
x |
Input vector or matrix. If |
p |
Order of the polynomial. Default: 1. The order of the polynomial can
also be given as a string, in which case |
The detrended data, of same type and dimensions as x
Kurt Hornik, Kurt.Hornik@wu-wien.ac.at.
Conversion to R by Geert van Boxtel, G.J.M.vanBoxtel@gmail.com.
t <- 0:20 x <- 3 * sin(t) + t y <- detrend(x) plot(t, x, type = "l", ylim = c(-5, 25), xlab = "", ylab = "") lines(t, y, col = "red") lines(t, x - y, lty = 2) legend('topleft', legend = c('Input Data', 'Detrended Data', 'Trend'), col = c(1, 2 ,1), lty = c(1, 1, 2))
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.