1 #' Obtain delta forecast by the Persistence method
3 #' @inheritParams getForecast
4 #' @inheritParams getZeroDeltaForecast
5 getPersistenceDeltaForecast = function(data, today, memory, horizon, shape_params, ...)
7 #return gap between end of similar day curve and first day of tomorrow (in the past)
8 first_day = max(1, today-memory)
13 last_similar_serie_end = tail( data$getCenteredSerie(index), 1)
14 last_similar_tomorrow_begin = data$getCenteredSerie(index+1)[1]
17 if (!is.na(last_similar_serie_end) && !is.na(last_similar_tomorrow_begin))
18 return (last_similar_tomorrow_begin - last_similar_serie_end);
19 if (index < first_day)