I am trying to estimate the trend of a time series. I have used a non-robust loess smoothing with a window size of 30 points. Looking at the raw data, it is clear that there is no increase at the end of the time series (the last values of the time series are all equal to zero). However the trend shows an increase.
y=c(0,5.531,6.129,12.006,9.943,10.676,0,2.039,18.474,2.353,0.958, 0.584,7.543,1.816,1.522,5.959,26.21,3.45,9.837,-0.38,1.156,3.45,9.199, 32.591,27.1,0.2,0,3.589,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0) plot(ts(y)) n = length(y) x = 1:n # trend estimation fit = loess(y~x, span = 30/n, family = "g")$fitted lines(fit, col="red")
Why is loess producing misleading results?
Do I need to use another smoothing technique?