# NOT RUN {
set.seed(123)
t <- 1:20
# Linear trend
x <- 3*sin(t) + t
plotx(cbind(x, dtrend_lin(x)))
# Quadratic trend
x2 <- 3*sin(t) + t + t^2
plotx(cbind(raw = x2, quad = dtrend_quad(x2)))
# Introduce a breaking point at point = 10
xbp <- 3*sin(t) + t
xbp[10:20] <- x[10:20] + 15
plotx(cbind(raw = xbp, lin = dtrend_lin(xbp), lin_bp = dtrend_lin(xbp, bp = 10)))
# }
Run the code above in your browser using DataLab