1 #' @include ShapeForecaster.R
3 #' @title Persistence Shape Forecaster
5 #' @description Return the last centered last (similar) day curve.
6 #' Inherits \code{\link{ShapeForecaster}}
7 PersistenceShapeForecaster = setRefClass(
8 Class = "PersistenceShapeForecaster",
9 contains = "ShapeForecaster",
12 initialize = function(...)
16 predict = function(today, memory, horizon, ...)
18 #return centered last (similar) day curve, avoiding NAs until memory is run
19 first_day = max(1, today-memory)
24 last_similar_serie = data$getCenteredSerie(index)[1:horizon]
27 if (!any(is.na(last_similar_serie)))
28 return (last_similar_serie);
29 if (index < first_day)