2

I have a timeseries of a value with a fairly high frequency (15 minutes). The timeseries has no missing values and shows some daily and weekly periodic components.

I'm trying to model it using fable in R, but I can't seem to find any decent result, and I wonder if I`m doing something wrong.

Here`s my code, using an example dataset that can be downloaded:

library(tsibble)
library(fable)
library(dplyr)
library(lubridate)

download.file("https://srv-file7.gofile.io/download/9yo0cg/so_data.csv", destfile = "so_data.csv", method = "wget")
csv = read.csv("so_data.csv") %>%
    mutate(time = ymd_hms(time)) %>%
    as_tsibble(index = time)

# Take a look
csv %>% summary
csv %>% autoplot

This is the timeseries: enter image description here As you can see it is pretty regular, with good daily periodicity. Let's try to model it using the default settings for a few models:

csv %>%
    model(
        ets = ETS(value),
        arima = ARIMA(value),
        snaive = SNAIVE(value)
    ) %>%
    forecast(h = "1 week") %>%
    autoplot(csv)

All of them fail spectacularly: enter image description here

My limited understanding of this process is clearly at fault here, and default values are not useful in this situation. However I tried tuning them, unfortunately, I was unable to capture anything better. Anyway, as I am a noob in the field I do not understand if this is due to:

  • me not setting proper default parameters (I should dive much deeper into fable's reference book)
  • the limited data I have available (short time series, only a few months)
  • approach not suitable to fast-varying data (daily and weekly recurring patterns)
  • issues in my code
Steffen Moritz
  • 7,277
  • 11
  • 36
  • 55
AF7
  • 3,160
  • 28
  • 63
  • 1
    [This](https://stats.stackexchange.com/questions/29424/time-series-modeling-with-high-frequency-data) question may give an insight. – maydin Sep 20 '19 at 08:13

1 Answers1

4

Your 15-minute frequency data exhibits multiple seasonal patterns. The models are producing poor quality forecasts as they are not designed to capture these patterns (and so they are not).

Your code looks good and (visually) the data appears to have strong patterns that an appropriate model should capture.

There are currently two more sophisticated models which work with fable that should be able to capture multiple seasonal patterns to give you better forecasts. They are:

  • Thank you for the answer. I have been playing around with both models (thank you for the Prophet interface!), with very limited success so far. I do not think this is the appropriate place to ask for help with tweaking the fits: where should I be able to do so? Maybe the chat on Cross validated SO would be more appropriate I guess... or a github issue? – AF7 Sep 23 '19 at 09:41
  • 1
    Not sure where the right place would be for this - while you've asked here I don't see an issue continuing discussion in the comments (as long as it is somewhere public for others to benefit from). I think SO is better for questions and GitHub is better for issues. I would start by visualising your seasonality in a few different ways, to get a better idea of the seasonal structure. `feasts::gg_season()` and `feasts::gg_subseries()` may help with this. Identifying the seasonal patterns should help in determining the appropriate models (daily seasonality + weekly seasonality + level perhaps). – Mitchell O'Hara-Wild Sep 24 '19 at 13:33
  • unfortunately `feasts` really does not seem to play well with very high frequency data. I'm trying with an hourly dataset now and it's all over the place. However I've been unable to use `fable.prophet` to any good result so far, but using `prophet` directly (terrible code design... but excellent performance) led to good predictions (MAPE of 10-20% depending on the dataset). – AF7 Sep 24 '19 at 15:23
  • Do you have some examples of `feasts` functions not working with high frequency data? The intention is for feasts to work with all data, but espeically for high frequency data. We've been working with it to analyse data observed every 5 minutes and haven't noticed issues. GitHub would be a good place to report these issues. As for `fable.prophet`, it calls `prophet::prophet()` directly, so I'd be interested to see what model you are attempting to specify with it. – Mitchell O'Hara-Wild Sep 24 '19 at 23:12
  • sure, I'll open some issues when I have some time. It's likely it's my own fault (or more likely lack of understanding), but let's see. – AF7 Sep 25 '19 at 06:56
  • I opened an issue for `fable.prophet`. As for the `feasts` thing, I tried to replicate with less data and it worked well, I'll try again with my larger dataset – AF7 Sep 25 '19 at 09:54