3

I found the Rob H answer to this question very interesting and works pretty well. However, I also would like to apply this methodology to an unevenly spaced time series like the following:

          date value
 1: 2011-02-02  2408
 2: 2011-03-05  2454
 3: 2011-05-09  2502
 4: 2011-06-04  2517
 5: 2011-09-12  2570
 6: 2011-10-04  2581
 7: 2011-10-26  2595
 8: 2011-11-09  2604
 9: 2011-12-01  2629
10: 2012-01-02  3596
11: 2012-02-04  2736
12: 2012-03-07  2797
13: 2012-05-09  2880
14: 2012-05-16  2887
15: 2012-06-01  2901
16: 2012-06-29  2921
17: 2012-08-03  2945
18: 2012-08-07  1912

enter image description here

Which is the best approach to apply the tsoutliers function of Rob in this case? Or do I need to look for different methods?

kjetil b halvorsen
  • 63,378
  • 26
  • 142
  • 467
Michele
  • 213
  • 1
  • 6
  • 1
    Try interpolating. Although looking at the data it is pretty clear what any function would indicate as an outlier. – mpiktas Jul 02 '13 at 12:52
  • @mpiktas hi. So your suggestion would be to basically make the time series evenly spaced? Btw, since the outliers in my data are actually so "clear", which are way do you suggest? Thanks – Michele Jul 02 '13 at 12:55
  • Interpolation does not require that a time series, or any other series, is equally spaced; nor is the idea necessarily to produce an equally spaced series. – Nick Cox Jul 02 '13 at 13:00
  • @NickCox I agree but I think it can be to estimate the value of the series at equally spaced time intervals. – Michele Jul 02 '13 at 13:03
  • Agreed; I edited my comment accordingly. – Nick Cox Jul 02 '13 at 13:04
  • 1
    @Michele, interpolate with `approx` function. Then apply Rob's function. See the results. – mpiktas Jul 02 '13 at 13:06

0 Answers0