Search code examples
rtime-seriesrevisionsmoothing

Time series smoothing, avoiding revisions


This time my question is more methodological than technical. I have weekly time series data which gets updated every week. Unfortunately the time series is quite volatile. I would thus like to apply a filter/a smoothing method. I tried Hodrick-Prescott and LOESS. Both results look fine, with the downturn that if a new datapoint follows which diverges strongly from the historic data points, the older values have to be revised/are changing. Does somebody know a method which is implemented in R, which could do what I want? A name of a method/a function would probably be completely sufficient. It should however be something more sophisticated than a left sided moving average, because I would not like to lose data at the beginning of the time series. Every helping comment is appreciated! Thank you very much!

Best regards,

Andreas


Solution

  • It seems you need a robust two-sided smoother. The problem is that an outlier at an end-point is indistinguishable from a sudden change in the trend. It only becomes clear that it is an outlier after several more observations are collected (and even then some strong assumptions of trend smoothness are required).

    I think you will find it hard to do better than loess(), but other functions that aim to do robust smoothing include

    • smooth() for Tukey's smoothers;
    • supsmu() for Friedman's super smoother;

    Hodrick-Prescott smoothing is not robust to outliers.