# Trend estimation: strange behaviour of loess

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?

• Never blame a statistical technique for misapplication. You need to first understand the “properties” of data generating process and then choose an appropriate statistical technique to fit your data. I clearly see two segments in your data segment 1: before 30 and segment 2: after 30. Why are there two segments? May be you need a simple exponential smoothing or segment the data and apply two different models to capture heterogeneity. – forecaster Dec 12 '20 at 15:17